Linear AlgebraMatrix Algebra2 of 9
Matrix Algebra · 2

Matrix Multiplication

We already know how to multiply a matrix AA by a single column vector xx, and now we want to multiply AA by a whole second matrix BB.

1

Way 1: Mixing Columns

To find the product ABAB of two matrices, we start from how AA multiplies a single column xx: the numbers in xx act as weights that tell us how much of each column of AA to mix together.

[2134][13]=1[23]+3[14]=[23]+[312]=[515]\displaystyle \begin{aligned} \begin{bmatrix} \kone{2} & \ktwo{1} \\ \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} \\ \ktwo{3} \end{bmatrix} &= \kone{1}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \ktwo{3}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} \\ &= \begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \begin{bmatrix} \ktwo{3} \\ \ktwo{12} \end{bmatrix} \\ &= \begin{bmatrix} \result{5} \\ \result{15} \end{bmatrix} \end{aligned}

When we replace the single column xx with a matrix BB, we do that exact same column mix once for each column of BB.

Way 1: Mixing Columns
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
3\htmlClass{lc-green}{3}
4\htmlClass{lc-pink}{4}
1\htmlClass{lc-green}{1}
3\htmlClass{lc-pink}{3}
AA
xx
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
3\htmlClass{lc-green}{3}
4\htmlClass{lc-pink}{4}
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-pink}{3}
1\htmlClass{lc-pink}{1}
==
??
??
AA
BB
ABAB
Text solution
Mix the columns of AA using Column 1 of BBUse the weights 1\kone{1} and 3\ktwo{3} from the first column of BB to build the first column of ABAB.
1[23]+3[14]=[23]+[312]=[515]\displaystyle \kone{1}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \ktwo{3}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} = \begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \begin{bmatrix} \ktwo{3} \\ \ktwo{12} \end{bmatrix} = \begin{bmatrix} \result{5} \\ \result{15} \end{bmatrix}
Mix the columns of AA using Column 2 of BBUse the weights 2\kone{2} and 1\ktwo{1} from the second column of BB to build the second column of ABAB.
2[23]+1[14]=[46]+[14]=[510]\displaystyle \kone{2}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} = \begin{bmatrix} \kone{4} \\ \kone{6} \end{bmatrix} + \begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} = \begin{bmatrix} \result{5} \\ \result{10} \end{bmatrix}
Put the resulting columns side by sidePlace the two output columns together in order to form ABAB.
[2134][1231]=[551510]\displaystyle \begin{bmatrix} \kone{2} & \ktwo{1} \\ \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} \\ \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \result{5} & \result{5} \\ \result{15} & \result{10} \end{bmatrix}

Reading the columns of the right-hand matrix as weights lets us do simple products in our head: in [2134][1002]\begin{bmatrix} \kone{2} & \ktwo{1} \\ \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{0} \\ \ktwo{0} & \ktwo{2} \end{bmatrix}, the first column [10]\begin{bmatrix} \kone{1} \\ \ktwo{0} \end{bmatrix} copies Column 1 of AA and the second column [02]\begin{bmatrix} \kone{0} \\ \ktwo{2} \end{bmatrix} doubles Column 2 of AA.

[2134][1002]=[1[23]+0[14]0[23]+2[14]]=[2238]\displaystyle \begin{aligned} & \begin{bmatrix} \kone{2} & \ktwo{1} \\ \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{0} \\ \ktwo{0} & \ktwo{2} \end{bmatrix} \\ &= \begin{bmatrix} \kone{1}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \ktwo{0}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} & \kone{0}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \ktwo{2}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} \end{bmatrix} \\ &= \begin{bmatrix} \result{2} & \result{2} \\ \result{3} & \result{8} \end{bmatrix} \end{aligned}

Changing one column of BB changes only the matching column of ABAB, while the other column of ABAB stays the same.

Each column of B works on its own, combining the fixed columns of A to build only its matching column of AB.
2

Way 2: Row by Column

When we only want a single entry of ABAB, such as the number in Row 7, Column 12 of a huge product, we don't need to build the whole column. We can find that one number directly from Row 7 of AA and Column 12 of BB.

Row 2 of A\text{Row 2 of } A
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
3\htmlClass{lc-green}{3}
4\htmlClass{lc-pink}{4}
Column 1 of B\text{Column 1 of } B
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-pink}{3}
1\htmlClass{lc-pink}{1}
==
5\htmlClass{lc-mute}{5}
5\htmlClass{lc-mute}{5}
15\htmlClass{lc-blue}{15}
10\htmlClass{lc-mute}{10}
Way 2: Row by Column
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
3\htmlClass{lc-green}{3}
4\htmlClass{lc-pink}{4}
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-pink}{3}
1\htmlClass{lc-pink}{1}
==
??
AA
BB
ABAB
Text solution
Dot Row 1 of AA with each column of BB for the top rowMultiply the numbers in Row 1 of AA by the matching numbers in each column of BB and add them up.
Row 1, Column 1:[21][13]=(2×1)+(1×3)=2+3=5\displaystyle \text{Row 1, Column 1:} \quad \begin{bmatrix} \kone{2} & \ktwo{1} \end{bmatrix}\begin{bmatrix} \kone{1} \\ \ktwo{3} \end{bmatrix} = (\kone{2 \times 1}) + (\ktwo{1 \times 3}) = \kone{2} + \ktwo{3} = \result{5}
Row 1, Column 2:[21][21]=(2×2)+(1×1)=4+1=5\displaystyle \text{Row 1, Column 2:} \quad \begin{bmatrix} \kone{2} & \ktwo{1} \end{bmatrix}\begin{bmatrix} \kone{2} \\ \ktwo{1} \end{bmatrix} = (\kone{2 \times 2}) + (\ktwo{1 \times 1}) = \kone{4} + \ktwo{1} = \result{5}
Dot Row 2 of AA with each column of BB for the bottom rowMultiply the numbers in Row 2 of AA by the matching numbers in each column of BB and add them up.
Row 2, Column 1:[34][13]=(3×1)+(4×3)=3+12=15\displaystyle \text{Row 2, Column 1:} \quad \begin{bmatrix} \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} \\ \ktwo{3} \end{bmatrix} = (\kone{3 \times 1}) + (\ktwo{4 \times 3}) = \kone{3} + \ktwo{12} = \result{15}
Row 2, Column 2:[34][21]=(3×2)+(4×1)=6+4=10\displaystyle \text{Row 2, Column 2:} \quad \begin{bmatrix} \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{2} \\ \ktwo{1} \end{bmatrix} = (\kone{3 \times 2}) + (\ktwo{4 \times 1}) = \kone{6} + \ktwo{4} = \result{10}
Put each dot product in its matching row and columnPlace the four single numbers into their positions in ABAB.
[2134][1231]=[551510]\displaystyle \begin{bmatrix} \kone{2} & \ktwo{1} \\ \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} \\ \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \result{5} & \result{5} \\ \result{15} & \result{10} \end{bmatrix}
3

