Steply

AB and BA for A = [2, -1; 3, 1], B = [0, 1; 1, 2]

Step by step, with the reason for every step · Multiplying matrices · Algebra 2

Step by step

The question

Question: work out A B and B A.

Is the order important?

A = [2, −1; 3, 1]

A B means A times B.

B A means B times A.

B = [0, 1; 1, 2]

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 = [2 × 0 + −1 × 1, 2 × 1 + −1 × 2; 3 × 0 + 1 × 1, 3 × 1 + 1 × 2]

First we work out every times.

AB = [0 + (−1), 2 + (−2); 0 + 1, 3 + 2]

Then we add.

So A B is rows −1, 0 and 1, 5.

AB = [−1, 0; 1, 5]

3 Work out BA

Now the other order: rows of B, columns of A.

BA = [0 × 2 + 1 × 3, 0 × (−1) + 1 × 1; 1 × 2 + 2 × 3, 1 × (−1) + 2 × 1]

First we work out every times.

BA = [0 + 3, 0 + 1; 2 + 6, −1 + 2]

Then we add.

So B A is rows 3, 1 and 8, 1.

BA = [3, 1; 8, 1]

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.

−1 + 0 = −1, −2 + 2 = 0
1 + 0 = 1, 2 + 3 = 5

A B is right.

And B A the same way.

3 + 0 = 3, 1 + 0 = 1
6 + 2 = 8, 2 + (−1) = 1

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.

Answer
AB ≠ BA

Your turn

Try this one yourself, then check:

Work out AB and BA: A = [3, −2; 2, 3], B = [0, 1; 2, 3]
Show the answer
AB ≠ BA

More from Multiplying matrices

The whole lesson: Multiplying matrices →