3: Binary Matrix Operations
- Page ID
- 104093
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)After reading this chapter, you should be able to:
- add, subtract, and multiply matrices, and
- apply rules of binary operations on matrices.
How do you add two matrices?
Two matrices \(\left\lbrack A \right\rbrack\) and \(\left\lbrack B \right\rbrack\) can be added only if they are the same size. The addition is then shown as
\[\left\lbrack C \right\rbrack = \left\lbrack A \right\rbrack + \left\lbrack B \right\rbrack \nonumber \]
where
\[c_{ij} = a_{ij} + b_{ij} \nonumber \]
Add the following two matrices.
\(\left\lbrack A \right\rbrack = \begin{bmatrix} 5 & 2 & 3 \\ 1 & 2 & 7 \\ \end{bmatrix}\) \(\left\lbrack B \right\rbrack = \begin{bmatrix} 6 & 7 & - 2 \\ 3 & 5 & 19 \\ \end{bmatrix}\)
Solution
\[\begin{split} \left\lbrack C \right\rbrack &= \left\lbrack A \right\rbrack + \left\lbrack B \right\rbrack\\ &= \begin{bmatrix} 5 & 2 & 3 \\ 1 & 2 & 7 \\ \end{bmatrix} + \begin{bmatrix} 6 & 7 & - 2 \\ 3 & 5 & 19 \\ \end{bmatrix}\\ &= \begin{bmatrix} 5 + 6 & 2 + 7 & 3 - 2 \\ 1 + 3 & 2 + 5 & 7 + 19 \\ \end{bmatrix}\\ &= \begin{bmatrix} 11 & 9 & 1 \\ 4 & 7 & 26 \\ \end{bmatrix} \end{split} \nonumber \]
Blowout r’us store has two store locations \(A\) and \(B\), and their sales of tires are given by make (in rows) and quarters (in columns) as shown below.
\[\left\lbrack A \right\rbrack = \begin{bmatrix} \begin{matrix} 25 & 20 \\ \end{matrix} & \begin{matrix} 3 & 2 \\ \end{matrix} \\ \begin{matrix} 5 & 10 \\ \end{matrix} & \begin{matrix} 15 & 25 \\ \end{matrix} \\ \begin{matrix} 6 & 16 \\ \end{matrix} & \begin{matrix} 7 & 27 \\ \end{matrix} \\ \end{bmatrix} \nonumber \]
\[\left\lbrack B \right\rbrack = \begin{bmatrix} \begin{matrix} 20 & 5 \\ \end{matrix} & \begin{matrix} 4 & 0 \\ \end{matrix} \\ \begin{matrix} 3 & 6 \\ \end{matrix} & \begin{matrix} 15 & 21 \\ \end{matrix} \\ \begin{matrix} 4 & 1 \\ \end{matrix} & \begin{matrix} 7 & 20 \\ \end{matrix} \\ \end{bmatrix} \nonumber \]
where the rows represent the sale of Tirestone, Michigan and Copper tires respectively and the columns represent the quarter number: 1, 2, 3 and 4. What are the total tire sales for the two locations by make and quarter?
Solution
\[\begin{split} \left\lbrack C \right\rbrack &= \left\lbrack A \right\rbrack + \left\lbrack B \right\rbrack\\ &= \begin{bmatrix} \begin{matrix} 25 & 20 \\ \end{matrix} & \begin{matrix} 3 & 2 \\ \end{matrix} \\ \begin{matrix} 5 & 10 \\ \end{matrix} & \begin{matrix} 15 & 25 \\ \end{matrix} \\ \begin{matrix} 6 & 16 \\ \end{matrix} & \begin{matrix} 7 & 27 \\ \end{matrix} \\ \end{bmatrix} + \begin{bmatrix} \begin{matrix} 20 & 5 \\ \end{matrix} & \begin{matrix} 4 & 0 \\ \end{matrix} \\ \begin{matrix} 3 & 6 \\ \end{matrix} & \begin{matrix} 15 & 21 \\ \end{matrix} \\ \begin{matrix} 4 & 1 \\ \end{matrix} & \begin{matrix} 7 & 20 \\ \end{matrix} \\ \end{bmatrix}\\ &= \left\lbrack \begin{matrix} \left( 25 + 20 \right) \\ \left( 5 + 3 \right) \\ \left( 6 + 4 \right) \\ \end{matrix}\begin{matrix} \left( 20 + 5 \right) \\ \left( 10 + 6 \right) \\ \left( 16 + 1 \right) \\ \end{matrix}\begin{matrix} \left( 3 + 4 \right) \\ \left( 15 + 15 \right) \\ \left( 7 + 7 \right) \\ \end{matrix}\begin{matrix} \left( 2 + 0 \right) \\ \left( 25 + 21 \right) \\ \left( 27 + 20 \right) \\ \end{matrix} \right\rbrack\\ &= \left\lbrack \begin{matrix} 45 \\ 8 \\ 10 \\ \end{matrix}\begin{matrix} 25 \\ 16 \\ 17 \\ \end{matrix}\begin{matrix} 7 \\ 30 \\ 14 \\ \end{matrix}\begin{matrix} 2 \\ 46 \\ 47 \\ \end{matrix} \right\rbrack \end{split} \nonumber \]
So, if one wants to know the total number of Copper tires sold in quarter \(4\) at the two locations, we would look at Row \(3\) – Column \(4\) to give \(c_{34} = 47\).
How do you subtract two matrices?
Two matrices \(\left\lbrack A \right\rbrack\) and \(\left\lbrack B \right\rbrack\) can be subtracted only if they are the same size. The subtraction is then shown as
\[\left\lbrack D \right\rbrack = \left\lbrack A \right\rbrack - \left\lbrack B \right\rbrack \nonumber \]
where
\[d_{ij} = a_{ij} - b_{ij} \nonumber \]
Subtract matrix \(\left\lbrack B \right\rbrack\) from matrix \(\left\lbrack A \right\rbrack\).
\[\left\lbrack A \right\rbrack = \begin{bmatrix} 5 & 2 & 3 \\ 1 & 2 & 7 \\ \end{bmatrix} \nonumber \]
\[\left\lbrack B \right\rbrack = \begin{bmatrix} 6 & 7 & - 2 \\ 3 & 5 & 19 \\ \end{bmatrix} \nonumber \]
Solution
\[\begin{split} \left\lbrack D \right\rbrack &= \left\lbrack A \right\rbrack - \left\lbrack B \right\rbrack\\ &= \begin{bmatrix} 5 & 2 & 3 \\ 1 & 2 & 7 \\ \end{bmatrix} - \begin{bmatrix} 6 & 7 & - 2 \\ 3 & 5 & 19 \\ \end{bmatrix}\\ &= \begin{bmatrix} \left( 5 - 6 \right) & \left( 2 - 7 \right) & \left( 3 - \left( - 2 \right) \right) \\ \left( 1 - 3 \right) & \left( 2 - 5 \right) & \left( 7 - 19 \right) \\ \end{bmatrix}\\ &= \begin{bmatrix} - 1 & - 5 & 5 \\ - 2 & - 3 & - 12 \\ \end{bmatrix} \end{split} \nonumber \]
Blowout r’us has two store locations \(A\) and \(B\) and their sales of tires are given by make (in rows) and quarters (in columns) as shown below.
\[\left\lbrack A \right\rbrack = \left\lbrack \begin{matrix} 25 \\ 5 \\ 6 \\ \end{matrix}\begin{matrix} 20 \\ 10 \\ 16 \\ \end{matrix}\begin{matrix} 3 \\ 15 \\ 7 \\ \end{matrix}\begin{matrix} 2 \\ 25 \\ 27 \\ \end{matrix} \right\rbrack \nonumber \]
\[\left\lbrack B \right\rbrack = \left\lbrack \begin{matrix} 20 \\ 3 \\ 4 \\ \end{matrix}\begin{matrix} 5 \\ 6 \\ 1 \\ \end{matrix}\begin{matrix} 4 \\ 15 \\ 7 \\ \end{matrix}\begin{matrix} 0 \\ 21 \\ 20 \\ \end{matrix} \right\rbrack \nonumber \]
where the rows represent the sale of Tirestone, Michigan and Copper tires respectively and the columns represent the quarter number: 1, 2, 3, and 4. How many more tires did store \(A\) sell than store \(B\) of each brand in each quarter?
Solution
\[\begin{split} \left\lbrack D \right\rbrack &= \left\lbrack A \right\rbrack - \left\lbrack B \right\rbrack\\ &= \left\lbrack \begin{matrix} 25 \\ 5 \\ 6 \\ \end{matrix}\begin{matrix} 20 \\ 10 \\ 16 \\ \end{matrix}\begin{matrix} 3 \\ 15 \\ 7 \\ \end{matrix}\begin{matrix} 2 \\ 25 \\ 27 \\ \end{matrix} \right\rbrack - \left\lbrack \begin{matrix} 20 \\ 3 \\ 4 \\ \end{matrix}\begin{matrix} 5 \\ 6 \\ 1 \\ \end{matrix}\begin{matrix} 4 \\ 15 \\ 7 \\ \end{matrix}\begin{matrix} 0 \\ 21 \\ 20 \\ \end{matrix} \right\rbrack\\ &= \left\lbrack \begin{matrix} \left( 25 - 20 \right) \\ \left( 5 - 3 \right) \\ \left( 6 - 4 \right) \\ \end{matrix}\begin{matrix} \left( 20 - 5 \right) \\ \left( 10 - 6 \right) \\ \left( 16 - 1 \right) \\ \end{matrix}\begin{matrix} \left( 3 - 4 \right) \\ \left( 15 - 15 \right) \\ \left( 7 - 7 \right) \\ \end{matrix}\begin{matrix} \left( 2 - 0 \right) \\ \left( 25 - 21 \right) \\ \left( 27 - 20 \right) \\ \end{matrix} \right\rbrack\\ &= \left\lbrack \begin{matrix} 5 \\ 2 \\ 2 \\ \end{matrix}\begin{matrix} 15 \\ 4 \\ 15 \\ \end{matrix}\begin{matrix} - 1 \\ 0 \\ 0 \\ \end{matrix}\begin{matrix} 2 \\ 4 \\ 7 \\ \end{matrix} \right\rbrack \end{split} \nonumber \]
So, if you want to know how many more Copper tires were sold in quarter \(4\) in store \(A\) than store \(B\), \(d_{34} = 7\). Note that \(d_{13} = - 1\) implies that store \(A\) sold 1 less Michigan tire than store \(B\) in quarter \(3\).
How do I multiply two matrices?
Two matrices \(\left\lbrack A \right\rbrack\) and \(\left\lbrack B \right\rbrack\) can be multiplied only if the number of columns of \(\left\lbrack A \right\rbrack\) is equal to the number of rows of \(\left\lbrack B \right\rbrack\) to give
\[\left\lbrack C \right\rbrack_{m \times n} = \left\lbrack A \right\rbrack_{m \times p}\left\lbrack B \right\rbrack_{p \times n} \nonumber \]
If \(\left\lbrack A \right\rbrack\) is a \(m \times p\) matrix and \(\left\lbrack B \right\rbrack\) is a \(p \times n\) matrix, the resulting matrix \(\left\lbrack C \right\rbrack\) is a \(m \times n\) matrix.
So how does one calculate the elements of \(\left\lbrack C \right\rbrack\) matrix?
\[\begin{split} c_{ij} &= \sum_{k = 1}^{p}{a_{ik}b_{kj}}\\ &= a_{i1}b_{1j} + a_{i2}b_{2j} + \ldots + a_{ip}b_{pj} \end{split} \nonumber \]
for each \(i = 1,\ 2,\ \ldots\ \ ,\ m\) and \(j = 1,\ 2,\ \ldots\ \ ,\ n\).
To put it in simpler terms, the \(i^{th}\) row and \(j^{th}\) column of the \(\left\lbrack C \right\rbrack\) matrix in \(\left\lbrack C \right\rbrack = \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack\) is calculated by multiplying the \(i^{th}\) row of \(\left\lbrack A \right\rbrack\) by the \(j^{th}\) column of \(\left\lbrack B \right\rbrack\). That is
\[\begin{split} c_{ij} &= \left\lceil a_{i1}a_{i2}\ \ \ldots\ \ \ a_{\text{ip}} \right\rceil\begin{bmatrix} \begin{matrix} b_{1j} \\ b_{2j} \\ \end{matrix} \\ \begin{matrix} \vdots \\ b_{\text{pj}} \\ \end{matrix} \\ \end{bmatrix}\\ &= a_{i1}b_{1j} + a_{i2}b_{2j} + \ldots + a_{\text{ip}}b_{\text{pj}}\\ &= \sum_{k = 1}^{p}{a_{\text{ik}}b_{\text{kj}}} \end{split} \nonumber \]
Given
\[\left\lbrack A \right\rbrack = \begin{bmatrix} 5 & 2 & 3 \\ 1 & 2 & 7 \\ \end{bmatrix} \nonumber \]
\[\left\lbrack B \right\rbrack = \begin{bmatrix} 3 & - 2 \\ 5 & - 8 \\ 9 & - 10 \\ \end{bmatrix} \nonumber \]
Find
\[\left\lbrack C \right\rbrack = \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack \nonumber \]
Solution
\(c_{12}\) can be found by multiplying the first row of \(\left\lbrack A \right\rbrack\) by the second column of \(\left\lbrack B \right\rbrack\),
\[\begin{split} c_{12} &= \begin{bmatrix} 5 & 2 & 3 \\ \end{bmatrix}\begin{bmatrix} -2 \\ -8 \\ -10 \\ \end{bmatrix}\\ &= \left( 5 \right)\left( - 2 \right) + \left( 2 \right)\left( - 8 \right) + \left( 3 \right)\left( - 10 \right)\\ &= -56 \end{split} \nonumber \]
Similarly, one can find the other elements of \(\left\lbrack C \right\rbrack\) to give
\[\left\lbrack C \right\rbrack = \begin{bmatrix} 52 & - 56 \\ 76 & - 88 \\ \end{bmatrix} \nonumber \]
Blowout r’us store location \(A\) and the sales of tires are given by make (in rows) and quarters (in columns) as shown below
\[\left\lbrack A \right\rbrack = \left\lbrack \begin{matrix} 25 \\ 5 \\ 6 \\ \end{matrix}\begin{matrix} 20 \\ 10 \\ 16 \\ \end{matrix}\begin{matrix} 3 \\ 15 \\ 7 \\ \end{matrix}\begin{matrix} 2 \\ 25 \\ 27 \\ \end{matrix} \right\rbrack \nonumber \]
where the rows represent the sale of Tirestone, Michigan and Copper tires respectively and the columns represent the quarter number: 1, 2, 3, and 4. Find the per quarter sales of store \(A\) if the following are the prices of each tire:
- Tirestone = \(\$33.25\)
- Michigan = \(\$40.19\)
- Copper = \(\$25.03\)
Solution
The answer is given by multiplying the price matrix by the quantity of sales of store \(A\). The price matrix is \(\begin{bmatrix} 33.25 & 40.19 & 25.03 \\ \end{bmatrix}\), so the per-quarter sales of store \(A\) would be given by:
\[\left\lbrack C \right\rbrack = \begin{bmatrix} 33.25 & 40.19 & 25.03 \\ \end{bmatrix}\left\lbrack \begin{matrix} 25 \\ 5 \\ 6 \\ \end{matrix}\begin{matrix} 20 \\ 10 \\ 16 \\ \end{matrix}\begin{matrix} 3 \\ 15 \\ 7 \\ \end{matrix}\begin{matrix} 2 \\ 25 \\ 27 \\ \end{matrix} \right\rbrack \nonumber \]
\[c_{ij} = \sum_{k = 1}^{3}{a_{ik}b_{kj}} \nonumber \]
\[\begin{split} c_{11} &= \sum_{k = 1}^{3}{a_{1k}b_{k1}}\\ &= a_{11}b_{11} + a_{12}b_{21} + a_{13}b_{31}\\ &= \left( 33.25 \right)\left( 25 \right) + \left( 40.19 \right)\left( 5 \right) + \left( 25.03 \right)\left( 6 \right)\\ &= \text{\$} 1182.38 \end{split} \nonumber \]
Similarly
\[c_{12} = \$ 1467.38 \nonumber \]
\[c_{13} = \$ 877.81 \nonumber \]
\[c_{14} = \$ 1747.06 \nonumber \]
Therefore, each quarter sales of store \(A\) in dollars is given by the four columns of the row vector
\[\left\lbrack C \right\rbrack = \left\lbrack 1182.38\ \ \ 1467.38\ \ \ 877.81\ \ \ 1747.06 \right\rbrack \nonumber \]
Remember, since we are multiplying a \(1 \times 3\) matrix by a \(3 \times 4\) matrix, the resulting matrix is a \(1 \times 4\) matrix.
What is the scalar multiplication of a matrix?
If \(\left\lbrack A \right\rbrack\) is a \(m \times n\) matrix and \(k\) is a real number, then the multiplication \(\left\lbrack A \right\rbrack\) by a scalar \(k\) is another \(m \times n\) matrix \(\left\lbrack B \right\rbrack\), where
\(b_{ij} = k\ a_{ij}\) for all \(i,\ j\).
Let
\[\left\lbrack A \right\rbrack = \begin{bmatrix} 2.1 & 3 & 2 \\ 5 & 1 & 6 \\ \end{bmatrix} \nonumber \]
Find \(2\left\lbrack A \right\rbrack\)
Solution
\[\begin{split} 2\left\lbrack A \right\rbrack &= 2\begin{bmatrix} 2.1 & 3 & 2 \\ 5 & 1 & 6 \\ \end{bmatrix}\\ &= \begin{bmatrix} 2 \times 2.1 & 2 \times 3 & 2 \times 2 \\ 2 \times 5 & 2 \times 1 & 2 \times 6 \\ \end{bmatrix}\\ & = \begin{bmatrix} 4.2 & 6 & 4 \\ 10 & 2 & 12 \\ \end{bmatrix} \end{split} \nonumber \]
What is a linear combination of matrices?
If \(\left\lbrack A_{1} \right\rbrack,\left\lbrack A_{2} \right\rbrack,\ \ldots\ ,\ \left\lbrack A_{p} \right\rbrack\) are matrices of the same size and \(k_{1},\ k_{2},\ \ldots\ ,\ k_{p}\) are scalars, then
\[k_{1}\left\lbrack A_{1} \right\rbrack + k_{2}\left\lbrack A_{2} \right\rbrack + \ \ldots\ + k_{p}\left\lbrack A_{p} \right\rbrack \nonumber \]
is called a linear combination of \(\left\lbrack A_{1} \right\rbrack,\left\lbrack A_{2} \right\rbrack,\ \ldots\ ,\ \left\lbrack A_{p} \right\rbrack\).
If
\[\left\lbrack A_{1} \right\rbrack = \begin{bmatrix} 5 & 6 & 2 \\ 3 & 2 & 1 \\ \end{bmatrix},\ \left\lbrack A_{2} \right\rbrack = \begin{bmatrix} 2.1 & 3 & 2 \\ 5 & 1 & 6 \\ \end{bmatrix},\ \left\lbrack A_{3} \right\rbrack = \begin{bmatrix} 0 & 2.2 & 2 \\ 3 & 3.5 & 6 \\ \end{bmatrix} \nonumber \]
then find
\[\left\lbrack A_{1} \right\rbrack + 2\left\lbrack A_{2} \right\rbrack - 0.5\left\lbrack A_{3} \right\rbrack \nonumber \]
Solution
\[\left\lbrack A_{1} \right\rbrack + 2\left\lbrack A_{2} \right\rbrack - 0.5\left\lbrack A_{3} \right\rbrack \nonumber \]
\[\begin{split} &= \begin{bmatrix} 5 & 6 & 2 \\ 3 & 2 & 1 \\ \end{bmatrix} + 2\begin{bmatrix} 2.1 & 3 & 2 \\ 5 & 1 & 6 \\ \end{bmatrix} - 0.5\begin{bmatrix} 0 & 2.2 & 2 \\ 3 & 3.5 & 6 \\ \end{bmatrix}\\ &= \begin{bmatrix} 5 & 6 & 2 \\ 3 & 2 & 1 \\ \end{bmatrix} + \begin{bmatrix} 4.2 & 6 & 4 \\ 10 & 2 & 12 \\ \end{bmatrix} - 0.5\begin{bmatrix} 0 & 1.1 & 1 \\ 1.5 & 1.75 & 3 \\ \end{bmatrix}\\ &= \begin{bmatrix} 9.2 & 10.9 & 5 \\ 11.5 & 2.25 & 10 \\ \end{bmatrix} \end{split} \nonumber \]
What are some of the rules of binary matrix operations?
Commutative law of addition
If \(\left\lbrack A \right\rbrack\) and \(\left\lbrack B \right\rbrack\) are \(m \times n\) matrices, then
\[\left\lbrack A \right\rbrack + \left\lbrack B \right\rbrack = \left\lbrack B \right\rbrack + \left\lbrack A \right\rbrack \nonumber \]
Associative law of addition
If \(\left\lbrack A \right\rbrack\), \(\left\lbrack B \right\rbrack\), and \(\left\lbrack C \right\rbrack\) are all \(m \times n\) matrices, then
\[\left\lbrack A \right\rbrack + \left( \left\lbrack B \right\rbrack + \left\lbrack C \right\rbrack \right) = \left( \left\lbrack A \right\rbrack + \left\lbrack B \right\rbrack \right) + \left\lbrack C \right\rbrack \nonumber \]
Associative law of multiplication
If \(\left\lbrack A \right\rbrack\), \(\left\lbrack B \right\rbrack\), and \(\left\lbrack C \right\rbrack\) are \(m \times n\), \(n \times p\), and \(p \times r\) size matrices, respectively, then
\[\left\lbrack A \right\rbrack\left( \left\lbrack B \right\rbrack\left\lbrack C \right\rbrack \right) = \left( \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack \right)\left\lbrack C \right\rbrack \nonumber \]
and the resulting matrix size on both sides of the equation is \(m \times p\).
Distributive law
If \(\left\lbrack A \right\rbrack\) and \(\left\lbrack B \right\rbrack\) are \(m \times n\) size matrices, and \(\left\lbrack C \right\rbrack\) and \(\left\lbrack D \right\rbrack\) are \(n \times p\) size matrices
\[\left\lbrack A \right\rbrack\left( \left\lbrack C \right\rbrack + \left\lbrack D \right\rbrack \right) = \left\lbrack A \right\rbrack\left\lbrack C \right\rbrack + \left\lbrack A \right\rbrack\left\lbrack D \right\rbrack \nonumber \]
\[\left( \left\lbrack A \right\rbrack + \left\lbrack B \right\rbrack \right)\left\lbrack C \right\rbrack = \left\lbrack A \right\rbrack\left\lbrack C \right\rbrack + \left\lbrack B \right\rbrack\left\lbrack C \right\rbrack \nonumber \]
And the resulting matrix size on both sides of the equation is \(m \times p\).
Illustrate the associative law of multiplication of matrices using
\[\left\lbrack A \right\rbrack = \begin{bmatrix} 1 & 2 \\ 3 & 5 \\ 0 & 2 \\ \end{bmatrix},\ \ \ \ \left\lbrack B \right\rbrack = \begin{bmatrix} 2 & 5 \\ 9 & 6 \\ \end{bmatrix},\ \ \ \ \left\lbrack C \right\rbrack = \begin{bmatrix} 2 & 1 \\ 3 & 5 \\ \end{bmatrix} \nonumber \]
Solution
\[\begin{split} \left\lbrack B \right\rbrack\left\lbrack C \right\rbrack &= \begin{bmatrix} 2 & 5 \\ 9 & 6 \\ \end{bmatrix}\begin{bmatrix} 2 & 1 \\ 3 & 5 \\ \end{bmatrix}\\ &= \begin{bmatrix} 19 & 27 \\ 36 & 39 \\ \end{bmatrix} \end{split} \nonumber \]
\[\begin{split} \left\lbrack A \right\rbrack\left( \left\lbrack B \right\rbrack\left\lbrack C \right\rbrack \right) &= \begin{bmatrix} 1 & 2 \\ 3 & 5 \\ 0 & 2 \\ \end{bmatrix}\begin{bmatrix} 19 & 27 \\ 36 & 39 \\ \end{bmatrix}\\ &= \begin{bmatrix} 91 & 105 \\ 237 & 276 \\ 72 & 78 \\ \end{bmatrix} \end{split} \nonumber \]
\[\begin{split} \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack &= \begin{bmatrix} 1 & 2 \\ 3 & 5 \\ 0 & 2 \\ \end{bmatrix}\begin{bmatrix} 2 & 5 \\ 9 & 6 \\ \end{bmatrix}\\ &= \begin{bmatrix} 20 & 17 \\ 51 & 45 \\ 18 & 12 \\ \end{bmatrix} \end{split} \nonumber \]
\[\begin{split} \left( \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack \right)\left\lbrack C \right\rbrack &= \begin{bmatrix} 20 & 17 \\ 51 & 45 \\ 18 & 12 \\ \end{bmatrix}\begin{bmatrix} 2 & 1 \\ 3 & 5 \\ \end{bmatrix}\\ &= \begin{bmatrix} 91 & 105 \\ 237 & 276 \\ 72 & 78 \\ \end{bmatrix} \end{split} \nonumber \]
The above illustrates the associative law of multiplication of matrices.
Is [A][B] = [B][A]?
If \(\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack\) exists, number of columns of \(\left\lbrack A \right\rbrack\) has to be same as the number of rows of \(\left\lbrack B \right\rbrack\) and if \(\left\lbrack B \right\rbrack\left\lbrack A \right\rbrack\) exists, number of columns of \(\left\lbrack B \right\rbrack\) has to be same as the number of rows of \(\left\lbrack A \right\rbrack\). Now for \(\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack = \left\lbrack B \right\rbrack\left\lbrack A \right\rbrack\), the resulting matrix from \(\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack\) and \(\left\lbrack B \right\rbrack\left\lbrack A \right\rbrack\) has to be of the same size. This is only possible if \(\left\lbrack A \right\rbrack\) and \(\left\lbrack B \right\rbrack\) are square and are of the same size. Even then in general \(\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack \neq \left\lbrack B \right\rbrack\left\lbrack A \right\rbrack\)
Determine if
\[\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack = \left\lbrack B \right\rbrack\left\lbrack A \right\rbrack \nonumber \]
For the following matrices
\[\left\lbrack A \right\rbrack = \begin{bmatrix} 6 & 3 \\ 2 & 5 \\ \end{bmatrix},\ \ \ \ \left\lbrack B \right\rbrack = \begin{bmatrix} - 3 & 2 \\ 1 & 5 \\ \end{bmatrix} \nonumber \]
Solution
\[\begin{split} \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack &= \begin{bmatrix} 6 & 3 \\ 2 & 5 \\ \end{bmatrix}\begin{bmatrix} - 3 & 2 \\ 1 & 5 \\ \end{bmatrix}\\ &= \begin{bmatrix} - 15 & 27 \\ - 1 & 29 \\ \end{bmatrix} \end{split} \nonumber \]
\[\begin{split} \left\lbrack B \right\rbrack\left\lbrack A \right\rbrack &= \begin{bmatrix} - 3 & 2 \\ 1 & 5 \\ \end{bmatrix}\begin{bmatrix} 6 & 3 \\ 2 & 5 \\ \end{bmatrix}\\ &= \begin{bmatrix} - 14 & 1 \\ 16 & 28 \\ \end{bmatrix} \end{split} \nonumber \]
\[\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack \neq \left\lbrack B \right\rbrack\left\lbrack A \right\rbrack \nonumber \]
Binary Matrix Operations Quiz
If \(\left\lbrack A \right\rbrack = \begin{bmatrix} 5 & 6 \\ 7 & - 3 \\ \end{bmatrix}\)and \(\left\lbrack B \right\rbrack = \begin{bmatrix} 2 \\ - 3 \\ \end{bmatrix}\) then \(\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack =\)
(A) \(\begin{bmatrix} - 8 \\ 23 \\ \end{bmatrix}\)
(B) \(\begin{bmatrix} 10 & 12 \\ 14 & 9 \\ \end{bmatrix}\)
(C) \(\begin{bmatrix} - 2 & 5 \\ \end{bmatrix}\)
(D) not possible
For the product \(\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack\)to be possible
(A) the number of rows of \(\left\lbrack A \right\rbrack\) needs to be the ame as the number of columns of \(\left\lbrack B \right\rbrack\)
(B) the number of columns of \(\left\lbrack A \right\rbrack\) needs to be the same as the number of rows of \(\left\lbrack B \right\rbrack\)
(C) the number of rows of \(\left\lbrack A \right\rbrack\) and\(\left\lbrack B \right\rbrack\) needs to be the same
(D) the number of columns of \(\left\lbrack A \right\rbrack\) and\(\left\lbrack B \right\rbrack\) needs to be the same
If \(\left\lbrack A \right\rbrack = \begin{bmatrix} 50 & 60 \\ 20 & - 30 \\ \end{bmatrix}\) then 6\(\left\lbrack A \right\rbrack\)is equal to
(A) \(\begin{bmatrix} 50 & 360 \\ 120 & - 180 \\ \end{bmatrix}\)
(B) \(\begin{bmatrix} 300 & 60 \\ 20 & - 30 \\ \end{bmatrix}\)
(C) \(\begin{bmatrix} 300 & 360 \\ 120 & - 180 \\ \end{bmatrix}\)
(D) \(\begin{bmatrix} 56 & 66 \\ 26 & - 24 \\ \end{bmatrix}\)
\(\left\lbrack A \right\rbrack\) and \(\left\lbrack B \right\rbrack\) are square matrices of \(n \times n\) order. Then \((\left\lbrack A \right\rbrack - \left\lbrack B \right\rbrack)(\left\lbrack A \right\rbrack - \left\lbrack B \right\rbrack)\) is equal to
(A) \(\left\lbrack A \right\rbrack^{2} + \left\lbrack B \right\rbrack^{2} - 2\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack\)
(B) \(\left\lbrack A \right\rbrack^{2} + \left\lbrack B \right\rbrack^{2}\)
(C) \(\left\lbrack A \right\rbrack^{2} - \left\lbrack B \right\rbrack^{2}\)
(D) \(\left\lbrack A \right\rbrack^{2} + \left\lbrack B \right\rbrack^{2} - \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack - \left\lbrack B \right\rbrack\left\lbrack A \right\rbrack\)
Given \(\left\lbrack A \right\rbrack\) is a rectangular matrix and \(c\left\lbrack A \right\rbrack = \left\lbrack 0 \right\rbrack\), then choose the most appropriate answer.
(A) \(C = 0\)
(B) \(C = 0\) and \(\left\lbrack A \right\rbrack = \left\lbrack 0 \right\rbrack\)
(C) \(C = 0\) or \(\left\lbrack A \right\rbrack = \left\lbrack 0 \right\rbrack\)
(D) \(C = 0\) and \(\left\lbrack A \right\rbrack\) is a non-zero matrix
You sell Jupiter and Fickers Candy bars. The sales in January are 25 and 30 of Jupiter and Fickers, respectively. In February, the sales are 75 and 35 of Jupiter and Fickers, respectively. If a Jupiter bar costs $2 and a Fickers bar costs $7, then if
\[\left\lbrack A \right\rbrack = \begin{bmatrix} 25 & 30 \\ 75 & 35 \\ \end{bmatrix}, \;\; and \nonumber \]
\[\left\lbrack B \right\rbrack = \begin{bmatrix} 2 \\ 7 \\ \end{bmatrix}, \nonumber \]
the total sales amount in each month is given by
(A) \(\left\lbrack B \right\rbrack\left\lbrack A \right\rbrack\)
(B) \(\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack\)
(C) \(2\left\lbrack A \right\rbrack\)
(D) \(7\left\lbrack A \right\rbrack\)
Binary Matrix Operations Exercise
For the following matrices
\(\lbrack A\rbrack = \begin{bmatrix} \begin{matrix} 3 \\ - 1 \\ \end{matrix} & \begin{matrix} 0 \\ 2 \\ \end{matrix} \\ 1 & 1 \\ \end{bmatrix}\), \(\lbrack B\rbrack = \begin{bmatrix} 4 & - 1 \\ 0 & 2 \\ \end{bmatrix}\), \(\lbrack C\rbrack = \begin{bmatrix} \begin{matrix} 5 \\ 3 \\ \end{matrix} & \begin{matrix} 2 \\ 5 \\ \end{matrix} \\ 6 & 7 \\ \end{bmatrix}\)
Find where possible
- \(4\lbrack A\rbrack + 5\lbrack C\rbrack\)
- \(\lbrack A\rbrack\lbrack B\rbrack\)
- \(\lbrack A\rbrack = 2\lbrack C\rbrack\)
- Answer
-
A. \(= \begin{bmatrix} \begin{matrix} 37 \\ 11 \\ \end{matrix} & \begin{matrix} 10 \\ 33 \\ \end{matrix} \\ 34 & 39 \\ \end{bmatrix}\)
B. \(= \begin{bmatrix} 12 & - 3 \\ - 4 & 5 \\ 4 & 1 \\ \end{bmatrix}\)
C. \(= \begin{bmatrix} - 7 & - 4 \\ - 7 & - 8 \\ - 11 & - 13 \\ \end{bmatrix}\)
Food orders are taken from two engineering departments for a takeout. The order is tabulated below.
Food order:
\[\begin{matrix} \text{Mechanical} \\ \text{Civil} \\ \end{matrix}\overset{\begin{matrix} \begin{matrix} \text{Chicken} \\ \text{Sandwich} \\ \end{matrix} & \text{Fries} & \text{Drink} \\ \end{matrix}}{\begin{bmatrix} 25\ \ & 35 & \ \ 25 \\ 21\ \ & 20 & \ \ 21 \\ \end{bmatrix}} \nonumber \]
However they have a choice of buying this food from three different restaurants. Their prices for the three food items are tabulated below
Price Matrix:
\[\begin{matrix} \text{Chicken} \ \ \text{Sandwich} \\ \text{Fries} \\ \text{Drink} \\ \end{matrix}\overset{\begin{matrix} \text{McFat} & \text{Burcholestrol} & \begin{matrix} \text{Kentucky} \\ \text{Sodium} \\ \end{matrix} \\ \end{matrix}}{\begin{bmatrix} 2.42\ \ \ \ & 2.38 & \ \ 2.46 \\ 0.93\ \ \ \ & 0.90 & \ \ 0.89 \\ 0.95\ \ \ \ & 1.03 & \ \ 1.13 \\ \end{bmatrix}} \nonumber \]
Show how much each department will pay for their order at each restaurant. Which restaurant would be more economical to order from for each department?
- Answer
-
The cost in dollars is 116.80, 116.75, 120.90 for the Mechanical Department at three fast food joints. So BurCholestrol is the cheapest for the Mechanical Department. The cost in dollars is 89.37, 89.61, 93.19 for the Civil Department at three fast food joints. McFat is the cheapest for the Civil Department.
Given
\(\left\lbrack A \right\rbrack = \begin{bmatrix} 2 & 3 & 5 \\ 6 & 7 & 9 \\ 2 & 1 & 3 \\ \end{bmatrix}\)
\(\left\lbrack B \right\rbrack = \begin{bmatrix} 3 & 5 \\ 2 & 9 \\ 1 & 6 \\ \end{bmatrix}\)
\(\left\lbrack C \right\rbrack = \begin{bmatrix} 5 & 2 \\ 3 & 9 \\ 7 & 6 \\ \end{bmatrix}\)
Illustrate the distributive law of binary matrix operations
\(\left\lbrack A \right\rbrack\left( \left\lbrack B \right\rbrack + \left\lbrack C \right\rbrack \right) = \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack + \left\lbrack A \right\rbrack\left\lbrack C \right\rbrack\)
- Answer
-
\[\left\lbrack B \right\rbrack + \left\lbrack C \right\rbrack = \begin{bmatrix} 3 & 5 \\ 2 & 9 \\ 1 & 6 \\ \end{bmatrix} + \begin{bmatrix} 5 & 2 \\ 3 & 9 \\ 7 & 6 \\ \end{bmatrix} \nonumber \]
\[= \begin{bmatrix} 8 & 7 \\ 5 & 18 \\ 8 & 12 \\ \end{bmatrix} \nonumber \]
\[\left\lbrack A \right\rbrack\left( \left\lbrack B \right\rbrack + \left\lbrack C \right\rbrack \right) = \begin{bmatrix} 71 & 128 \\ 155 & 276 \\ 45 & 68 \\ \end{bmatrix} \nonumber \]
\[\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack = \begin{bmatrix} 17 & 67 \\ 41 & 147 \\ 11 & 37 \\ \end{bmatrix} \nonumber \]
\[\left\lbrack A \right\rbrack\left\lbrack C \right\rbrack = \begin{bmatrix} 54 & 61 \\ 114 & 129 \\ 34 & 31 \\ \end{bmatrix} \nonumber \]
\[\left\lbrack A \right\rbrack\left\lbrack B \right\rbrack + \left\lbrack A \right\rbrack\left\lbrack C \right\rbrack = \begin{bmatrix} 71 & 128 \\ 155 & 276 \\ 45 & 68 \\ \end{bmatrix} \nonumber \]
Let \(\lbrack I\rbrack\) be a \(n \times n\) identity matrix. Show that \(\lbrack A\rbrack\lbrack\lbrack I\rbrack = \lbrack I\rbrack\lbrack A\rbrack = \lbrack A\rbrack\) for every \(n \times n\) matrix \(\lbrack A\rbrack\).
Let \(\left\lbrack C \right\rbrack_{n \times n} = \left\lbrack A \right\rbrack_{n \times n}\left\lbrack I \right\rbrack_{n \times n}\)
- Answer
-
Hint: \(c_{ij} = \sum_{p = 1}^{n}a_{ip}i_{pj}\)
\(= a_{i1}i_{1j} + \ldots\ldots + a_{i,j - 1}i_{j - 1,j} + a_{ij}i_{jj} + a_{i\left( j + 1 \right)}i_{\left( j + 1 \right)j} + \ldots\ldots + a_{in}i_{nj}\)
Since
\(i_{ij} = 0\) for \(i \neq j\)
\(= 1\) for \(i = j\)
\(c_{ij} = a_{ij}\)
So \(\left\lbrack A \right\rbrack = \left\lbrack A \right\rbrack\left\lbrack I \right\rbrack\)
Similarly do the other case
\(\left\lbrack I \right\rbrack\left\lbrack A \right\rbrack = \left\lbrack A \right\rbrack\). Just do it!
Consider there are only two computer companies in a country. The companies are named Dude and Imac. Each year, company Dude keeps 1/5th of its customers, while the rest switch to Imac. Each year, Imac keeps 1/3rd of its customers, while the rest switch to Dude. If in 2002, Dude has \(1/6^th\) of the market and Imac has \(5/6^th\) of the market.
- What is the distribution of the customers between the two companies in 2003? Write the answer first as multiplication of two matrices.
- What would be distribution when the market becomes stable?
- Answer
-
A. At the end of 2002, Dude has \(\frac{1}{5} \times \frac{1}{6} + \frac{2}{3} \times \frac{5}{6} = 0.589\).
B. Stable distribution is [10/22 12/22] (Try to do this part of the problem first by finding the distribution five years from now).
Imac has \(\frac{4}{5} \times \frac{1}{6} + \frac{1}{3} \times \frac{5}{6} = 0.411\)
In matrix form \(\begin{bmatrix} \frac{1}{5} & \frac{2}{3} \\ \frac{4}{5} & \frac{1}{3} \\ \end{bmatrix}\begin{bmatrix} \frac{1}{6} \\ \frac{5}{6} \\ \end{bmatrix} = \begin{bmatrix} 0.589 \\ 0.411 \\ \end{bmatrix}\)
Given
\(\lbrack A\rbrack = \begin{bmatrix} 12.3 & - 12.3 & 10.3 \\ 11.3 & - 10.3 & - 11.3 \\ 10.3 & - 11.3 & - 12.3 \\ \end{bmatrix}\),
\(\lbrack B\rbrack = \begin{bmatrix} 2 & 4 \\ - 5 & 6 \\ 11 & - 20 \\ \end{bmatrix}\)
\([A][B]\) matrix size is _______________
- Answer
-
\(3 \times 2\)
Given
\(\lbrack A\rbrack = \begin{bmatrix} 12.3 & - 12.3 & 10.3 \\ 11.3 & - 10.3 & - 11.3 \\ 10.3 & - 11.3 & - 12.3 \\ \end{bmatrix}\),
\(\lbrack B\rbrack = \begin{bmatrix} 2 & 4 \\ - 5 & 6 \\ 11 & - 20 \\ \end{bmatrix}\)
if \(\left\lbrack C \right\rbrack = \left\lbrack A \right\rbrack\left\lbrack B \right\rbrack\), then \(c_{31}\)= _____________________
- Answer
-
\((10.3 \times 2) + (( - 5) \times ( - 11.3)) + (11 \times ( - 12.3)) = - 58.2\)