Way 3: Mixing Rows

Now suppose we want to build ABAB one entire row at a time, or apply a row operation like subtracting 3\kone{3} times Row 1 from Row 2 across a whole matrix BB. Instead of using the columns on the right as weights, we read the rows on the left as weights for mixing the rows of BB.

Way 3: Mixing Rows
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
3\htmlClass{lc-green}{3}
4\htmlClass{lc-pink}{4}
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-pink}{3}
1\htmlClass{lc-pink}{1}
==
??
AA
BB
ABAB
Text solution
Mix the rows of BB using Row 1 of AAUse the weights 2\kone{2} and 1\ktwo{1} from the top row of AA to build the top row of ABAB.
2[12]+1[31]=[24]+[31]=[55]\displaystyle \kone{2}\begin{bmatrix} \kone{1} & \kone{2} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \kone{2} & \kone{4} \end{bmatrix} + \begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \result{5} & \result{5} \end{bmatrix}
Mix the rows of BB using Row 2 of AAUse the weights 3\kone{3} and 4\ktwo{4} from the bottom row of AA to build the bottom row of ABAB.
3[12]+4[31]=[36]+[124]=[1510]\displaystyle \kone{3}\begin{bmatrix} \kone{1} & \kone{2} \end{bmatrix} + \ktwo{4}\begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \kone{3} & \kone{6} \end{bmatrix} + \begin{bmatrix} \ktwo{12} & \ktwo{4} \end{bmatrix} = \begin{bmatrix} \result{15} & \result{10} \end{bmatrix}
Stack the mixed rowsPut the resulting top and bottom rows together to form ABAB.
[2134][1231]=[551510]\displaystyle \begin{bmatrix} \kone{2} & \ktwo{1} \\ \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} \\ \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \result{5} & \result{5} \\ \result{15} & \result{10} \end{bmatrix}

When we multiply BB on the left by [10−31]\begin{bmatrix} \kone{1} & \ktwo{0} \\ \kone{-3} & \ktwo{1} \end{bmatrix}, the top row [10]\begin{bmatrix} \kone{1} & \ktwo{0} \end{bmatrix} keeps Row 1 of BB unchanged, and the bottom row [−31]\begin{bmatrix} \kone{-3} & \ktwo{1} \end{bmatrix} subtracts 3\kone{3} times Row 1 from Row 2:

[10−31][1231]=[1[12]+0[31]−3[12]+1[31]]=[120−5]\displaystyle \begin{aligned} & \begin{bmatrix} \kone{1} & \ktwo{0} \\ \kone{-3} & \ktwo{1} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} \\ \ktwo{3} & \ktwo{1} \end{bmatrix} \\ &= \begin{bmatrix} \kone{1}\begin{bmatrix} \kone{1} & \kone{2} \end{bmatrix} + \ktwo{0}\begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} \\ \kone{-3}\begin{bmatrix} \kone{1} & \kone{2} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} \end{bmatrix} \\ &= \begin{bmatrix} \result{1} & \result{2} \\ \result{0} & \result{-5} \end{bmatrix} \end{aligned}
4

Way 4: Column by Row Layers

Instead of building ABAB one column, one number, or one row at a time, we can see what each column of AA contributes to the whole product at once by multiplying it by its matching row of BB.

Way 4: Column by Row Layers
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
3\htmlClass{lc-green}{3}
4\htmlClass{lc-pink}{4}
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-pink}{3}
1\htmlClass{lc-pink}{1}
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-green}{3}
AA
BB
Text solution
Multiply Column 1 of AA by Row 1 of BB to form Layer 1Multiply Column 1 of AA by the weights 1\kone{1} and 2\kone{2} in Row 1 of BB to get the two columns of the first layer.
[23][12]=[1[23]2[23]]=[2436]\displaystyle \begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} \end{bmatrix} = \begin{bmatrix} \kone{1}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} & \kone{2}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} \end{bmatrix} = \begin{bmatrix} \kone{2} & \kone{4} \\ \kone{3} & \kone{6} \end{bmatrix}
Multiply Column 2 of AA by Row 2 of BB to form Layer 2Multiply Column 2 of AA by the weights 3\ktwo{3} and 1\ktwo{1} in Row 2 of BB to get the two columns of the second layer.
[14][31]=[3[14]1[14]]=[31124]\displaystyle \begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix}\begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \ktwo{3}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} & \ktwo{1}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} \end{bmatrix} = \begin{bmatrix} \ktwo{3} & \ktwo{1} \\ \ktwo{12} & \ktwo{4} \end{bmatrix}
Add the two layers togetherAdd the matching entries of Layer 1 and Layer 2 to get ABAB.
[2436]+[31124]=[551510]\displaystyle \begin{bmatrix} \kone{2} & \kone{4} \\ \kone{3} & \kone{6} \end{bmatrix} + \begin{bmatrix} \ktwo{3} & \ktwo{1} \\ \ktwo{12} & \ktwo{4} \end{bmatrix} = \begin{bmatrix} \result{5} & \result{5} \\ \result{15} & \result{10} \end{bmatrix}

