A matrix is a rectangular table of numbers. Matrices are a compact way to store data, like the sales of several products in several shops, and they come with their own arithmetic. Matrix multiplication in particular turns out to be exactly what you need to combine tables of data, solve systems of equations, transform shapes, and model how populations move over time.
A matrix with m m m rows and n n n columns has order m × n m \times n m × n (say ”m m m by n n n ”). Rows go across, columns go down.
A = ( 3 − 1 4 0 2 5 ) A = \begin{pmatrix} 3 & -1 & 4 \\ 0 & 2 & 5 \end{pmatrix} A = ( 3 0 − 1 2 4 5 )
A A A has 2 2 2 rows and 3 3 3 columns, so its order is 2 × 3 2 \times 3 2 × 3 . Each number is an element (or entry). The element in row i i i , column j j j is written a i j a_{ij} a ij : here a 13 = 4 a_{13} = 4 a 13 = 4 and a 21 = 0 a_{21} = 0 a 21 = 0 . Always give the row first , then the column.
Matrices are usually named with capital letters. A matrix with one column, like ( 2 7 ) \begin{pmatrix} 2 \\ 7 \end{pmatrix} ( 2 7 ) , is a column matrix ; a matrix with the same number of rows and columns is a square matrix .
Two matrices are equal if they have the same order and every pair of corresponding elements is equal. So a matrix equation gives one ordinary equation for each position.
Add or subtract matrices of the same order by adding or subtracting corresponding elements. Matrices of different orders can’t be added.
Multiply by a scalar (a number) k k k by multiplying every element by k k k .
( 1 4 − 2 0 ) + ( 3 − 1 5 2 ) = ( 4 3 3 2 ) , 3 ( 1 4 − 2 0 ) = ( 3 12 − 6 0 ) \begin{pmatrix} 1 & 4 \\ -2 & 0 \end{pmatrix} + \begin{pmatrix} 3 & -1 \\ 5 & 2 \end{pmatrix} = \begin{pmatrix} 4 & 3 \\ 3 & 2 \end{pmatrix}, \qquad 3\begin{pmatrix} 1 & 4 \\ -2 & 0 \end{pmatrix} = \begin{pmatrix} 3 & 12 \\ -6 & 0 \end{pmatrix} ( 1 − 2 4 0 ) + ( 3 5 − 1 2 ) = ( 4 3 3 2 ) , 3 ( 1 − 2 4 0 ) = ( 3 − 6 12 0 )
To find the element in row i i i , column j j j of A B AB A B , take row i i i of A A A and column j j j of B B B , multiply corresponding entries, and add:
( 1 2 3 4 ) ( 5 6 7 8 ) = ( 1 ( 5 ) + 2 ( 7 ) 1 ( 6 ) + 2 ( 8 ) 3 ( 5 ) + 4 ( 7 ) 3 ( 6 ) + 4 ( 8 ) ) = ( 19 22 43 50 ) \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} = \begin{pmatrix} 1(5) + 2(7) & 1(6) + 2(8) \\ 3(5) + 4(7) & 3(6) + 4(8) \end{pmatrix} = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix} ( 1 3 2 4 ) ( 5 7 6 8 ) = ( 1 ( 5 ) + 2 ( 7 ) 3 ( 5 ) + 4 ( 7 ) 1 ( 6 ) + 2 ( 8 ) 3 ( 6 ) + 4 ( 8 ) ) = ( 19 43 22 50 )
For this to work, each row of A A A must be as long as each column of B B B . The product A B AB A B exists only when
( m × n ‾ ) × ( n ‾ × p ) → m × p (m \times \underline{n}) \times (\underline{n} \times p) \;\to\; m \times p ( m × n ) × ( n × p ) → m × p
The inner numbers must match (the matrices are conformable ); the outer numbers give the order of the answer. A 2 × 3 2 \times 3 2 × 3 matrix times a 3 × 4 3 \times 4 3 × 4 matrix gives a 2 × 4 2 \times 4 2 × 4 matrix, but a 2 × 3 2 \times 3 2 × 3 times a 2 × 3 2 \times 3 2 × 3 isn’t defined.
Your GDC’s matrix editor does all of this: enter the matrices (with their orders), then calculate with them on the home screen. You should still be able to multiply small matrices by hand.
For matrices of suitable orders:
Property Statement Associative ( A B ) C = A ( B C ) (AB)C = A(BC) ( A B ) C = A ( B C ) Distributive A ( B + C ) = A B + A C A(B + C) = AB + AC A ( B + C ) = A B + A C and ( A + B ) C = A C + B C (A + B)C = AC + BC ( A + B ) C = A C + B C Not commutativein general, A B ≠ B A AB \ne BA A B = B A
Because order matters, “multiply A A A by B B B on the left” (B A BA B A ) and “on the right” (A B AB A B ) are different. A B AB A B might even exist when B A BA B A doesn’t. Write A 2 A^2 A 2 for A A AA AA ; it only makes sense for square matrices.
The identity matrix I I I is square, with 1 1 1 s on the leading diagonal (top left to bottom right) and 0 0 0 s elsewhere. It acts like the number 1 1 1 : A I = I A = A AI = IA = A A I = I A = A .
The zero matrix 0 0 0 has every element 0 0 0 . It acts like the number 0 0 0 : A + 0 = A A + 0 = A A + 0 = A and A 0 = 0 A0 = 0 A 0 = 0 .
I = ( 1 0 0 1 ) , I = ( 1 0 0 0 1 0 0 0 1 ) , 0 = ( 0 0 0 0 ) I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \qquad I = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \qquad 0 = \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} I = ( 1 0 0 1 ) , I = 1 0 0 0 1 0 0 0 1 , 0 = ( 0 0 0 0 )
(a) For A = ( 3 − 1 4 0 2 5 ) A = \begin{pmatrix} 3 & -1 & 4 \\ 0 & 2 & 5 \end{pmatrix} A = ( 3 0 − 1 2 4 5 ) , write down the order of A A A , and the values of a 12 a_{12} a 12 and a 23 a_{23} a 23 .
(b) Find x x x and y y y if ( x + 1 4 3 2 y ) = ( 5 4 3 − 6 ) \begin{pmatrix} x + 1 & 4 \\ 3 & 2y \end{pmatrix} = \begin{pmatrix} 5 & 4 \\ 3 & -6 \end{pmatrix} ( x + 1 3 4 2 y ) = ( 5 3 4 − 6 ) .
Solution.
(a) 2 2 2 rows and 3 3 3 columns: order 2 × 3 2 \times 3 2 × 3 . Row 1 1 1 , column 2 2 2 : a 12 = − 1 a_{12} = -1 a 12 = − 1 . Row 2 2 2 , column 3 3 3 : a 23 = 5 a_{23} = 5 a 23 = 5 .
(b) Corresponding elements are equal: x + 1 = 5 x + 1 = 5 x + 1 = 5 , so x = 4 x = 4 x = 4 ; and 2 y = − 6 2y = -6 2 y = − 6 , so y = − 3 y = -3 y = − 3 .
Let A = ( 2 − 1 4 3 ) A = \begin{pmatrix} 2 & -1 \\ 4 & 3 \end{pmatrix} A = ( 2 4 − 1 3 ) and B = ( 1 5 − 2 0 ) B = \begin{pmatrix} 1 & 5 \\ -2 & 0 \end{pmatrix} B = ( 1 − 2 5 0 ) . Find 2 A − 3 B 2A - 3B 2 A − 3 B .
Solution. Multiply first, then subtract element by element:
2 A − 3 B = ( 4 − 2 8 6 ) − ( 3 15 − 6 0 ) = ( 1 − 17 14 6 ) 2A - 3B = \begin{pmatrix} 4 & -2 \\ 8 & 6 \end{pmatrix} - \begin{pmatrix} 3 & 15 \\ -6 & 0 \end{pmatrix} = \begin{pmatrix} 1 & -17 \\ 14 & 6 \end{pmatrix} 2 A − 3 B = ( 4 8 − 2 6 ) − ( 3 − 6 15 0 ) = ( 1 14 − 17 6 )
Watch the signs: 8 − ( − 6 ) = 14 8 - (-6) = 14 8 − ( − 6 ) = 14 .
Let C = ( 1 2 0 − 1 3 4 ) C = \begin{pmatrix} 1 & 2 & 0 \\ -1 & 3 & 4 \end{pmatrix} C = ( 1 − 1 2 3 0 4 ) and D = ( 2 1 0 − 3 5 2 ) D = \begin{pmatrix} 2 & 1 \\ 0 & -3 \\ 5 & 2 \end{pmatrix} D = 2 0 5 1 − 3 2 . Find C D CD C D and D C DC D C , if they exist.
Solution. C C C is 2 × 3 2 \times 3 2 × 3 and D D D is 3 × 2 3 \times 2 3 × 2 .
C D CD C D : ( 2 × 3 ) ( 3 × 2 ) (2 \times 3)(3 \times 2) ( 2 × 3 ) ( 3 × 2 ) , inner numbers match, so C D CD C D is 2 × 2 2 \times 2 2 × 2 .
C D = ( 1 ( 2 ) + 2 ( 0 ) + 0 ( 5 ) 1 ( 1 ) + 2 ( − 3 ) + 0 ( 2 ) − 1 ( 2 ) + 3 ( 0 ) + 4 ( 5 ) − 1 ( 1 ) + 3 ( − 3 ) + 4 ( 2 ) ) = ( 2 − 5 18 − 2 ) CD = \begin{pmatrix} 1(2) + 2(0) + 0(5) & 1(1) + 2(-3) + 0(2) \\ -1(2) + 3(0) + 4(5) & -1(1) + 3(-3) + 4(2) \end{pmatrix} = \begin{pmatrix} 2 & -5 \\ 18 & -2 \end{pmatrix} C D = ( 1 ( 2 ) + 2 ( 0 ) + 0 ( 5 ) − 1 ( 2 ) + 3 ( 0 ) + 4 ( 5 ) 1 ( 1 ) + 2 ( − 3 ) + 0 ( 2 ) − 1 ( 1 ) + 3 ( − 3 ) + 4 ( 2 ) ) = ( 2 18 − 5 − 2 )
D C DC D C : ( 3 × 2 ) ( 2 × 3 ) (3 \times 2)(2 \times 3) ( 3 × 2 ) ( 2 × 3 ) , inner numbers match, so D C DC D C is 3 × 3 3 \times 3 3 × 3 . Using a GDC (or nine row-times-column sums):
D C = ( 1 7 4 3 − 9 − 12 3 16 8 ) DC = \begin{pmatrix} 1 & 7 & 4 \\ 3 & -9 & -12 \\ 3 & 16 & 8 \end{pmatrix} D C = 1 3 3 7 − 9 16 4 − 12 8
C D CD C D and D C DC D C don’t even have the same order, a clear example of C D ≠ D C CD \ne DC C D = D C .
A bakery has two shops. One Saturday they sold:
Sandwiches Salads Drinks Shop A 30 30 30 12 12 12 20 20 20 Shop B 25 25 25 18 18 18 10 10 10
A sandwich costs $4.50, a salad $6.00 and a drink $3.25. Use matrix multiplication to find each shop’s revenue and the total.
Solution. Put the sales in a 2 × 3 2 \times 3 2 × 3 matrix S S S and the prices in a 3 × 1 3 \times 1 3 × 1 column P P P , in the same item order:
S P = ( 30 12 20 25 18 10 ) ( 4.50 6.00 3.25 ) = ( 30 ( 4.50 ) + 12 ( 6.00 ) + 20 ( 3.25 ) 25 ( 4.50 ) + 18 ( 6.00 ) + 10 ( 3.25 ) ) = ( 272 253 ) SP = \begin{pmatrix} 30 & 12 & 20 \\ 25 & 18 & 10 \end{pmatrix}\begin{pmatrix} 4.50 \\ 6.00 \\ 3.25 \end{pmatrix} = \begin{pmatrix} 30(4.50) + 12(6.00) + 20(3.25) \\ 25(4.50) + 18(6.00) + 10(3.25) \end{pmatrix} = \begin{pmatrix} 272 \\ 253 \end{pmatrix} S P = ( 30 25 12 18 20 10 ) 4.50 6.00 3.25 = ( 30 ( 4.50 ) + 12 ( 6.00 ) + 20 ( 3.25 ) 25 ( 4.50 ) + 18 ( 6.00 ) + 10 ( 3.25 ) ) = ( 272 253 )
Shop A took in $272 and Shop B $253. To total them, multiply on the left by a row of 1 1 1 s:
( 1 1 ) ( 272 253 ) = ( 525 ) \begin{pmatrix} 1 & 1 \end{pmatrix}\begin{pmatrix} 272 \\ 253 \end{pmatrix} = (525) ( 1 1 ) ( 272 253 ) = ( 525 )
The total revenue was $525. The columns of S S S (items) matched the rows of P P P (items), which is why the product makes sense.
Giving the order as columns by rows. Order is always rows × \times × columns. A matrix with 2 2 2 rows and 3 3 3 columns is 2 × 3 2 \times 3 2 × 3 , and a 23 a_{23} a 23 is in row 2 2 2 , column 3 3 3 .
Multiplying element by element. A B AB A B is not found by multiplying matching positions. Each entry is a row of A A A times a column of B B B , added up.
Assuming AB = BA. Matrix multiplication isn’t commutative. Keep the order exactly as written, and in expansions write ( A + B ) 2 = A 2 + A B + B A + B 2 (A + B)^2 = A^2 + AB + BA + B^2 ( A + B ) 2 = A 2 + A B + B A + B 2 , not A 2 + 2 A B + B 2 A^2 + 2AB + B^2 A 2 + 2 A B + B 2 .
Trying to multiply matrices that aren’t conformable. Check the orders first: the number of columns of the first must equal the number of rows of the second.
Adding matrices of different orders. A 2 × 2 2 \times 2 2 × 2 and a 2 × 3 2 \times 3 2 × 3 matrix can’t be added. Your GDC will give a dimension error, and so should you.
Lining up a data product the wrong way. In Example 4, P S PS P S isn’t defined (3 × 1 3 \times 1 3 × 1 times 2 × 3 2 \times 3 2 × 3 ). The items must be the columns of the first matrix and the rows of the second.
1. (Warm-up) For M = ( 7 0 − 3 2 1 9 ) M = \begin{pmatrix} 7 & 0 \\ -3 & 2 \\ 1 & 9 \end{pmatrix} M = 7 − 3 1 0 2 9 , write down the order of M M M and the values of m 21 m_{21} m 21 and m 32 m_{32} m 32 .
Solution 3 3 3 rows and 2 2 2 columns: order 3 × 2 3 \times 2 3 × 2 . Row 2 2 2 , column 1 1 1 : m 21 = − 3 m_{21} = -3 m 21 = − 3 . Row 3 3 3 , column 2 2 2 : m 32 = 9 m_{32} = 9 m 32 = 9 .
2. (Warm-up) Find a a a , b b b and c c c if ( 2 a b − 3 4 c 2 ) = ( 10 − 1 4 16 ) \begin{pmatrix} 2a & b - 3 \\ 4 & c^2 \end{pmatrix} = \begin{pmatrix} 10 & -1 \\ 4 & 16 \end{pmatrix} ( 2 a 4 b − 3 c 2 ) = ( 10 4 − 1 16 ) and c > 0 c \gt 0 c > 0 .
Solution 2 a = 10 2a = 10 2 a = 10 , so a = 5 a = 5 a = 5 . b − 3 = − 1 b - 3 = -1 b − 3 = − 1 , so b = 2 b = 2 b = 2 . c 2 = 16 c^2 = 16 c 2 = 16 with c > 0 c \gt 0 c > 0 , so c = 4 c = 4 c = 4 .
3. (Warm-up) Let P = ( 3 0 − 2 5 ) P = \begin{pmatrix} 3 & 0 \\ -2 & 5 \end{pmatrix} P = ( 3 − 2 0 5 ) and Q = ( − 1 4 6 2 ) Q = \begin{pmatrix} -1 & 4 \\ 6 & 2 \end{pmatrix} Q = ( − 1 6 4 2 ) . Find:
(a) P + Q P + Q P + Q
(b) 3 P − 2 Q 3P - 2Q 3 P − 2 Q
Solution (a)
P + Q = ( 3 + ( − 1 ) 0 + 4 − 2 + 6 5 + 2 ) = ( 2 4 4 7 ) P + Q = \begin{pmatrix} 3 + (-1) & 0 + 4 \\ -2 + 6 & 5 + 2 \end{pmatrix} = \begin{pmatrix} 2 & 4 \\ 4 & 7 \end{pmatrix} P + Q = ( 3 + ( − 1 ) − 2 + 6 0 + 4 5 + 2 ) = ( 2 4 4 7 ) (b)
3 P − 2 Q = ( 9 0 − 6 15 ) − ( − 2 8 12 4 ) = ( 11 − 8 − 18 11 ) 3P - 2Q = \begin{pmatrix} 9 & 0 \\ -6 & 15 \end{pmatrix} - \begin{pmatrix} -2 & 8 \\ 12 & 4 \end{pmatrix} = \begin{pmatrix} 11 & -8 \\ -18 & 11 \end{pmatrix} 3 P − 2 Q = ( 9 − 6 0 15 ) − ( − 2 12 8 4 ) = ( 11 − 18 − 8 11 )
4. (Core) Let P = ( 3 − 2 1 4 ) P = \begin{pmatrix} 3 & -2 \\ 1 & 4 \end{pmatrix} P = ( 3 1 − 2 4 ) and Q = ( 0 5 − 1 2 ) Q = \begin{pmatrix} 0 & 5 \\ -1 & 2 \end{pmatrix} Q = ( 0 − 1 5 2 ) . Find P Q PQ P Q and Q P QP QP by hand.
Solution P Q = ( 3 ( 0 ) + ( − 2 ) ( − 1 ) 3 ( 5 ) + ( − 2 ) ( 2 ) 1 ( 0 ) + 4 ( − 1 ) 1 ( 5 ) + 4 ( 2 ) ) = ( 2 11 − 4 13 ) PQ = \begin{pmatrix} 3(0) + (-2)(-1) & 3(5) + (-2)(2) \\ 1(0) + 4(-1) & 1(5) + 4(2) \end{pmatrix} = \begin{pmatrix} 2 & 11 \\ -4 & 13 \end{pmatrix} P Q = ( 3 ( 0 ) + ( − 2 ) ( − 1 ) 1 ( 0 ) + 4 ( − 1 ) 3 ( 5 ) + ( − 2 ) ( 2 ) 1 ( 5 ) + 4 ( 2 ) ) = ( 2 − 4 11 13 ) Q P = ( 0 ( 3 ) + 5 ( 1 ) 0 ( − 2 ) + 5 ( 4 ) − 1 ( 3 ) + 2 ( 1 ) − 1 ( − 2 ) + 2 ( 4 ) ) = ( 5 20 − 1 10 ) QP = \begin{pmatrix} 0(3) + 5(1) & 0(-2) + 5(4) \\ -1(3) + 2(1) & -1(-2) + 2(4) \end{pmatrix} = \begin{pmatrix} 5 & 20 \\ -1 & 10 \end{pmatrix} QP = ( 0 ( 3 ) + 5 ( 1 ) − 1 ( 3 ) + 2 ( 1 ) 0 ( − 2 ) + 5 ( 4 ) − 1 ( − 2 ) + 2 ( 4 ) ) = ( 5 − 1 20 10 ) P Q ≠ Q P PQ \ne QP P Q = QP .
5. (Core) A A A is 2 × 3 2 \times 3 2 × 3 , B B B is 3 × 3 3 \times 3 3 × 3 and C C C is 3 × 1 3 \times 1 3 × 1 . For each product, say whether it exists, and if it does, give its order.
(a) A B AB A B
(b) B A BA B A
(c) B C BC B C
(d) A B C ABC A B C
(e) C A CA C A
Solution (a) ( 2 × 3 ) ( 3 × 3 ) (2 \times 3)(3 \times 3) ( 2 × 3 ) ( 3 × 3 ) : exists, order 2 × 3 2 \times 3 2 × 3 .
(b) ( 3 × 3 ) ( 2 × 3 ) (3 \times 3)(2 \times 3) ( 3 × 3 ) ( 2 × 3 ) : 3 ≠ 2 3 \ne 2 3 = 2 , so it doesn’t exist.
(c) ( 3 × 3 ) ( 3 × 1 ) (3 \times 3)(3 \times 1) ( 3 × 3 ) ( 3 × 1 ) : exists, order 3 × 1 3 \times 1 3 × 1 .
(d) A B AB A B is 2 × 3 2 \times 3 2 × 3 , then ( 2 × 3 ) ( 3 × 1 ) (2 \times 3)(3 \times 1) ( 2 × 3 ) ( 3 × 1 ) : exists, order 2 × 1 2 \times 1 2 × 1 .
(e) ( 3 × 1 ) ( 2 × 3 ) (3 \times 1)(2 \times 3) ( 3 × 1 ) ( 2 × 3 ) : 1 ≠ 2 1 \ne 2 1 = 2 , so it doesn’t exist.
6. (Core) Let A = ( 1 2 0 − 1 ) A = \begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix} A = ( 1 0 2 − 1 ) and B = ( 3 1 1 0 ) B = \begin{pmatrix} 3 & 1 \\ 1 & 0 \end{pmatrix} B = ( 3 1 1 0 ) .
(a) Show that A B ≠ B A AB \ne BA A B = B A .
(b) Find A 2 A^2 A 2 . What do you notice?
Solution (a)
A B = ( 3 + 2 1 + 0 0 − 1 0 + 0 ) = ( 5 1 − 1 0 ) , B A = ( 3 + 0 6 − 1 1 + 0 2 + 0 ) = ( 3 5 1 2 ) AB = \begin{pmatrix} 3 + 2 & 1 + 0 \\ 0 - 1 & 0 + 0 \end{pmatrix} = \begin{pmatrix} 5 & 1 \\ -1 & 0 \end{pmatrix}, \qquad BA = \begin{pmatrix} 3 + 0 & 6 - 1 \\ 1 + 0 & 2 + 0 \end{pmatrix} = \begin{pmatrix} 3 & 5 \\ 1 & 2 \end{pmatrix} A B = ( 3 + 2 0 − 1 1 + 0 0 + 0 ) = ( 5 − 1 1 0 ) , B A = ( 3 + 0 1 + 0 6 − 1 2 + 0 ) = ( 3 1 5 2 ) These are different, so A B ≠ B A AB \ne BA A B = B A .
(b)
A 2 = ( 1 2 0 − 1 ) ( 1 2 0 − 1 ) = ( 1 + 0 2 − 2 0 + 0 0 + 1 ) = ( 1 0 0 1 ) = I A^2 = \begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix} = \begin{pmatrix} 1 + 0 & 2 - 2 \\ 0 + 0 & 0 + 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = I A 2 = ( 1 0 2 − 1 ) ( 1 0 2 − 1 ) = ( 1 + 0 0 + 0 2 − 2 0 + 1 ) = ( 1 0 0 1 ) = I Multiplying by A A A twice gets you back where you started.
7. (Core) A café makes pancake batter and cake batter. One batch of each needs:
Flour (kg) Milk (L) Butter (kg) Pancake batter 2 2 2 3 3 3 1 1 1 Cake batter 1 1 1 4 4 4 2 2 2
Flour costs $2.40 per kg, milk $1.80 per litre and butter $6.50 per kg. Use matrix multiplication to find the cost of one batch of each.
Solution ( 2 3 1 1 4 2 ) ( 2.40 1.80 6.50 ) = ( 4.80 + 5.40 + 6.50 2.40 + 7.20 + 13.00 ) = ( 16.70 22.60 ) \begin{pmatrix} 2 & 3 & 1 \\ 1 & 4 & 2 \end{pmatrix}\begin{pmatrix} 2.40 \\ 1.80 \\ 6.50 \end{pmatrix} = \begin{pmatrix} 4.80 + 5.40 + 6.50 \\ 2.40 + 7.20 + 13.00 \end{pmatrix} = \begin{pmatrix} 16.70 \\ 22.60 \end{pmatrix} ( 2 1 3 4 1 2 ) 2.40 1.80 6.50 = ( 4.80 + 5.40 + 6.50 2.40 + 7.20 + 13.00 ) = ( 16.70 22.60 ) A batch of pancake batter costs $16.70 and a batch of cake batter costs $22.60.
8. (Challenge) Let A = ( 2 1 0 3 ) A = \begin{pmatrix} 2 & 1 \\ 0 & 3 \end{pmatrix} A = ( 2 0 1 3 ) and B = ( a 1 0 b ) B = \begin{pmatrix} a & 1 \\ 0 & b \end{pmatrix} B = ( a 0 1 b ) . Find the relationship between a a a and b b b for which A B = B A AB = BA A B = B A .
Solution A B = ( 2 a + 0 2 ( 1 ) + 1 ( b ) 0 + 0 0 + 3 b ) = ( 2 a 2 + b 0 3 b ) AB = \begin{pmatrix} 2a + 0 & 2(1) + 1(b) \\ 0 + 0 & 0 + 3b \end{pmatrix} = \begin{pmatrix} 2a & 2 + b \\ 0 & 3b \end{pmatrix} A B = ( 2 a + 0 0 + 0 2 ( 1 ) + 1 ( b ) 0 + 3 b ) = ( 2 a 0 2 + b 3 b ) B A = ( 2 a + 0 a ( 1 ) + 1 ( 3 ) 0 + 0 0 + 3 b ) = ( 2 a a + 3 0 3 b ) BA = \begin{pmatrix} 2a + 0 & a(1) + 1(3) \\ 0 + 0 & 0 + 3b \end{pmatrix} = \begin{pmatrix} 2a & a + 3 \\ 0 & 3b \end{pmatrix} B A = ( 2 a + 0 0 + 0 a ( 1 ) + 1 ( 3 ) 0 + 3 b ) = ( 2 a 0 a + 3 3 b ) The other entries already match, so A B = B A AB = BA A B = B A exactly when 2 + b = a + 3 2 + b = a + 3 2 + b = a + 3 , that is, a = b − 1 a = b - 1 a = b − 1 .
9. (Challenge) Let X = ( 1 1 0 1 ) X = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} X = ( 1 0 1 1 ) and Y = ( 0 0 1 0 ) Y = \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} Y = ( 0 1 0 0 ) .
(a) Find ( X + Y ) 2 (X + Y)^2 ( X + Y ) 2 and X 2 + 2 X Y + Y 2 X^2 + 2XY + Y^2 X 2 + 2 X Y + Y 2 .
(b) Explain why they are different.
Solution (a) X + Y = ( 1 1 1 1 ) X + Y = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} X + Y = ( 1 1 1 1 ) , so
( X + Y ) 2 = ( 1 1 1 1 ) ( 1 1 1 1 ) = ( 2 2 2 2 ) (X + Y)^2 = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} = \begin{pmatrix} 2 & 2 \\ 2 & 2 \end{pmatrix} ( X + Y ) 2 = ( 1 1 1 1 ) ( 1 1 1 1 ) = ( 2 2 2 2 ) X 2 = ( 1 2 0 1 ) X^2 = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} X 2 = ( 1 0 2 1 ) , X Y = ( 1 0 1 0 ) XY = \begin{pmatrix} 1 & 0 \\ 1 & 0 \end{pmatrix} X Y = ( 1 1 0 0 ) and Y 2 = ( 0 0 0 0 ) Y^2 = \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} Y 2 = ( 0 0 0 0 ) , so
X 2 + 2 X Y + Y 2 = ( 1 2 0 1 ) + ( 2 0 2 0 ) + ( 0 0 0 0 ) = ( 3 2 2 1 ) X^2 + 2XY + Y^2 = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} + \begin{pmatrix} 2 & 0 \\ 2 & 0 \end{pmatrix} + \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} = \begin{pmatrix} 3 & 2 \\ 2 & 1 \end{pmatrix} X 2 + 2 X Y + Y 2 = ( 1 0 2 1 ) + ( 2 2 0 0 ) + ( 0 0 0 0 ) = ( 3 2 2 1 ) (b) Expanding with the distributive law gives ( X + Y ) 2 = X 2 + X Y + Y X + Y 2 (X + Y)^2 = X^2 + XY + YX + Y^2 ( X + Y ) 2 = X 2 + X Y + Y X + Y 2 . Writing X Y + Y X XY + YX X Y + Y X as 2 X Y 2XY 2 X Y assumes X Y = Y X XY = YX X Y = Y X , but here Y X = ( 0 0 1 1 ) ≠ X Y YX = \begin{pmatrix} 0 & 0 \\ 1 & 1 \end{pmatrix} \ne XY Y X = ( 0 1 0 1 ) = X Y . Check: X 2 + X Y + Y X + Y 2 = ( 2 2 2 2 ) X^2 + XY + YX + Y^2 = \begin{pmatrix} 2 & 2 \\ 2 & 2 \end{pmatrix} X 2 + X Y + Y X + Y 2 = ( 2 2 2 2 ) ✓.