Products of Matrices
Learning Outcomes
- Multiply a matrix by a scalar, sum scalar multiples of matrices.
- Multiply two matrices together.
- Use a calculator to perform operations on matrices.
Lab A | Lab B | |
---|---|---|
Computers | 15 | 27 |
Computer Tables | 16 | 34 |
Chairs | 16 | 34 |
[latex]{C}_{2013}=\left[\begin{array}{c}15\\ 16\\ 16\end{array}\begin{array}{c}27\\ 34\\ 34\end{array}\right][/latex]
To calculate how much computer equipment will be needed in 2014, we multiply all entries in matrix [latex]C[/latex] by 0.15.[latex]\left(0.15\right){C}_{2013}=\left[\begin{array}{c}\left(0.15\right)15\\ \left(0.15\right)16\\ \left(0.15\right)16\end{array}\begin{array}{c}\left(0.15\right)27\\ \left(0.15\right)34\\ \left(0.15\right)34\end{array}\right]=\left[\begin{array}{c}2.25\\ 2.4\\ 2.4\end{array}\begin{array}{c}4.05\\ 5.1\\ 5.1\end{array}\right][/latex]
We must round up to the next integer, so the amount of new equipment needed is[latex]\left[\begin{array}{c}3\\ 3\\ 3\end{array}\begin{array}{c}5\\ 6\\ 6\end{array}\right][/latex]
Adding the two matrices as shown below, we see the new inventory amounts.[latex]\left[\begin{array}{c}15\\ 16\\ 16\end{array}\begin{array}{c}27\\ 34\\ 34\end{array}\right]+\left[\begin{array}{c}3\\ 3\\ 3\end{array}\begin{array}{c}5\\ 6\\ 6\end{array}\right]=\left[\begin{array}{c}18\\ 19\\ 19\end{array}\begin{array}{c}32\\ 40\\ 40\end{array}\right][/latex]
This means[latex]{C}_{2014}=\left[\begin{array}{c}18\\ 19\\ 19\end{array}\begin{array}{c}32\\ 40\\ 40\end{array}\right][/latex]
Thus, Lab A will have 18 computers, 19 computer tables, and 19 chairs; Lab B will have 32 computers, 40 computer tables, and 40 chairs.A General Note: Scalar Multiplication
Scalar multiplication involves finding the product of a constant by each entry in the matrix. Given[latex]A=\left[\begin{array}{cccc}{a}_{11}& & & {a}_{12}\\ {a}_{21}& & & {a}_{22}\end{array}\right][/latex]
the scalar multiple [latex]cA[/latex] is[latex]\begin{array}{ll}cA & =c\left[\begin{array}{ccc}{a}_{11}& & {a}_{12}\\ {a}_{21}& & {a}_{22}\end{array}\right]\hfill \\ & =\left[\begin{array}{ccc}c{a}_{11}& & c{a}_{12}\\ c{a}_{21}& & c{a}_{22}\end{array}\right]\hfill \end{array}[/latex]
Scalar multiplication is distributive. For the matrices [latex]A,B[/latex], and [latex]C[/latex] with scalars [latex]a[/latex] and [latex]b[/latex],[latex]\begin{array}{l}\\ \begin{array}{c}a\left(A+B\right)=aA+aB\\ \left(a+b\right)A=aA+bA\end{array}\end{array}[/latex]
Example: Multiplying the Matrix by a Scalar
Multiply matrix [latex]A[/latex] by the scalar 3.[latex]A=\left[\begin{array}{cc}8& 1\\ 5& 4\end{array}\right][/latex]
Answer: Multiply each entry in [latex]A[/latex] by the scalar 3.
[latex]\begin{array}{ll}3A & =3\left[\begin{array}{rr}\hfill 8& \hfill 1\\ \hfill 5& \hfill 4\end{array}\right]\hfill \\ & = \left[\begin{array}{rr}\hfill 3\cdot 8& \hfill 3\cdot 1\\ \hfill 3\cdot 5& \hfill 3\cdot 4\end{array}\right]\hfill \\ & = \left[\begin{array}{rr}\hfill 24& \hfill 3\\ \hfill 15& \hfill 12\end{array}\right]\hfill \end{array}[/latex]
Try It
Given matrix [latex]B,\text{}[/latex] find [latex]-2B[/latex] where[latex]B=\left[\begin{array}{cc}4& 1\\ 3& 2\end{array}\right][/latex]
Answer: [latex]-2B=\left[\begin{array}{cc}-8& -2\\ -6& -4\end{array}\right][/latex]
Example: Finding the Sum of Scalar Multiples
Find the sum [latex]3A+2B[/latex].[latex]A=\left[\begin{array}{rrr}\hfill 1& \hfill -2& \hfill 0\\ \hfill 0& \hfill -1& \hfill 2\\ \hfill 4& \hfill 3& \hfill -6\end{array}\right]\text{ and }B=\left[\begin{array}{rrr}\hfill -1& \hfill 2& \hfill 1\\ \hfill 0& \hfill -3& \hfill 2\\ \hfill 0& \hfill 1& \hfill -4\end{array}\right][/latex]
Answer: First, find [latex]3A,\text{}[/latex] then [latex]2B[/latex].
[latex]\begin{array}{l}\hfill \\ \hfill \\ 3A & =\left[\begin{array}{lll}3\cdot 1\hfill & 3\left(-2\right)\hfill & 3\cdot 0\hfill \\ 3\cdot 0\hfill & 3\left(-1\right)\hfill & 3\cdot 2\hfill \\ 3\cdot 4\hfill & 3\cdot 3\hfill & 3\left(-6\right)\hfill \end{array}\right]\hfill \\ & =\left[\begin{array}{rrr}\hfill 3& \hfill -6& \hfill 0\\ \hfill 0& \hfill -3& \hfill 6\\ \hfill 12& \hfill 9& \hfill -18\end{array}\right]\hfill \end{array}[/latex] [latex]\begin{array}{l}\hfill \\ \hfill \\ 2B & =\left[\begin{array}{lll}2\left(-1\right)\hfill & 2\cdot 2\hfill & 2\cdot 1\hfill \\ 2\cdot 0\hfill & 2\left(-3\right)\hfill & 2\cdot 2\hfill \\ 2\cdot 0\hfill & 2\cdot 1\hfill & 2\left(-4\right)\hfill \end{array}\right]\hfill \\ & =\left[\begin{array}{rrr}\hfill -2& \hfill 4& \hfill 2\\ \hfill 0& \hfill -6& \hfill 4\\ \hfill 0& \hfill 2& \hfill -8\end{array}\right]\hfill \end{array}[/latex]
Now, add [latex]3A+2B[/latex].[latex]\begin{array}{l}\hfill \\ \hfill \\ 3A+2B & =\left[\begin{array}{rrr}\hfill 3& \hfill -6& \hfill 0\\ \hfill 0& \hfill -3& \hfill 6\\ \hfill 12& \hfill 9& \hfill -18\end{array}\right]+\left[\begin{array}{rrr}\hfill -2& \hfill 4& \hfill 2\\ \hfill 0& \hfill -6& \hfill 4\\ \hfill 0& \hfill 2& \hfill -8\end{array}\right]\hfill \\ & =\left[\begin{array}{rrr}\hfill 3 - 2& \hfill -6+4& \hfill 0+2\\ \hfill 0+0& \hfill -3 - 6& \hfill 6+4\\ \hfill 12+0& \hfill 9+2& \hfill -18 - 8\end{array}\right]\hfill \\ & =\left[\begin{array}{rrr}\hfill 1& \hfill -2& \hfill 2\\ \hfill 0& \hfill -9& \hfill 10\\ \hfill 12& \hfill 11& \hfill -26\end{array}\right]\hfill \end{array}[/latex]
Try it
[ohm_question]6386[/ohm_question]Finding the Product of Two Matrices
In addition to multiplying a matrix by a scalar, we can multiply two matrices. Finding the product of two matrices is only possible when the inner dimensions are the same, meaning that the number of columns of the first matrix is equal to the number of rows of the second matrix. If [latex]A[/latex] is an [latex]\text{ }m\text{ }\times \text{ }r\text{ }[/latex] matrix and [latex]B[/latex] is an [latex]\text{ }r\text{ }\times \text{ }n\text{ }[/latex] matrix, then the product matrix [latex]AB[/latex] is an [latex]\text{ }m\text{ }\times \text{ }n\text{ }[/latex] matrix. For example, the product [latex]AB[/latex] is possible because the number of columns in [latex]A[/latex] is the same as the number of rows in [latex]B[/latex]. If the inner dimensions do not match, the product is not defined. We multiply entries of [latex]A[/latex] with entries of [latex]B[/latex] according to a specific pattern as outlined below. The process of matrix multiplication becomes clearer when working a problem with real numbers.tip for success
Work through the example model of matrix multiplication below on paper, then apply the process to the example problem below. It may take more than once to gain familiarity with it. Don't be discouraged if you don't understand fully right away. Matrix multiplication is a new skill and it will take time and practice for it to feel comfortable.[latex]A=\left[\begin{array}{rrr}\hfill {a}_{11}& \hfill {a}_{12}& \hfill {a}_{13}\\ \hfill {a}_{21}& \hfill {a}_{22}& \hfill {a}_{23}\end{array}\right]\text{ and }B=\left[\begin{array}{rrr}\hfill {b}_{11}& \hfill {b}_{12}& \hfill {b}_{13}\\ \hfill {b}_{21}& \hfill {b}_{22}& \hfill {b}_{23}\\ \hfill {b}_{31}& \hfill {b}_{32}& \hfill {b}_{33}\end{array}\right][/latex]
Multiply and add as follows to obtain the first entry of the product matrix [latex]AB[/latex].- To obtain the entry in row 1, column 1 of [latex]AB,\text{}[/latex] multiply the first row in [latex]A[/latex] by the first column in [latex]B[/latex] and add.
[latex]\left[\begin{array}{ccc}{a}_{11}& {a}_{12}& {a}_{13}\end{array}\right]\cdot \left[\begin{array}{c}{b}_{11}\\ {b}_{21}\\ {b}_{31}\end{array}\right]={a}_{11}\cdot {b}_{11}+{a}_{12}\cdot {b}_{21}+{a}_{13}\cdot {b}_{31}[/latex]
- To obtain the entry in row 1, column 2 of [latex]AB,\text{}[/latex] multiply the first row of [latex]A[/latex] by the second column in [latex]B[/latex] and add.
[latex]\left[\begin{array}{ccc}{a}_{11}& {a}_{12}& {a}_{13}\end{array}\right]\cdot \left[\begin{array}{c}{b}_{12}\\ {b}_{22}\\ {b}_{32}\end{array}\right]={a}_{11}\cdot {b}_{12}+{a}_{12}\cdot {b}_{22}+{a}_{13}\cdot {b}_{32}[/latex]
- To obtain the entry in row 1, column 3 of [latex]AB,\text{}[/latex] multiply the first row of [latex]A[/latex] by the third column in [latex]B[/latex] and add.
[latex]\left[\begin{array}{ccc}{a}_{11}& {a}_{12}& {a}_{13}\end{array}\right]\cdot \left[\begin{array}{c}{b}_{13}\\ {b}_{23}\\ {b}_{33}\end{array}\right]={a}_{11}\cdot {b}_{13}+{a}_{12}\cdot {b}_{23}+{a}_{13}\cdot {b}_{33}[/latex]
[latex]AB=\left[\begin{array}{c}\begin{array}{l}{a}_{11}\cdot {b}_{11}+{a}_{12}\cdot {b}_{21}+{a}_{13}\cdot {b}_{31}\\ \end{array}\\ {a}_{21}\cdot {b}_{11}+{a}_{22}\cdot {b}_{21}+{a}_{23}\cdot {b}_{31}\end{array}\begin{array}{c}\begin{array}{l}{a}_{11}\cdot {b}_{12}+{a}_{12}\cdot {b}_{22}+{a}_{13}\cdot {b}_{32}\\ \end{array}\\ {a}_{21}\cdot {b}_{12}+{a}_{22}\cdot {b}_{22}+{a}_{23}\cdot {b}_{32}\end{array}\begin{array}{c}\begin{array}{l}{a}_{11}\cdot {b}_{13}+{a}_{12}\cdot {b}_{23}+{a}_{13}\cdot {b}_{33}\\ \end{array}\\ {a}_{21}\cdot {b}_{13}+{a}_{22}\cdot {b}_{23}+{a}_{23}\cdot {b}_{33}\end{array}\right][/latex]
A General Note: Properties of Matrix Multiplication
For the matrices [latex]A,B,\text{}[/latex] and [latex]C[/latex] the following properties hold.- Matrix multiplication is associative:
[latex]\left(AB\right)C=A\left(BC\right)[/latex]
- Matrix multiplication is distributive:
[latex]\begin{array}{l}\begin{array}{l}\\ C\left(A+B\right)=CA+CB,\end{array}\hfill \\ \left(A+B\right)C=AC+BC.\hfill \end{array}[/latex]
Example: Multiplying Two Matrices
Multiply matrix [latex]A[/latex] and matrix [latex]B[/latex].[latex]A=\left[\begin{array}{cc}1& 2\\ 3& 4\end{array}\right]\text{ and }B=\left[\begin{array}{cc}5& 6\\ 7& 8\end{array}\right][/latex]
Answer: First, we check the dimensions of the matrices. Matrix [latex]A[/latex] has dimensions [latex]2\times 2[/latex] and matrix [latex]B[/latex] has dimensions [latex]2\times 2[/latex]. The inner dimensions are the same so we can perform the multiplication. The product will have the dimensions [latex]2\times 2[/latex]. We perform the operations outlined previously.
Try It
[ohm_question]1075[/ohm_question]Example: Multiplying Two Matrices
Given [latex]A[/latex] and [latex]B:[/latex]- Find [latex]AB[/latex].
- Find [latex]BA[/latex].
[latex]A=\left[\begin{array}{ccc}\hfill -1& \hfill 2& \hfill 3\\ \hfill 4& \hfill 0& \hfill 5\end{array}\right]\text{ and }B=\left[\begin{array}{cc}\hfill 5& \hfill -1\\ \hfill -4& \hfill 0\\ \hfill 2& \hfill 3\end{array}\right][/latex]
Answer:
- As the dimensions of [latex]A[/latex] are [latex]2\text{}\times \text{}3[/latex] and the dimensions of [latex]B[/latex] are [latex]3\text{}\times \text{}2,\text{}[/latex] these matrices can be multiplied together because the number of columns in [latex]A[/latex] matches the number of rows in [latex]B[/latex]. The resulting product will be a [latex]2\text{}\times \text{}2[/latex] matrix, the number of rows in [latex]A[/latex] by the number of columns in [latex]B[/latex].
[latex]\begin{array}{l}\hfill \\ AB & =\left[\begin{array}{rrr}\hfill -1& \hfill 2& \hfill 3\\ \hfill 4& \hfill 0& \hfill 5\end{array}\right]\text{ }\left[\begin{array}{rr}\hfill 5& \hfill -1\\ \hfill -4& \hfill 0\\ \hfill 2& \hfill 3\end{array}\right]\hfill \\ & =\left[\begin{array}{rr}\hfill -1\left(5\right)+2\left(-4\right)+3\left(2\right)& \hfill -1\left(-1\right)+2\left(0\right)+3\left(3\right)\\ \hfill 4\left(5\right)+0\left(-4\right)+5\left(2\right)& \hfill 4\left(-1\right)+0\left(0\right)+5\left(3\right)\end{array}\right]\hfill \\ & =\left[\begin{array}{rr}\hfill -7& \hfill 10\\ \hfill 30& \hfill 11\end{array}\right]\hfill \end{array}[/latex]
- The dimensions of [latex]B[/latex] are [latex]3\times 2[/latex] and the dimensions of [latex]A[/latex] are [latex]2\times 3[/latex]. The inner dimensions match so the product is defined and will be a [latex]3\times 3[/latex] matrix.
[latex]\begin{array}{l}\hfill \\ BA & =\left[\begin{array}{rr}\hfill 5& \hfill -1\\ \hfill -4& \hfill 0\\ \hfill 2& \hfill 3\end{array}\right]\text{ }\left[\begin{array}{rrr}\hfill -1& \hfill 2& \hfill 3\\ \hfill 4& \hfill 0& \hfill 5\end{array}\right]\hfill \\ & =\left[\begin{array}{rrr}\hfill 5\left(-1\right)+-1\left(4\right)& \hfill 5\left(2\right)+-1\left(0\right)& \hfill 5\left(3\right)+-1\left(5\right)\\ \hfill -4\left(-1\right)+0\left(4\right)& \hfill -4\left(2\right)+0\left(0\right)& \hfill -4\left(3\right)+0\left(5\right)\\ \hfill 2\left(-1\right)+3\left(4\right)& \hfill 2\left(2\right)+3\left(0\right)& \hfill 2\left(3\right)+3\left(5\right)\end{array}\right]\hfill \\ & =\left[\begin{array}{rrr}\hfill -9& \hfill 10& \hfill 10\\ \hfill 4& \hfill -8& \hfill -12\\ \hfill 10& \hfill 4& \hfill 21\end{array}\right]\hfill \end{array}[/latex]
Analysis of the Solution
Notice that the products [latex]AB[/latex] and [latex]BA[/latex] are not equal.[latex]AB=\left[\begin{array}{cc}-7& 10\\ 30& 11\end{array}\right]\ne \left[\begin{array}{ccc}-9& 10& 10\\ 4& -8& -12\\ 10& 4& 21\end{array}\right]=BA[/latex]
This illustrates the fact that matrix multiplication is not commutative.Q & A
Is it possible for AB to be defined but not BA? Yes, consider a matrix A with dimension [latex]3\times 4[/latex] and matrix B with dimension [latex]4\times 2[/latex]. For the product AB the inner dimensions are 4 and the product is defined, but for the product BA the inner dimensions are 2 and 3 so the product is undefined.Example: Using Matrices in Real-World Problems
Let’s return to the problem presented at the opening of this section. We have the table below, representing the equipment needs of two soccer teams.Wildcats | Mud Cats | |
---|---|---|
Goals | 6 | 10 |
Balls | 30 | 24 |
Jerseys | 14 | 20 |
Goal | $300 |
Ball | $10 |
Jersey | $30 |
[latex]E=\left[\begin{array}{c}6\\ 30\\ 14\end{array}\begin{array}{c}10\\ 24\\ 20\end{array}\right][/latex]
The cost matrix is written as[latex]C=\left[\begin{array}{ccc}300& 10& 30\end{array}\right][/latex] We perform matrix multiplication to obtain costs for the equipment. [latex]\begin{array}{l}\hfill \\ \hfill \\ CE & =\left[\begin{array}{rrr}\hfill 300& \hfill 10& \hfill 30\end{array}\right]\cdot \left[\begin{array}{rr}\hfill 6& \hfill 10\\ \hfill 30& \hfill 24\\ \hfill 14& \hfill 20\end{array}\right]\hfill \\ & =\left[\begin{array}{rr}\hfill 300\left(6\right)+10\left(30\right)+30\left(14\right)& \hfill 300\left(10\right)+10\left(24\right)+30\left(20\right)\end{array}\right]\hfill \\ & =\left[\begin{array}{rr}\hfill 2,520& \hfill 3,840\end{array}\right]\hfill \end{array}[/latex]
The total cost for equipment for the Wildcats is $2,520, and the total cost for equipment for the Mud Cats is $3,840.How To: Given a matrix operation, evaluate using a calculator
- Save each matrix as a matrix variable
[latex]\left[A\right],\left[B\right],\left[C\right],..[/latex]
- Enter the operation into the calculator, calling up each matrix variable as needed.
- If the operation is defined, the calculator will present the solution matrix; if the operation is undefined, it will display an error message.
Example: Using a Calculator to Perform Matrix Operations
Find [latex]AB-C[/latex] given[latex]A=\left[\begin{array}{rrr}\hfill -15& \hfill 25& \hfill 32\\ \hfill 41& \hfill -7& \hfill -28\\ \hfill 10& \hfill 34& \hfill -2\end{array}\right],B=\left[\begin{array}{rrr}\hfill 45& \hfill 21& \hfill -37\\ \hfill -24& \hfill 52& \hfill 19\\ \hfill 6& \hfill -48& \hfill -31\end{array}\right],\text{and }C=\left[\begin{array}{rrr}\hfill -100& \hfill -89& \hfill -98\\ \hfill 25& \hfill -56& \hfill 74\\ \hfill -67& \hfill 42& \hfill -75\end{array}\right][/latex].
Answer: On the matrix page of the calculator, we enter matrix [latex]A[/latex] above as the matrix variable [latex]\left[A\right][/latex], matrix [latex]B[/latex] above as the matrix variable [latex]\left[B\right][/latex], and matrix [latex]C[/latex] above as the matrix variable [latex]\left[C\right][/latex]. On the home screen of the calculator, we type in the problem and call up each matrix variable as needed.
[latex]\left[A\right]\times \left[B\right]-\left[C\right][/latex] The calculator gives us the following matrix. [latex]\left[\begin{array}{rrr}\hfill -983& \hfill -462& \hfill 136\\ \hfill 1,820& \hfill 1,897& \hfill -856\\ \hfill -311& \hfill 2,032& \hfill 413\end{array}\right][/latex]
Licenses & Attributions
CC licensed content, Original
- Revision and Adaptation. Provided by: Lumen Learning License: CC BY: Attribution.
CC licensed content, Shared previously
- College Algebra. Provided by: OpenStax Authored by: Abramson, Jay et al.. License: CC BY: Attribution. License terms: Download for free at http://cnx.org/contents/[email protected].
- Question ID 6386. Authored by: Dow,David D., mb Sousa,James. License: CC BY: Attribution. License terms: IMathAS Community License CC-BY + GPL.
CC licensed content, Specific attribution
- Precalculus. Provided by: OpenStax Authored by: OpenStax College. Located at: https://cnx.org/contents/[email protected]:1/Preface. License: CC BY: Attribution.