In each layer, all the columns are multiples of one column of AA and all the rows are multiples of one row of BB, and adding the layers gives the same product ABAB.

Each column-and-row pair makes a full-size layer, and adding those layers in any order gives the same product as going column by column.
5

Matrix Sizes and When You Can Multiply

When AA and BB are not square, we need to check whether we can multiply them and find the size of ABAB before doing any arithmetic.

Matrix Sizes and When You Can Multiply
1\htmlClass{lc-green}{1}
0\htmlClass{lc-pink}{0}
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
0\htmlClass{lc-green}{0}
3\htmlClass{lc-pink}{3}
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
0\htmlClass{lc-green}{0}
1\htmlClass{lc-green}{1}
0\htmlClass{lc-pink}{0}
1\htmlClass{lc-pink}{1}
2\htmlClass{lc-pink}{2}
1\htmlClass{lc-pink}{1}
=?= {?}
AA
3×23 \times 2
BB
2×42 \times 4

Writing the sizes of AA and BB side by side shows whether the columns and weights match up and what size the product will be:

(m⏟rows of A×n⏟columns of A)×(n⏟rows of B×p⏟columns of B)⟶(m×p⏟size of AB)\displaystyle (\underbrace{\result{m}}_{\text{rows of } A} \times \underbrace{n}_{\text{columns of } A}) \times (\underbrace{n}_{\text{rows of } B} \times \underbrace{\result{p}}_{\text{columns of } B}) \longrightarrow (\underbrace{\result{m \times p}}_{\text{size of } AB})
Text solution
Check that the inner numbers match and read the output sizeAA has 22 columns and BB has 22 rows, so the inner numbers match and the outer numbers give a 3×4\result{3 \times 4} product.
(3×2)×(2×4)⟶3×4\displaystyle (\result{3} \times 2) \times (2 \times \result{4}) \longrightarrow \result{3 \times 4}
Mix the 22 columns of AA using each of the 44 columns of BBEach column of BB gives 22 weights to mix the 22 columns of AA (each with 33 entries).
Column 1:1[120]+0[013]=[120],Column 2:2[120]+1[013]=[240]+[013]=[253]\displaystyle \begin{aligned} & \text{Column 1:} \\ & \begin{aligned} \kone{1}\begin{bmatrix} \kone{1} \\ \kone{2} \\ \kone{0} \end{bmatrix} + \ktwo{0}\begin{bmatrix} \ktwo{0} \\ \ktwo{1} \\ \ktwo{3} \end{bmatrix} &= \begin{bmatrix} \result{1} \\ \result{2} \\ \result{0} \end{bmatrix}, \end{aligned} \\[6pt] & \text{Column 2:} \\ & \begin{aligned} \kone{2}\begin{bmatrix} \kone{1} \\ \kone{2} \\ \kone{0} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{0} \\ \ktwo{1} \\ \ktwo{3} \end{bmatrix} &= \begin{bmatrix} \kone{2} \\ \kone{4} \\ \kone{0} \end{bmatrix} + \begin{bmatrix} \ktwo{0} \\ \ktwo{1} \\ \ktwo{3} \end{bmatrix} \\ &= \begin{bmatrix} \result{2} \\ \result{5} \\ \result{3} \end{bmatrix} \end{aligned} \end{aligned}
Column 3:0[120]+2[013]=[026],Column 4:1[120]+1[013]=[120]+[013]=[133]\displaystyle \begin{aligned} & \text{Column 3:} \\ & \begin{aligned} \kone{0}\begin{bmatrix} \kone{1} \\ \kone{2} \\ \kone{0} \end{bmatrix} + \ktwo{2}\begin{bmatrix} \ktwo{0} \\ \ktwo{1} \\ \ktwo{3} \end{bmatrix} &= \begin{bmatrix} \result{0} \\ \result{2} \\ \result{6} \end{bmatrix}, \end{aligned} \\[6pt] & \text{Column 4:} \\ & \begin{aligned} \kone{1}\begin{bmatrix} \kone{1} \\ \kone{2} \\ \kone{0} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{0} \\ \ktwo{1} \\ \ktwo{3} \end{bmatrix} &= \begin{bmatrix} \kone{1} \\ \kone{2} \\ \kone{0} \end{bmatrix} + \begin{bmatrix} \ktwo{0} \\ \ktwo{1} \\ \ktwo{3} \end{bmatrix} \\ &= \begin{bmatrix} \result{1} \\ \result{3} \\ \result{3} \end{bmatrix} \end{aligned} \end{aligned}
Put the 44 columns into the 3×4\result{3 \times 4} productPlace the four resulting columns side by side.
[102103][12010121]=[120125230363]\displaystyle \begin{bmatrix} \kone{1} & \ktwo{0} \\ \kone{2} & \ktwo{1} \\ \kone{0} & \ktwo{3} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} & \kone{0} & \kone{1} \\ \ktwo{0} & \ktwo{1} & \ktwo{2} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \result{1} & \result{2} & \result{0} & \result{1} \\ \result{2} & \result{5} & \result{2} & \result{3} \\ \result{0} & \result{3} & \result{6} & \result{3} \end{bmatrix}

