Skip to content

Multiplication as composition

Read AB as "apply B, then A", compute the product with the row-column rule after checking the sizes fit, and show with a shear and a rotation that AB and BA differ.

It opens on

Shear the unit square, then turn it a quarter turn: is there one 2 × 2 matrix that does both at once, and does it matter which move comes first?

Why it matters

Every pipeline of linear steps, from a chain of graphics transforms to the layers of a neural network, is one product of matrices, and the order of the factors is the order of the steps.

Good to know first

  • Rotations, reflections and projections: the matrices R and H and their effect on the unit square
  • Matrix-vector multiplication: Ax is a combination of the columns of A, each entry a row dotted with x
  • Linear transformations: the columns of a matrix are the images of e₁ and e₂

Step by step

  1. Two maps in a row

    Follow the unit square through H and then R, and write the matrix of the whole trip as RH from the images of e₁ and e₂.

    H sends (x, y) to (x + y, y), so B = (1, 0) stays, C = (1, 1) goes to (2, 1) and D = (0, 1) goes to (1, 1): a parallelogram.

    A common mix-up

    In RH the left matrix R acts first because we read left to right.

    In fact: The matrix next to x acts first; RH means H, then R.

  2. The row-column rule

    Check that the sizes fit, then compute each entry of AB as a row of A dotted with a column of B, and see why it matches the picture.

    For R = [[0, −1], [1, 0]] and H = [[1, 1], [0, 1]]: row 1 of R is (0, −1) and column 1 of H is (1, 0), so entry (1, 1) is 0 · 1 + (−1) · 0 = 0.

    A common mix-up

    Matrices multiply entry by entry like AB = [aᵢⱼbᵢⱼ].

    In fact: That would not match composing maps; each entry is a whole row times a whole column.

  3. Order matters

    Compute HR as well, compare it with RH, and say when two matrices do and do not commute.

    H(0, 1) = (1, 1) and H(−1, 0) = (−1, 0), so HR = [[1, −1], [1, 0]].

    A common mix-up

    AB = BA, as for numbers.

    In fact: The shear and the turn give different matrices; commuting is a special property.

Try it

Send e₁ and e₂ through R first and then H, and write the two columns of the trip.Answer

(1, 1) and (−1, 0)

Hint: R sends e₁ to (0, 1), then H sends (0, 1) to (1, 1)

Compute [[1, 2], [0, 1]] times [[3, 0], [1, 1]].Answer

[[5, 2], [1, 1]]

Hint: Entry (1, 1) is 1 · 3 + 2 · 1

Let S = [[2, 0], [0, 1]]. Compute SR and RS and say whether they are equal.Answer

SR = [[0, −2], [1, 0]] and RS = [[0, −1], [2, 0]]; not equal

Hint: SR means R first

Where does the whole trip send e₂ = (0, 1)?Answer

H sends it to (1, 1), then R sends that to (−1, 1).

A is 3 × 2 and B is 2 × 4: is AB defined, and what size is it?Answer

Yes, the 2s match; AB is 3 × 4.

Multiplication as composition

30 minutes every month. No card.