Worked examples
The question
Question: multiply these two matrices.
[1, 2; 3, 4] × [2, 0; 1, 3]
1 Check the sizes
2 Row times column
Each entry of the answer is one row of the first matrix, times one column of the second.
= [1 × 2 + 2 × 1, 1 × 0 + 2 × 3; 3 × 2 + 4 × 1, 3 × 0 + 4 × 3]
Careful!
We do not just multiply the entries in the same place.
Each entry is a whole row times a whole column.
Careful: not entry × entry ✗
3 Work out each entry
First we work out every times.
= [2 + 2, 0 + 6; 6 + 4, 0 + 12]
Then we add.
The answer: rows 4, 6 and 10, 12.
= [4, 6; 10, 12]
4 Check
Let's check each entry, adding its products the other way round.
2 + 2 = 4, 6 + 0 = 6
4 + 6 = 10, 12 + 0 = 12
Every entry matches.
So the answer is right!
Let's look back.
First: check the sizes.
Then: row times column.
Then: work out each entry.
Last: check.
▶ Watch it solved
The question
Question: multiply these two matrices.
[2, −1; 3, 4] × [1, 5; −2, 3]
1 Check the sizes
2 Row times column
Each entry of the answer is one row of the first matrix, times one column of the second.
= [2 × 1 + −1 × (−2), 2 × 5 + −1 × 3; 3 × 1 + 4 × (−2), 3 × 5 + 4 × 3]
Careful!
We do not just multiply the entries in the same place.
Each entry is a whole row times a whole column.
Careful: not entry × entry ✗
3 Work out each entry
First we work out every times.
= [2 + 2, 10 + (−3); 3 + (−8), 15 + 12]
Then we add.
The answer: rows 4, 7 and −5, 27.
= [4, 7; −5, 27]
4 Check
Let's check each entry, adding its products the other way round.
2 + 2 = 4, −3 + 10 = 7
−8 + 3 = −5, 12 + 15 = 27
Every entry matches.
So the answer is right!
Let's look back.
First: check the sizes.
Then: row times column.
Then: work out each entry.
Last: check.
▶ Watch it solved
The question
Question: work out A B and B A.
Is the order important?
A = [1, 2; 0, 3]
A B means A times B.
B A means B times A.
B = [2, 0; 1, 1]
1 Check the sizes
Both are 2 by 2.
The inside numbers are 2 and 2 both ways.
So we can multiply in both orders, and both answers are 2 by 2.
2 Work out AB
Careful!
In A B, the rows come from A and the columns from B.
Careful: A B: rows of A × columns of B
AB = [1 × 2 + 2 × 1, 1 × 0 + 2 × 1; 0 × 2 + 3 × 1, 0 × 0 + 3 × 1]
First we work out every times.
AB = [2 + 2, 0 + 2; 0 + 3, 0 + 3]
Then we add.
So A B is rows 4, 2 and 3, 3.
AB = [4, 2; 3, 3]
3 Work out BA
Now the other order: rows of B, columns of A.
BA = [2 × 1 + 0 × 0, 2 × 2 + 0 × 3; 1 × 1 + 1 × 0, 1 × 2 + 1 × 3]
First we work out every times.
BA = [2 + 0, 4 + 0; 1 + 0, 2 + 3]
Then we add.
So B A is rows 2, 4 and 1, 5.
BA = [2, 4; 1, 5]
4 Compare
The two answers are different.
So A B is not the same as B A: with matrices, the order matters!
AB ≠ BA
5 Check
Let's check A B: each entry's products added the other way round.
2 + 2 = 4, 2 + 0 = 2
3 + 0 = 3, 3 + 0 = 3
A B is right.
And B A the same way.
0 + 2 = 2, 0 + 4 = 4
0 + 1 = 1, 3 + 2 = 5
B A is right too.
So the answer is right!
Let's look back.
First: check the sizes.
Then: work out AB.
Then: work out BA.
Then: compare.
Last: check.
▶ Watch it solved