Each column of AA pairs with one weight in every column of BB, so ABAB is defined only when the number of columns of AA matches the number of rows of BB. The product ABAB gets its number of rows from AA and its number of columns from BB.

Because each column of B holds one weight for each column of A, their product works only when A has as many columns as B has rows, and it has as many rows as A and as many columns as B.
6

Why Order Matters: Usually AB≠BAAB \neq BA

With ordinary numbers, 3×53 \times 5 is the same as 5×35 \times 3. Now let's see what happens when we reverse the order of two matrices from ABAB to BABA.

Why Order Matters: Usually AB ≠ BA
ABAB
==
2\htmlClass{lc-green}{2}
1\htmlClass{lc-pink}{1}
3\htmlClass{lc-green}{3}
4\htmlClass{lc-pink}{4}
1\htmlClass{lc-green}{1}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-pink}{3}
1\htmlClass{lc-pink}{1}
==
5\htmlClass{lc-blue}{5}
5\htmlClass{lc-blue}{5}
15\htmlClass{lc-blue}{15}
10\htmlClass{lc-blue}{10}
BABA
==
1\htmlClass{lc-green}{1}
2\htmlClass{lc-pink}{2}
3\htmlClass{lc-green}{3}
1\htmlClass{lc-pink}{1}
2\htmlClass{lc-green}{2}
1\htmlClass{lc-green}{1}
3\htmlClass{lc-pink}{3}
4\htmlClass{lc-pink}{4}
==
??

For our 3×23 \times 2 matrix AA and 2×42 \times 4 matrix BB, reversing the order to BABA puts different inner numbers next to each other, so BABA isn't even defined:

(2×4⏟columns of B)×(3⏟rows of A×2)⟶4≠3 (undefined)\displaystyle (2 \times \underbrace{\nomatch{4}}_{\text{columns of } B}) \times (\underbrace{\nomatch{3}}_{\text{rows of } A} \times 2) \quad \longrightarrow \quad \nomatch{4} \neq \nomatch{3} \nomatch{\text{ (undefined)}}

Even when both matrices are 2×22 \times 2 so both products are defined, reversing ABAB to BABA swaps which matrix gives the columns and which gives the weights.

Text solution
Mix the columns of BB using Column 1 of AAWith BB now on the left, use the weights 2\kone{2} and 3\ktwo{3} from the first column of AA to mix the columns of BB.
2[13]+3[21]=[26]+[63]=[89]\displaystyle \kone{2}\begin{bmatrix} \kone{1} \\ \kone{3} \end{bmatrix} + \ktwo{3}\begin{bmatrix} \ktwo{2} \\ \ktwo{1} \end{bmatrix} = \begin{bmatrix} \kone{2} \\ \kone{6} \end{bmatrix} + \begin{bmatrix} \ktwo{6} \\ \ktwo{3} \end{bmatrix} = \begin{bmatrix} \result{8} \\ \result{9} \end{bmatrix}
Mix the columns of BB using Column 2 of AAUse the weights 1\kone{1} and 4\ktwo{4} from the second column of AA to mix the columns of BB.
1[13]+4[21]=[13]+[84]=[97]\displaystyle \kone{1}\begin{bmatrix} \kone{1} \\ \kone{3} \end{bmatrix} + \ktwo{4}\begin{bmatrix} \ktwo{2} \\ \ktwo{1} \end{bmatrix} = \begin{bmatrix} \kone{1} \\ \kone{3} \end{bmatrix} + \begin{bmatrix} \ktwo{8} \\ \ktwo{4} \end{bmatrix} = \begin{bmatrix} \result{9} \\ \result{7} \end{bmatrix}
Compare BABA with ABABPut the columns of BABA side by side to see that swapping the order changes the product.
BA=[1231][2134]=[8997]≠[551510]=AB\displaystyle \begin{aligned} BA &= \begin{bmatrix} \kone{1} & \ktwo{2} \\ \kone{3} & \ktwo{1} \end{bmatrix}\begin{bmatrix} \kone{2} & \kone{1} \\ \ktwo{3} & \ktwo{4} \end{bmatrix} \\ &= \begin{bmatrix} \result{8} & \result{9} \\ \result{9} & \result{7} \end{bmatrix} \\ &\neq \begin{bmatrix} \result{5} & \result{5} \\ \result{15} & \result{10} \end{bmatrix} = AB \end{aligned}
7

When Columns Cancel: AB=0AB = 0 and AB=ACAB = AC

With ordinary numbers, ab=0ab = 0 means a=0a = 0 or b=0b = 0, and 5x=5y5x = 5y lets us cancel the 55 to get x=yx = y. With matrices, let's see how AB=0AB = 0 can happen when neither AA nor BB has any zeros, and why AB=ACAB = AC does not let us automatically cancel AA to get B=CB = C.

