4.2: Addition, Subtraction, Scalar Multiplication, and Products of Row and Column Matrices
Addition and Subtraction of Matrices
Let \(A\) and \(B\ \) be \(m\times n\) matrices. Then the sum, \(A+B\) , is the new matrix formed by adding corresponding entries together. The difference, \(A-B\) , is the new matrix formed by subtracting each entry in matrix \(B\) from its corresponding entry in matrix \(A\) .
To add or subtract two or more matrices together, they all must be of the same size. That is, they all must have the same number of rows and the same numbers of columns. To add them together, add the corresponding elements together. To subtract one from the other, subtract corresponding elements from each other
If the addition and subtraction is defined (if it is possible), perform each operation.
\[A=\left[\begin{array}{cc}
2 & 5 \\
-1 & 4 \\
6 & 0
\end{array}\right], B=\left[\begin{array}{ll}
3 & 1 \\
0 & 4 \\
2 & 7
\end{array}\right], C=\left[\begin{array}{cc}
9 & -4 \\
2 & 6
\end{array}\right] \nonumber \]
Solution
\[A+B=\left[\begin{array}{cc}
2 & 5 \\
-1 & 4 \\
6 & 0
\end{array}\right]+\left[\begin{array}{ll}
3 & 1 \\
0 & 4 \\
2 & 7
\end{array}\right]=\left[\begin{array}{cc}
2+3 & 5+1 \\
-1+0 & 4+4 \\
6+2 & 0+7
\end{array}\right]=\left[\begin{array}{cc}
5 & 6 \\
-1 & 8 \\
8 & 7
\end{array}\right] \nonumber \]
\[A-B=\left[\begin{array}{cc}
2 & 5 \\
-1 & 4 \\
6 & 0
\end{array}\right]-\left[\begin{array}{ll}
3 & 1 \\
0 & 4 \\
2 & 7
\end{array}\right]=\left[\begin{array}{cc}
2-3 & 5-1 \\
-1-0 & 4-4 \\
6-2 & 0-7
\end{array}\right]=\left[\begin{array}{cc}
-1 & 4 \\
-1 & 0 \\
4 & -7
\end{array}\right] \nonumber \]
\(A+C\) is not defined as they are different sizes. Matrix \(A\) is a \(3\times 2\) matrix whereas matrix \(B\) is a \(2\times 2\) matrix.
Your Turn : Compute \(B\ -A.\)
Scalar Multiplication
You might recall that a scalar is a physical quantity that is defined by only its magnitude and that some examples are speed, time, distance, density, and temperature. They are represented by real numbers (both positive and negative), and they can be operated on using the regular laws of algebra.
To multiply a matrix by a scalar, multiply every element of the matrix by the scalar.
Symbolically, \(k\bullet \left[ \begin{array}{c} \begin{array}{cc} a_{11} & a_{12} \end{array} \ \ \ \cdots \ \ \ a_{1n} \\ \begin{array}{cc} a_{21} & a_{22}\ \ \ \cdots \ \ \ a_{2n} \end{array} \\ \begin{array}{cc} \vdots & \vdots \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \vdots \end{array} \\ \begin{array}{cc} a_{m1} & a_{m2} \end{array} \ \ \ \cdots \ \ \ a_{mn} \end{array} \right]=\ \left[ \begin{array}{c} \begin{array}{cc} {k\bullet a}_{11} & {k\bullet a}_{12} \end{array} \ \ \ \cdots \ \ \ {k\bullet a}_{1n} \\ \begin{array}{cc} {k\bullet a}_{21} & {k\bullet a}_{22}\ \ \ \cdots \ \ \ {k\bullet a}_{2n} \end{array} \\ \begin{array}{cc} \vdots & \vdots \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \vdots \end{array} \\ \begin{array}{cc} {k\bullet a}_{m1} & k\bullet a_{m2} \end{array} \ \ \ \cdots \ \ \ {k\bullet a}_{mn} \end{array} \right]\)
Perform scalar multiplication.
Solution
\[6 \cdot\left[\begin{array}{ccc}
4 & 1 & -3 \\
0 & 3 & 5
\end{array}\right]=\left[\begin{array}{ccc}
6 \cdot 4 & 6 \cdot 1 & 6 \cdot(-3) \\
6 \cdot 0 & 6 \cdot 3 & 6 \cdot 5
\end{array}\right]=\left[\begin{array}{ccc}
24 & 6 & -18 \\
0 & 18 & 30
\end{array}\right] \nonumber \]
Your Turn : Multiply \(\mathrm{7\ }\mathrm{\bullet }\left[ \begin{array}{cc} \mathrm{4} & \mathrm{2} \\ --\mathrm{1} & \mathrm{3} \end{array} \right]\) .
Multiplication with Row and Column Matrices
Suppose we have two matrices, \(A\) and \(B,\) where \(\mathrm{\ }A\) is a \(\mathrm{1\times }n\) matrix and \(B\) is an \(n\mathrm{\times 1}\) matrix. That is, \(A\) has one row and \(n\) columns and \(B\) has \(n\) rows and only 1 column.
\[A=\left[\begin{array}{llll}
a_1 & a_2 & \cdots & a_n
\end{array}\right] \text { and } B=\left[\begin{array}{c}
b_1 \\
b_2 \\
\vdots \\
b_n
\end{array}\right] \nonumber \]
The product \(A\bullet B\) is the new matrix obtained by multiplying together the corresponding elements of each matrix then adding those sums together.
\[A \cdot B=\left[\begin{array}{llll}
a_1 & a_2 & \cdots & a_n
\end{array}\right] \cdot\left[\begin{array}{c}
b_1 \\
b_2 \\
\vdots \\
b_n
\end{array}\right] \nonumber \]
\[A\bullet B=\left[a_1\bullet b_1+a_2\bullet b_2+\cdots +a_n\bullet b_n\right] \nonumber \]
This product is the sum (addition) of the
first entry in \(A\) times the first entry in \(B\)
second entry in \(A\) times the second entry in \(B\)
\(\vdots \)
last entry in \(A\) times the last entry in \(B\)
Multiply the two matrices \(A=\left[ \begin{array}{ccc} 2 & 4 & 5 \end{array} \right]\ \) and \(B=\left[ \begin{array}{c} 1 \\ 4 \\ 3 \end{array} \right]\)
Solution
Suppose \(A=\left[ \begin{array}{ccc} 2 & 4 & 5 \end{array} \right]\ \) and \(B=\left[ \begin{array}{c} 1 \\ 4 \\ 3 \end{array} \right]\) . Then,
\[A \cdot B=\left[\begin{array}{lll}
2 & 4 & 5
\end{array}\right] \cdot\left[\begin{array}{l}
1 \\
4 \\
3
\end{array}\right] \nonumber \]
\[\begin{aligned}
& A \cdot B=[2 \cdot 1+4 \cdot 4+5 \cdot 3] \\
& A \cdot B=[2+16+15] \\
& A \cdot B=[33]
\end{aligned} \nonumber \]
Notice the dimensions of the two matrices. The number of rows of \(B,\) is 3 which is equal to the number of columns of \(A,\) which is also 3. The product is a \(1\times 1\) matrix whose dimension is the (number of rows of \(A)\ \times\) (number of columns of \(B\) ).
Your Turn : Suppose \(A\mathrm{=}\left[ \begin{array}{cc} \mathrm{3} & \mathrm{1} \end{array} \mathrm{\ } \begin{array}{cc} \mathrm{\ \ \ }-\mathrm{2} & \mathrm{5} \end{array} \right]\) and \(B\mathrm{=}\left[ \begin{array}{c} \begin{array}{c} \mathrm{1} \\ -\mathrm{6} \end{array} \\ 0 \\ \mathrm{4} \end{array} \right]\) . Show that \(A\mathrm{\bullet }B\mathrm{=[17].}\)
Motivation for the Process of Multiplication with Row and Column Matrices
This process of multiplication may not seem intuitive; however, we can motivate it with an example. You probably know, or at least believe, that the revenue \(R\ \) realized by selling \(n\) number of units of some product for \(p\) dollars per unit is given by \(R=np\) . Revenue equals (the number of units sold) times the (price of each unit).
Suppose your business sells three sizes of boxes, small-sized boxes, medium-sized boxes, and large-sized boxes. Small boxes sell for $3 each, medium boxes for $5 each, and large boxes for $7 each. What would your total revenue be if you sold 20 small-sized boxes, 30 medium-sized boxes, and 40 large-sized boxes?
Solution
Using \(R=n\mathrm{\bullet }p\) , your revenue from the sale of the
small boxes is \(R=20\bullet \$3=\$60\)
medium boxes is \(R=30\bullet \$5=\$150\)
large boxes is \(R=40\bullet \$7=\$280\)
The total revenue is the sum of these three products, \[20\bullet \$3+30\bullet \$5+ 40\bullet \$7=\$60+\$150+\$280=\$490. \nonumber \]
We can compute the total revenue using two matrices and matrix multiplication.
Let the first matrix be the row matrix of the number of boxes sold \(N\) ,
\[N=\left[ \begin{array}{ccc} 20 & 30 & 40 \end{array} \right] \nonumber \]
and the second matrix be the column matrix of the price per boxes sold \(P\) .
\[P=\left[ \begin{array}{c} \$3 \\ \$5 \\ \$7 \end{array} \right] \nonumber \]
The total revenue is the matrix product
\[R=N\mathrm{\bullet }P \nonumber \] \[R\mathrm{=}\left[ \begin{array}{ccc} \mathrm{20} & \mathrm{30} & \mathrm{40} \end{array} \right]\mathrm{\bullet }\left[ \begin{array}{c} \mathrm{\$3} \\ \mathrm{\$5} \\ \mathrm{\$7} \end{array} \right] \nonumber \]
\[\mathrm{=}\left[\mathrm{20}\mathrm{\bullet }\mathrm{\$3+30}\mathrm{\bullet }\mathrm{\$5+40}\mathrm{\bullet }\mathrm{\$7}\right] \nonumber \]
\[\mathrm{=}\left[\mathrm{\$490}\right] \nonumber \]
Important Observation – See this
Notice that the result of a row and column matrix multiplication is a matrix with exactly one entry. That entry is the sum of a collection of products. In Example 4, the result of the row and column matrix multiplication is a matrix with exactly one entry, $490. The $490 is the sum of the products \(\mathrm{20}\mathrm{\bullet }\mathrm{\$3,}\) \(\mathrm{30}\mathrm{\bullet }\mathrm{\$5}\) , and \(\mathrm{40}\mathrm{\bullet }\mathrm{\$7.}\) Don’t let the phrase the sum of a collection of products befuddle you. It means it is the addition (the sum) of a collection of multiplications (products). This idea will be helpful in the next section when we discuss multiplication of matrices of larger dimensions.
Dimension Matters
Notice the dimensions of the two matrices \(N\) and \(P\) from Example 4. The number of rows of \(P\) is 3, which is equal to the number columns of \(N,\) which is also 3. The product is a \(1\times 1\) matrix whose dimension is (the number of rows of \(N)\ \times\) (the number of columns of \(P\) ).
To multiply a row matrix \(A\) and column matrix \(B\) together, it must be that the (number of rows of \(B\)) = (number of columns of \(A\))
Symbolically, if \(A\) has \(n\) number of columns, \(B\) must have \(n\) number of rows
Suppose \(A=\left[ \begin{array}{ccc} 2 & 4 & 5 \end{array} \right]\ \) and \(B=\left[ \begin{array}{c} \begin{array}{c} 1 \\ 4 \\ 3 \end{array} \\ 2 \end{array} \right]\) .
Solution
This multiplication will not work, it is not defined. Matrix \(B\) has 4 rows, but \(A\) has only 3 columns.
\(A\bullet B\) = \(\left[ \begin{array}{ccc} 2 & 4 & 5 \end{array} \right]\) \(\bullet \left[ \begin{array}{c} \begin{array}{c} 1 \\ 4 \\ 3 \end{array} \\ 2 \end{array} \right]=\left[2\bullet 1+4\bullet 4+5\bullet 3+Now\ what?\right]\)
Try these
Using these six matrices, perform each operation if it is defined (if it is possible).
\[A=\left[\begin{array}{cc}
1 & 2 \\
-1 & 3 \\
0 & 4
\end{array}\right] \quad B=\left[\begin{array}{cc}
3 & 2 \\
1 & 0 \\
-1 & -2
\end{array}\right] \quad C=\left[\begin{array}{lll}
2 & 1 & 3 \\
4 & 2 & 1
\end{array}\right] \quad D=\left[\begin{array}{ll}
4 & 9
\end{array}\right] \quad E=\left[\begin{array}{l}
5 \\
2
\end{array}\right] \quad F=[-2] \nonumber \]
\(A+B\)
- Answer
-
\(\left[ \begin{array}{cc} 4 & 4 \\ 0 & 3 \\ -1 & 2 \end{array} \right]\)
\(B-A\)
- Answer
-
\(\left[ \begin{array}{cc} -2 & 0 \\ 2 & -3 \\ -1 & -6 \end{array} \right]\)
\(D+E\)
- Answer
-
Not possible
\(D \cdot E\)
- Answer
-
\(\left[38\right]\)
\(E \cdot D\)
- Answer
-
\(\left[38\right]\)
\(-3 \cdot\left[\begin{array}{cc}
-4 & 0 \\
2 & -1
\end{array}\right]\)
- Answer
-
\(\left[ \begin{array}{cc} 12 & 0 \\ -6 & 3 \end{array} \right]\)
\(A+C\)
- Answer
-
Not defined
\(3 \cdot(D \cdot E)\)
- Answer
-
\(\left[114\right]\)
\((D \cdot E) \cdot F\)
- Answer
-
\(\left[-76\right]\)
\(F^2\)
- Answer
-
\(\left[4\right]\)