Lesson 4 of 7 · 18 min

Multiplying matrices

Decide whether a matrix product is defined and find its order, then multiply matrices by hand, row by column, up to 3 × 3.

What you will be able to do

  • Decide whether a product ABAB is defined, and state its order.
  • Multiply matrices row by column, by hand, for matrices up to 3 × 3, including ones that are not square.
  • Explain why ABAB and BABA are usually different.
  • Use the identity matrix: AI=IA=AAI = IA = A.

At the school tuckshop you buy 3 pies at $5 each and 2 drinks at $4 each. You find the total by multiplying each quantity by its price and adding:

3×5+2×4=233 \times 5 + 2 \times 4 = 23

Matrix multiplication does exactly this. Put the quantities in a row and the prices in a column, and multiply row by column: matching entries multiplied, then added.

[32][54]=[3×5+2×4]=[23]\begin{bmatrix} 3 & 2 \end{bmatrix}\begin{bmatrix} 5 \\ 4 \end{bmatrix} = \begin{bmatrix} 3 \times 5 + 2 \times 4 \end{bmatrix} = \begin{bmatrix} 23 \end{bmatrix}

Key idea

Row by column

The element in row ii, column jj of ABAB comes from row ii of AA and column jj of BB: multiply their matching entries and add the results.

[abcd][efgh]=[ae+bgaf+bhce+dgcf+dh]\begin{bmatrix} a & b \\ c & d \end{bmatrix}\begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} ae + bg & af + bh \\ ce + dg & cf + dh \end{bmatrix}
Interactive

Row by column

Pick an element of the product to see the row and column that build it. Predict each one first: the top-left element is 2×5+1×1=112 \times 5 + 1 \times 1 = 11. Then switch to BABA. Is it the same?

Definition

When is a product defined?

For row-by-column to work, each row of AA must be as long as each column of BB. So ABAB is defined only when

the number of columns of AA = the number of rows of BB.

Write the orders side by side. The inner numbers must match; the outer numbers give the order of the answer:

(2×3‾)(3‾×4)→2×4(2 \times \underline{3})(\underline{3} \times 4) \to 2 \times 4

AA is a 3×23 \times 2 matrix and BB is a 2×42 \times 4 matrix. State the order of ABAB.

Multiplying two matrices by hand

  1. Check the product is defined

    Write the orders. The inner numbers must match. The outer numbers give the order of the answer, so draw an empty matrix of that size.

  2. Fill the answer one element at a time

    For row ii, column jj, run along row ii of the first matrix and down column jj of the second. Multiply matching entries and add.

  3. Check

    Recalculate one element, or use technology to multiply the matrices and compare.

Worked example

Multiply a 2 × 3 matrix by a 3 × 2 matrix

  • Simple familiar
  • Technology free

Given

A=[21304−1]B=[1230−25]A = \begin{bmatrix} 2 & 1 & 3 \\ 0 & 4 & -1 \end{bmatrix} \qquad B = \begin{bmatrix} 1 & 2 \\ 3 & 0 \\ -2 & 5 \end{bmatrix}

calculate ABAB, and state the order of BABA.

5 steps

Try it yourself first, then check the working one step at a time.

Method

  1. Write the orders; the inner numbers must match and the outer ones give the answer's order.

  2. For each element (i,j)(i, j), multiply row ii by column jj entry by entry and add.

  3. Take care with negative numbers.

Watch out for

  • Losing the sign in (−1)×(−2)=+2(-1) \times (-2) = +2.

  • Assuming BABA has the same order as ABAB.

Calculate [3214][52]\begin{bmatrix} 3 & 2 \\ 1 & 4 \end{bmatrix}\begin{bmatrix} 5 \\ 2 \end{bmatrix}.

Key idea

AB and BA are usually different

With ordinary numbers, 3×5=5×33 \times 5 = 5 \times 3. With matrices, the order matters:

  • ABAB can be defined when BABA is not. A 2×32 \times 3 matrix times a 3×33 \times 3 matrix is defined, but the other way round, (3×3)(2×3)(3 \times 3)(2 \times 3), is not.
  • Even when both are defined, ABAB and BABA usually have different elements, and can even have different orders.

So always multiply in the order the question gives.

AA is 2×32 \times 3 and BB is 3×33 \times 3. Select all the products that are defined.

Select all that apply.

Definition

Multiplying by the identity

For any matrix AA and an identity matrix II of the right size,

AI=IA=AAI = IA = A

Try it: [2741][1001]\begin{bmatrix} 2 & 7 \\ 4 & 1 \end{bmatrix}\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} has top-left element 2×1+7×0=22 \times 1 + 7 \times 0 = 2, and every other element also comes out unchanged.

Common mistake

Not element by element

Adding matrices works element by element, but multiplying does not. [1234][5678]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}\begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} is not [5122132]\begin{bmatrix} 5 & 12 \\ 21 & 32 \end{bmatrix}. Its top-left element is 1×5+2×7=191 \times 5 + 2 \times 7 = 19.

Exam tip

In the exam

Write the orders first, like (2×3)(3×2)→2×2(2 \times 3)(3 \times 2) \to 2 \times 2. Then show the working for at least one element in full. If you use technology for the multiplication, still write down the matrices you entered.

Summary

  • ABAB is defined only when the number of columns of AA equals the number of rows of BB.

  • (m×n)(n×p)→m×p(m \times n)(n \times p) \to m \times p: the outer numbers give the order of the product.

  • Element (i,j)(i, j) of ABAB: multiply row ii of AA by column jj of BB, entry by entry, and add.

  • In general AB≠BAAB \neq BA, and one may be defined when the other is not.

  • AI=IA=AAI = IA = A: the identity matrix acts like the number 1.

Finished the lesson?

Try the 3 quick checks above and the lesson completes itself, or mark it complete now.

Lesson 4 of 70% read

Save your progress with a free account