When Columns Cancel: AB = 0 and AB = AC
1\htmlClass{lc-green}{1}
2\htmlClass{lc-pink}{2}
2\htmlClass{lc-green}{2}
4\htmlClass{lc-pink}{4}
==
0\htmlClass{lc-blue}{0}
0\htmlClass{lc-blue}{0}
0\htmlClass{lc-blue}{0}
0\htmlClass{lc-blue}{0}
AA
BB
ABAB
Text solution
Pick weights that cancel the columns of AA to zeroBecause Column 2 of A=[1224]A = \begin{bmatrix} \kone{1} & \ktwo{2} \\ \kone{2} & \ktwo{4} \end{bmatrix} is 22 times Column 1, taking 2\kone{2} of Column 1 and −1\ktwo{-1} of Column 2 (or −4\kone{-4} of Column 1 and 2\ktwo{2} of Column 2) cancels them out to [00]\begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix}.
2[12]−1[24]=[24]−[24]=[00],−4[12]+2[24]=[−4−8]+[48]=[00]\displaystyle \begin{aligned} \kone{2}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} - \ktwo{1}\begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} &= \begin{bmatrix} \kone{2} \\ \kone{4} \end{bmatrix} - \begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} \\ &= \begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix}, \\[6pt] \kone{-4}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} + \ktwo{2}\begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} &= \begin{bmatrix} \kone{-4} \\ \kone{-8} \end{bmatrix} + \begin{bmatrix} \ktwo{4} \\ \ktwo{8} \end{bmatrix} \\ &= \begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix} \end{aligned}
[1224][2−4−12]=[0000]\displaystyle \begin{bmatrix} \kone{1} & \ktwo{2} \\ \kone{2} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{2} & \kone{-4} \\ \ktwo{-1} & \ktwo{2} \end{bmatrix} = \begin{bmatrix} \result{0} & \result{0} \\ \result{0} & \result{0} \end{bmatrix}
Mix the columns of AA with two different weight matrices BB and CCTrading 2\kone{2} of Column 1 for 1\ktwo{1} of Column 2 keeps the mix the same, so B=[3410]B = \begin{bmatrix} \kone{3} & \kone{4} \\ \ktwo{1} & \ktwo{0} \end{bmatrix} and C=[1022]C = \begin{bmatrix} \kone{1} & \kone{0} \\ \ktwo{2} & \ktwo{2} \end{bmatrix} give the exact same product.
AB=[3[12]+1[24]4[12]+0[24]]=[54108]\displaystyle AB = \begin{bmatrix} \kone{3}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} & \kone{4}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} + \ktwo{0}\begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} \end{bmatrix} = \begin{bmatrix} \result{5} & \result{4} \\ \result{10} & \result{8} \end{bmatrix}
AC=[1[12]+2[24]0[12]+2[24]]=[54108]\displaystyle AC = \begin{bmatrix} \kone{1}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} + \ktwo{2}\begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} & \kone{0}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} + \ktwo{2}\begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} \end{bmatrix} = \begin{bmatrix} \result{5} & \result{4} \\ \result{10} & \result{8} \end{bmatrix}

When the two columns of AA lie on the same line, there is a whole line of nonzero weight pairs that cancel them to [00]\begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix}, and each parallel line of weight pairs gives different weights that all produce the exact same output column.

When both columns lie on the same line, a whole line of different weight pairs gives the exact same output, including nonzero weights that cancel the columns to zero.

Key concepts

Whenever you see a matrix product AB=CAB = C, start with the sizes (m×n)(n×p)⟶m×p(\result{m} \times n)(n \times \result{p}) \longrightarrow \result{m \times p}: the inner numbers nn must match so each column of BB has one weight for each column of AA, and the outer numbers m×p\result{m \times p} give the size of CC. For example, (3×2)(2×4)(\result{3} \times 2)(2 \times \result{4}) gives a 3×4\result{3 \times 4} matrix, whereas (2×4)(3×2)(2 \times \nomatch{4})(\nomatch{3} \times 2) is undefined because 4≠3\nomatch{4} \neq \nomatch{3}.

Once the sizes match, pick the way of multiplying that fits what you need:

Multiply on the right to mix columns (Way 1: A×Column of BA \times \text{Column of } B)

Use this to see what ABAB is doing overall or when the right-hand matrix has simple columns, building CC one column at a time:

[2134][13]=1[23]+3[14]=[515]\displaystyle \begin{bmatrix} \kone{2} & \ktwo{1} \\ \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} \\ \ktwo{3} \end{bmatrix} = \kone{1}\begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix} + \ktwo{3}\begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix} = \begin{bmatrix} \result{5} \\ \result{15} \end{bmatrix}

Dot a row with a column for a single entry (Way 2: Row of A⋅Column of B\text{Row of } A \cdot \text{Column of } B)

Don't multiply the full matrices if you only need one entry. For Row 2, Column 1 of ABAB, just dot Row 2 of AA with Column 1 of BB:

[34][13]=(3×1)+(4×3)=15\displaystyle \begin{bmatrix} \kone{3} & \ktwo{4} \end{bmatrix}\begin{bmatrix} \kone{1} \\ \ktwo{3} \end{bmatrix} = (\kone{3 \times 1}) + (\ktwo{4 \times 3}) = \result{15}

Multiply on the left to mix rows (Way 3: Row of A×B\text{Row of } A \times B)

Use this when a matrix on the left does row operations on BB, building CC one row at a time:

[−31][1231]=−3[12]+1[31]=[0−5]\displaystyle \begin{bmatrix} \kone{-3} & \ktwo{1} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} \\ \ktwo{3} & \ktwo{1} \end{bmatrix} = \kone{-3}\begin{bmatrix} \kone{1} & \kone{2} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} = \begin{bmatrix} \result{0} & \result{-5} \end{bmatrix}

Multiply Column by Row for full-size layers (Way 4: Column k of A×Row k of B\text{Column } k \text{ of } A \times \text{Row } k \text{ of } B)

Use this to break ABAB into simple layers where each column of AA is multiplied by the weights in its matching row of BB:

