Menu
Sign up Sign in

AI HL · AHL 5

Matrices

AHL 5.2

Matrix multiplication

AHL 5.2

Matrix multiplication

Target: Decide whether a product exists and state its order (+3 more)

By the end of this section

Key points

Row times column

  • Each element of \(AB\) comes from one row of \(A\) and one column of \(B\): multiply the matching pairs and add.
  • The element in row 2, column 1 uses row 2 of \(A\) and column 1 of \(B\).

When a product exists

  • \(AB\) exists only when the number of columns of \(A\) equals the number of rows of \(B\).
  • An \(m \times n\) matrix times an \(n \times p\) matrix gives an \(m \times p\) matrix. The inside numbers must match; the outside numbers give the order.

Order matters

  • In general \(AB \ne BA\).
  • Still true: \(A(BC) = (AB)C\) and \(A(B + C) = AB + AC\).

Identity and zero

  • The identity \(I\) has 1s on the diagonal from top left to bottom right and 0s elsewhere. \(AI = IA = A\).
  • The zero matrix has every element 0. Adding it changes nothing.
  • \(A^2\) means \(AA\). It does not mean squaring each element.

Scaling rows or columns

  • A diagonal matrix on the right scales the columns. On the left it scales the rows.
  • A 5% rise is 1.05 on the diagonal. No change is 1. A 2% fall is 0.98.

On the calculator

Multiply and raise to a power

a·b, and a^2

  • Store each matrix first with :=.
  • If the orders do not fit, the calculator gives a dimension error. That is the answer: the product does not exist.

Screenshot and video to come

Explore: multiplying two matrices

Each answer comes from one row of A and one column of B. Work out the next answer yourself, then press Next to check it. Change any number to try your own.

A B =

  1. Which row and which column give the bottom-left answer? Why that row and that column?
  2. Find all four answers, then press Swap A and B. Is BA the same as AB?
  3. Make A the matrix with 1, 0 on the top row and 0, 1 on the bottom row. What is AB? Why?
  4. Can you find two different matrices A and B with AB = BA?

Worked examples

Problems like the ones in class. Pick one, try it, then open the working.
Does the product exist?

\(A\) has order 2 × 4 and \(B\) has order 4 × 3. Find the order of \(AB\), and explain why \(BA\) does not exist.

Working
  1. Line up the orders

    \((2 \times 4)(4 \times 3)\)

    The inside numbers match, so \(AB\) exists.

  2. Order of AB

    2 × 3

    The outside numbers.

  3. BA

    \((4 \times 3)(2 \times 4)\)

    3 columns against 2 rows: they do not match, so \(BA\) does not exist.

Video walkthrough coming
Multiply two 2 × 2 matrices

Find \(\begin{pmatrix}2 & -3 \\ 1 & 4\end{pmatrix}\begin{pmatrix}5 & 1 \\ -2 & 3\end{pmatrix}\).

Working
  1. Top left

    \(2(5) + (-3)(-2) = 16\)

    Row 1 with column 1.

  2. Top right

    \(2(1) + (-3)(3) = -7\)

    Row 1 with column 2.

  3. Bottom row

    \(1(5) + 4(-2) = -3\) and \(1(1) + 4(3) = 13\)

    Row 2 with each column.

  4. Answer

    \(\begin{pmatrix}16 & -7 \\ -3 & 13\end{pmatrix}\)

    Check it on the calculator.

Video walkthrough coming
The other way round

Using the same two matrices, find \(\begin{pmatrix}5 & 1 \\ -2 & 3\end{pmatrix}\begin{pmatrix}2 & -3 \\ 1 & 4\end{pmatrix}\) and compare.

Working
  1. Multiply

    \(\begin{pmatrix}5 & 1 \\ -2 & 3\end{pmatrix}\begin{pmatrix}2 & -3 \\ 1 & 4\end{pmatrix} = \begin{pmatrix}11 & -11 \\ -1 & 18\end{pmatrix}\)

    Row 1 with column 1: \(5(2) + 1(1) = 11\).

  2. Compare

    \(\begin{pmatrix}16 & -7 \\ -3 & 13\end{pmatrix} \ne \begin{pmatrix}11 & -11 \\ -1 & 18\end{pmatrix}\)

    \(AB \ne BA\). Always keep the order you are given.

Video walkthrough coming
AI HL Matrices board · percentage change
Prices that rise by different percentages

A café has two branches, Town (T) and Station (S). The prices in euros of a coffee, a sandwich and a cake are \(P = \begin{pmatrix}3.00 & 3.40 \\ 6.50 & 7.00 \\ 4.00 & 4.20\end{pmatrix}\), with the columns in the order T, S. (a) Town prices rise by 2% and Station prices by 5%. (b) Instead, coffee rises by 10%, sandwiches fall by 2% and cake stays the same. Write each change as a matrix product and find the new prices.