[23][12]+[14][31]=[2436]+[31124]=[551510]\displaystyle \begin{aligned} & \begin{bmatrix} \kone{2} \\ \kone{3} \end{bmatrix}\begin{bmatrix} \kone{1} & \kone{2} \end{bmatrix} + \begin{bmatrix} \ktwo{1} \\ \ktwo{4} \end{bmatrix}\begin{bmatrix} \ktwo{3} & \ktwo{1} \end{bmatrix} \\ &= \begin{bmatrix} \kone{2} & \kone{4} \\ \kone{3} & \kone{6} \end{bmatrix} + \begin{bmatrix} \ktwo{3} & \ktwo{1} \\ \ktwo{12} & \ktwo{4} \end{bmatrix} \\ &= \begin{bmatrix} \result{5} & \result{5} \\ \result{15} & \result{10} \end{bmatrix} \end{aligned}

When not to use ordinary number rules

Never swap ABAB to BABA, because reversing the order swaps the columns with the weights. And when AA's columns can cancel each other out, as in A=[1224]A = \begin{bmatrix} \kone{1} & \ktwo{2} \\ \kone{2} & \ktwo{4} \end{bmatrix} where 2[12]−1[24]=[00]\kone{2}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} - \ktwo{1}\begin{bmatrix} \ktwo{2} \\ \ktwo{4} \end{bmatrix} = \begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix}, do not assume AB=0AB = 0 means A=0A = 0 or B=0B = 0, and do not cancel AA from AB=ACAB = AC to get B=CB = C.

8

Practice

1

Let A=[31−1204]A = \begin{bmatrix} 3 & 1 \\ -1 & 2 \\ 0 & 4 \end{bmatrix} and B=[20−13]B = \begin{bmatrix} 2 & 0 \\ -1 & 3 \end{bmatrix}. By mixing the columns of AA, write each column of ABAB as a combination of the columns of AA and find ABAB.

Read the two numbers in Column 1 of BB as the weights for Column 1 and Column 2 of AA. What weights does Column 2 of BB give?

Take the weights from the columns of BB, not its rows. Using the top row [20]\begin{bmatrix} 2 & 0 \end{bmatrix} and bottom row [−13]\begin{bmatrix} -1 & 3 \end{bmatrix} as weights is a common mistake and gives [60−27012]\begin{bmatrix} 6 & 0 \\ -2 & 7 \\ 0 & 12 \end{bmatrix}.
Column 1:2[3−10]−1[124]=[6−20]−[124]=[5−4−4]\displaystyle \begin{aligned} & \text{Column 1:} \\ & \begin{aligned} \kone{2}\begin{bmatrix} \kone{3} \\ \kone{-1} \\ \kone{0} \end{bmatrix} - \ktwo{1}\begin{bmatrix} \ktwo{1} \\ \ktwo{2} \\ \ktwo{4} \end{bmatrix} &= \begin{bmatrix} \kone{6} \\ \kone{-2} \\ \kone{0} \end{bmatrix} - \begin{bmatrix} \ktwo{1} \\ \ktwo{2} \\ \ktwo{4} \end{bmatrix} \\ &= \begin{bmatrix} \result{5} \\ \result{-4} \\ \result{-4} \end{bmatrix} \end{aligned} \end{aligned}
Column 2:0[3−10]+3[124]=[000]+[3612]=[3612]\displaystyle \begin{aligned} & \text{Column 2:} \\ & \begin{aligned} \kone{0}\begin{bmatrix} \kone{3} \\ \kone{-1} \\ \kone{0} \end{bmatrix} + \ktwo{3}\begin{bmatrix} \ktwo{1} \\ \ktwo{2} \\ \ktwo{4} \end{bmatrix} &= \begin{bmatrix} \kone{0} \\ \kone{0} \\ \kone{0} \end{bmatrix} + \begin{bmatrix} \ktwo{3} \\ \ktwo{6} \\ \ktwo{12} \end{bmatrix} \\ &= \begin{bmatrix} \result{3} \\ \result{6} \\ \result{12} \end{bmatrix} \end{aligned} \end{aligned}
AB=[53−46−412]\displaystyle AB = \begin{bmatrix} \result{5} & \result{3} \\ \result{-4} & \result{6} \\ \result{-4} & \result{12} \end{bmatrix}
2

Let A=[4−120351−26]A = \begin{bmatrix} 4 & -1 & 2 \\ 0 & 3 & 5 \\ 1 & -2 & 6 \end{bmatrix} and B=[27−1304−215]B = \begin{bmatrix} 2 & 7 & -1 \\ 3 & 0 & 4 \\ -2 & 1 & 5 \end{bmatrix}. Without computing the full product, find the single entry in Row 3, Column 2 of ABAB.

Which single row of AA and single column of BB give the entry in Row 3, Column 2?

Take Row 3 from the left matrix AA and Column 2 from the right matrix BB. Swapping them to Row 2 of AA and Column 3 of BB finds the entry in Row 2, Column 3 instead and gives 3737.
[1−26][701]=(1×7)+(−2×0)+(6×1)=7+0+6=13\displaystyle \begin{aligned} & \begin{bmatrix} \kone{1} & \ktwo{-2} & \kthree{6} \end{bmatrix}\begin{bmatrix} \kone{7} \\ \ktwo{0} \\ \kthree{1} \end{bmatrix} \\ &= (\kone{1 \times 7}) + (\ktwo{-2 \times 0}) + (\kthree{6 \times 1}) \\ &= \kone{7} + \ktwo{0} + \kthree{6} = \result{13} \end{aligned}
3

Let B=[2−1341−2]B = \begin{bmatrix} 2 & -1 & 3 \\ 4 & 1 & -2 \end{bmatrix}. Find the 2×22 \times 2 matrix EE that multiplies BB on the left to keep Row 1 the same and subtract 22 times Row 1 from Row 2, then compute EBEB.

Each row of EE gives the weights [weight on Row 1weight on Row 2]\begin{bmatrix} \text{weight on Row 1} & \text{weight on Row 2} \end{bmatrix} for mixing the rows of BB.

Put the weights for the new Row 2 across the bottom row of EE as [−21]\begin{bmatrix} \kone{-2} & \ktwo{1} \end{bmatrix}. Putting −2-2 in the top-right as [1−201]\begin{bmatrix} 1 & -2 \\ 0 & 1 \end{bmatrix} changes Row 1 instead and gives [−6−3741−2]\begin{bmatrix} -6 & -3 & 7 \\ 4 & 1 & -2 \end{bmatrix}.
E=[10−21]\displaystyle E = \begin{bmatrix} \kone{1} & \ktwo{0} \\ \kone{-2} & \ktwo{1} \end{bmatrix}
Row 1 of EB:1[2−13]+0[41−2]=[2−13]\displaystyle \begin{aligned} & \text{Row 1 of } EB: \\ & \begin{aligned} & \kone{1}\begin{bmatrix} \kone{2} & \kone{-1} & \kone{3} \end{bmatrix} + \ktwo{0}\begin{bmatrix} \ktwo{4} & \ktwo{1} & \ktwo{-2} \end{bmatrix} \\ &= \begin{bmatrix} \result{2} & \result{-1} & \result{3} \end{bmatrix} \end{aligned} \end{aligned}
In the last entry of Row 2, watch the negative signs when subtracting 2(3)2(3) from −2-2. Adding 66 instead of subtracting gives 44 instead of −8-8.
Row 2 of EB:−2[2−13]+1[41−2]=[−42−6]+[41−2]=[03−8]\displaystyle \begin{aligned} & \text{Row 2 of } EB: \\ & \begin{aligned} & \kone{-2}\begin{bmatrix} \kone{2} & \kone{-1} & \kone{3} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{4} & \ktwo{1} & \ktwo{-2} \end{bmatrix} \\ &= \begin{bmatrix} \kone{-4} & \kone{2} & \kone{-6} \end{bmatrix} + \begin{bmatrix} \ktwo{4} & \ktwo{1} & \ktwo{-2} \end{bmatrix} \\ &= \begin{bmatrix} \result{0} & \result{3} & \result{-8} \end{bmatrix} \end{aligned} \end{aligned}
EB=[2−1303−8]\displaystyle EB = \begin{bmatrix} \result{2} & \result{-1} & \result{3} \\ \result{0} & \result{3} & \result{-8} \end{bmatrix}
4

Break the product AB=[2−113][312−2]AB = \begin{bmatrix} 2 & -1 \\ 1 & 3 \end{bmatrix}\begin{bmatrix} 3 & 1 \\ 2 & -2 \end{bmatrix} into Layer 1 (Column 1 of A×Row 1 of B\text{Column 1 of } A \times \text{Row 1 of } B) and Layer 2 (Column 2 of A×Row 2 of B\text{Column 2 of } A \times \text{Row 2 of } B), then add the two layers to find ABAB.

Multiply each 2×12 \times 1 column of AA by its matching 1×21 \times 2 row of BB so each pair gives a 2×22 \times 2 matrix.

Layer 1:[21][31]=[6231]\displaystyle \text{Layer 1:} \quad \begin{bmatrix} \kone{2} \\ \kone{1} \end{bmatrix}\begin{bmatrix} \kone{3} & \kone{1} \end{bmatrix} = \begin{bmatrix} \kone{6} & \kone{2} \\ \kone{3} & \kone{1} \end{bmatrix}
For Layer 2, be sure to pair Column 2 of AA with Row 2 of BB ([2−2]\begin{bmatrix} \ktwo{2} & \ktwo{-2} \end{bmatrix}). Using Column 2 of BB ([1−2]\begin{bmatrix} 1 \\ -2 \end{bmatrix}) as [1−2]\begin{bmatrix} 1 & -2 \end{bmatrix} instead gives [−123−6]\begin{bmatrix} -1 & 2 \\ 3 & -6 \end{bmatrix} and leads to the wrong sum [546−5]\begin{bmatrix} 5 & 4 \\ 6 & -5 \end{bmatrix}.
Layer 2:[−13][2−2]=[−226−6]\displaystyle \text{Layer 2:} \quad \begin{bmatrix} \ktwo{-1} \\ \ktwo{3} \end{bmatrix}\begin{bmatrix} \ktwo{2} & \ktwo{-2} \end{bmatrix} = \begin{bmatrix} \ktwo{-2} & \ktwo{2} \\ \ktwo{6} & \ktwo{-6} \end{bmatrix}
AB=[6231]+[−226−6]=[449−5]\displaystyle AB = \begin{bmatrix} \kone{6} & \kone{2} \\ \kone{3} & \kone{1} \end{bmatrix} + \begin{bmatrix} \ktwo{-2} & \ktwo{2} \\ \ktwo{6} & \ktwo{-6} \end{bmatrix} = \begin{bmatrix} \result{4} & \result{4} \\ \result{9} & \result{-5} \end{bmatrix}
5

Let A=[2−14]A = \begin{bmatrix} 2 & -1 & 4 \end{bmatrix} (1×31 \times 3), B=[321]B = \begin{bmatrix} 3 \\ 2 \\ 1 \end{bmatrix} (3×13 \times 1), and C=[1025]C = \begin{bmatrix} 1 & 0 \\ 2 & 5 \end{bmatrix} (2×22 \times 2). Find which of the products ABAB, BABA, and ACAC are defined, give their sizes, and compute them.

Write the sizes next to each other as (m×n)×(n×p)(m \times n) \times (n \times p) for each pair: do the two inner numbers match, and what are the two outer numbers?