Working
  1. (a) Which way do the changes run?

    By column: one factor for T, one for S

    Columns are scaled by a diagonal matrix on the right.

  2. (a) The product

    \(P\begin{pmatrix}1.02 & 0 \\ 0 & 1.05\end{pmatrix} = \begin{pmatrix}3.06 & 3.57 \\ 6.63 & 7.35 \\ 4.08 & 4.41\end{pmatrix}\)

    3 × 2 times 2 × 2: the orders fit.

  3. (b) Which way now?

    By row: one factor for each item

    Rows are scaled by a diagonal matrix on the left.

  4. (b) The product

    \(\begin{pmatrix}1.10 & 0 & 0 \\ 0 & 0.98 & 0 \\ 0 & 0 & 1\end{pmatrix}P = \begin{pmatrix}3.30 & 3.74 \\ 6.37 & 6.86 \\ 4.00 & 4.20\end{pmatrix}\)

    3 × 3 times 3 × 2. No change is a 1 on the diagonal.

  5. Why two different sides?

    Columns: multiply on the right. Rows: multiply on the left.

    The other way round the orders would not fit.

Video walkthrough coming
Which supplier is cheaper?

Two clubs order kit. The numbers of shirts, shorts and pairs of socks are \(D = \begin{pmatrix}30 & 25 & 40 \\ 20 & 26 & 30\end{pmatrix}\) (rows: Harriers, Kestrels). Two suppliers charge, in pounds per item, \(C = \begin{pmatrix}18 & 16 \\ 12 & 14 \\ 4 & 4\end{pmatrix}\) (columns: supplier X, supplier Y). Find the total cost matrix and say which supplier each club should use.

Working
  1. Do the orders fit?

    \((2 \times 3)(3 \times 2)\)

    Items run along the rows of \(D\) and down the columns of \(C\), so quantities meet prices.

  2. Multiply

    \(DC = \begin{pmatrix}1000 & 990 \\ 792 & 804\end{pmatrix}\)

    Top left: \(30(18) + 25(12) + 40(4) = 1000\).

  3. Read the answer

    Harriers: Y (£990 < £1000). Kestrels: X (£792 < £804).

    Each row is a club. Each column is a supplier.

Video walkthrough coming
A power and the identity

\(A = \begin{pmatrix}2 & 1 \\ -1 & 3\end{pmatrix}\). Find \(A^2 + 3I\).

Working
  1. A squared

    \(A^2 = \begin{pmatrix}2 & 1 \\ -1 & 3\end{pmatrix}\begin{pmatrix}2 & 1 \\ -1 & 3\end{pmatrix} = \begin{pmatrix}3 & 5 \\ -5 & 8\end{pmatrix}\)

    \(A^2\) is \(A\) times \(A\), not each element squared.

  2. Three lots of I

    \(3I = \begin{pmatrix}3 & 0 \\ 0 & 3\end{pmatrix}\)

    \(A\) is 2 × 2, so \(I\) is the 2 × 2 identity.

  3. Add

    \(\begin{pmatrix}6 & 5 \\ -5 & 11\end{pmatrix}\)

    Add matching elements.

Video walkthrough coming
Three tables in a row

A café makes lasagne and pizza. In one day it makes \(O = \begin{pmatrix}40 & 25\end{pmatrix}\) (lasagne, pizza). The units of pasta, cheese and tomato each dish needs are \(D = \begin{pmatrix}2 & 3 & 1 \\ 1 & 2 & 2\end{pmatrix}\) (rows: lasagne, pizza). Two suppliers charge, in euros per unit, \(P = \begin{pmatrix}1.5 & 1.6 \\ 0.8 & 0.7 \\ 2.4 & 2.5\end{pmatrix}\) (rows: pasta, cheese, tomato; columns: supplier X, supplier Y). Find the cost of the day's ingredients from each supplier.

Working
  1. Check the orders fit

    \((1 \times 2)(2 \times 3)(3 \times 2)\)

    The inner orders match, so the product exists. It has order \(1 \times 2\): one cost for each supplier.

  2. Dishes to units of ingredients

    \(OD = \begin{pmatrix}105 & 170 & 90\end{pmatrix}\)

    Top left: \(40(2) + 25(1) = 105\) units of pasta for the day.

  3. Units to cost

    \(ODP = \begin{pmatrix}509.5 & 512\end{pmatrix}\)

    Multiply the units by the prices. The calculator does the whole product in one go: o·d·p.

  4. Read the answer

    Supplier X: €509.5. Supplier Y: €512.

    Each column is a supplier.

Video walkthrough coming