For ABAB, the sizes are (1×3)×(3×1)(\result{1} \times 3) \times (3 \times \result{1}), so the inner 33s match and ABAB is 1×1\result{1 \times 1}:
AB=[2−14][321]=[(2×3)+(−1×2)+(4×1)]=[8]\displaystyle \begin{aligned} AB &= \begin{bmatrix} \kone{2} & \ktwo{-1} & \kthree{4} \end{bmatrix}\begin{bmatrix} \kone{3} \\ \ktwo{2} \\ \kthree{1} \end{bmatrix} \\ &= \begin{bmatrix} (\kone{2 \times 3}) + (\ktwo{-1 \times 2}) + (\kthree{4 \times 1}) \end{bmatrix} \\ &= \begin{bmatrix} \result{8} \end{bmatrix} \end{aligned}
For BABA, the sizes are (3×1)×(1×3)(\result{3} \times 1) \times (1 \times \result{3}). Don't assume BABA is the same 1×11 \times 1 matrix [8]\begin{bmatrix} 8 \end{bmatrix} as ABAB: the inner 11s match and the outer numbers show that multiplying a 3×13 \times 1 column by a 1×31 \times 3 row gives a 3×3\result{3 \times 3} layer matrix:
BA=[321][2−14]=[6−3124−282−14]\displaystyle BA = \begin{bmatrix} \kone{3} \\ \kone{2} \\ \kone{1} \end{bmatrix}\begin{bmatrix} \kone{2} & \kone{-1} & \kone{4} \end{bmatrix} = \begin{bmatrix} \result{6} & \result{-3} & \result{12} \\ \result{4} & \result{-2} & \result{8} \\ \result{2} & \result{-1} & \result{4} \end{bmatrix}
For ACAC, the sizes are (1×3)×(2×2)(1 \times \nomatch{3}) \times (\nomatch{2} \times 2); the inner numbers 3\nomatch{3} and 2\nomatch{2} do not match, so ACAC is undefined.
6

Let A=[3−61−2]A = \begin{bmatrix} 3 & -6 \\ 1 & -2 \end{bmatrix}. By mixing the columns of AA, find a 2×22 \times 2 matrix BB with no zero entries and two different columns such that AB=[0000]AB = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}.

How is Column 2 of AA related to Column 1 of AA, and what pair of nonzero weights makes them cancel to [00]\begin{bmatrix} 0 \\ 0 \end{bmatrix}?

Column 2 of AA is −2-2 times Column 1, so we need 2\kone{2} of Column 1 for every 1\ktwo{1} of Column 2. Put those cancelling weights into the columns of BB, not the rows. Putting [21]\begin{bmatrix} 2 & 1 \end{bmatrix} and [−4−2]\begin{bmatrix} -4 & -2 \end{bmatrix} in the rows of BB gives [3015105]\begin{bmatrix} 30 & 15 \\ 10 & 5 \end{bmatrix} instead of zeros.
2[31]+1[−6−2]=[00],−4[31]−2[−6−2]=[00]\displaystyle \begin{aligned} \kone{2}\begin{bmatrix} \kone{3} \\ \kone{1} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{-6} \\ \ktwo{-2} \end{bmatrix} &= \begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix}, \\ \kone{-4}\begin{bmatrix} \kone{3} \\ \kone{1} \end{bmatrix} - \ktwo{2}\begin{bmatrix} \ktwo{-6} \\ \ktwo{-2} \end{bmatrix} &= \begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix} \end{aligned}
B=[2−41−2]\displaystyle B = \begin{bmatrix} \kone{2} & \kone{-4} \\ \ktwo{1} & \ktwo{-2} \end{bmatrix}
7

Let A=[1326]A = \begin{bmatrix} 1 & 3 \\ 2 & 6 \end{bmatrix} and B=[4112]B = \begin{bmatrix} 4 & 1 \\ 1 & 2 \end{bmatrix}. Find a 2×22 \times 2 matrix CC that has no entries in common with BB in the same spots such that AB=ACAB = AC, and find their product with AA.

Since Column 2 of AA is 33 times Column 1 of AA, trading 33 of Column 1 for 11 of Column 2 leaves the mix unchanged.

First find the mix produced by each column of BB:
AB=[4[12]+1[36]1[12]+2[36]]=[771414]\displaystyle AB = \begin{bmatrix} \kone{4}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} + \ktwo{1}\begin{bmatrix} \ktwo{3} \\ \ktwo{6} \end{bmatrix} & \kone{1}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} + \ktwo{2}\begin{bmatrix} \ktwo{3} \\ \ktwo{6} \end{bmatrix} \end{bmatrix} = \begin{bmatrix} \result{7} & \result{7} \\ \result{14} & \result{14} \end{bmatrix}
Because 3[12]−1[36]=[00]\kone{3}\begin{bmatrix} \kone{1} \\ \kone{2} \end{bmatrix} - \ktwo{1}\begin{bmatrix} \ktwo{3} \\ \ktwo{6} \end{bmatrix} = \begin{bmatrix} \result{0} \\ \result{0} \end{bmatrix}, we can subtract 3\kone{3} from the top weight and add 1\ktwo{1} to the bottom weight (or add 3\kone{3} to the top weight and subtract 1\ktwo{1} from the bottom weight) without changing the output. Adding [13]\begin{bmatrix} 1 \\ 3 \end{bmatrix} instead of trading 33 for −1-1 is a common mistake and changes the first column to [1734]\begin{bmatrix} 17 \\ 34 \end{bmatrix}.
C=[1421],AB=AC=[771414]\displaystyle C = \begin{bmatrix} \kone{1} & \kone{4} \\ \ktwo{2} & \ktwo{1} \end{bmatrix}, \qquad AB = AC = \begin{bmatrix} \result{7} & \result{7} \\ \result{14} & \result{14} \end{bmatrix}