One transformation, then another
Take two transformations of the plane: M = (1 0; 0 −1), the reflection in the x-axis, and R = (0 −1; 1 0), the quarter turn counterclockwise about the origin. Write the point (2, 1) as the column X = (2; 1). Reflect it first, and then turn the result.
The reflection sends (2, 1) to M X = (2; −1), the point (2, −1). The turn then acts on that point: R (M X) = (0 × 2 + (−1) × (−1); 1 × 2 + 0 × (−1)) = (1; 2). So the point ends at (1, 2).
Look at the order the letters are written in. M acted first, and it stands next to the column X. R acted second, and it was written on the left of M X. Each new transformation is written on the left of everything done so far.
First the reflection M: the triangle with corners (1, 1), (3, 1) and (1, 2) is reflected in the x-axis, onto (1, −1), (3, −1) and (1, −2).
Then the turn R acts on that image: (1, −1) lands on (1, 1), (3, −1) on (1, 3) and (1, −2) on (2, 1).
One matrix does both
Matrix multiplication is associative, so R (M X) = (R M) X. The product R M is a single matrix that does the reflection and then the turn in one step.
Work it out as an ordinary product, row of R into column of M. Row 1 of R is (0, −1): with column 1 of M, (1, 0), it gives 0 × 1 + (−1) × 0 = 0, and with column 2, (0, −1), it gives 0 × 0 + (−1) × (−1) = 1. Row 2 of R is (1, 0): with the two columns it gives 1 and 0. So R M = (0 1; 1 0).
The columns tell the same story. Follow i = (1, 0): M leaves it at (1, 0), and R turns it to (0, 1), which is the first column of R M. Follow j = (0, 1): M sends it to (0, −1), and R turns that to (1, 0), the second column. A matrix with columns (0, 1) and (1, 0) swaps the two coordinates of every point, so R M is the reflection in the line y = x.
Check it on the point from before: (0 1; 1 0) sends (2, 1) straight to (1, 2), where the two stages took it.
The single matrix R M, the reflection in y = x, sends the first triangle straight to (1, 1), (1, 3) and (2, 1): the same place as the reflection followed by the turn.
The other order
Now turn first and reflect second. The turn acts first, so it stands next to the point, and the product is M R.
Row 1 of M is (1, 0): with column 1 of R, (0, 1), it gives 0, and with column 2, (−1, 0), it gives −1. Row 2 of M is (0, −1): with the two columns it gives −1 and 0. So M R = (0 −1; −1 0). Following i gives the same first column: R turns i to (0, 1), and M reflects that to (0, −1).
M R sends (x, y) to (−y, −x), which is the reflection in the line y = −x. It sends (2, 1) to (−1, −2), while R M sent it to (1, 2). R M and M R are different matrices, so the two orders are different transformations, and the order you work in matters. This is what it means for matrix multiplication not to be commutative.
Turning first and reflecting second is M R, the reflection in y = −x. The same triangle lands on (−1, −1), (−1, −3) and (−2, −1), on the opposite side of the origin.
Reading a product from the right
In R M X, the matrix next to the column acts first, and each matrix further left acts on what came out of the one to its right. So a product of transformations reads from right to left, the same way f(g(x)) means g first and then f.
If Q is done first and P second, the single matrix is P Q. With three transformations, A first, then B, then C, the single matrix is C B A: A stands next to the point, and C, the last to act, is on the far left.
Twice the same transformation
Turning a quarter turn twice is R R, written . Row 1 of R, (0, −1), with the columns (0, 1) and (−1, 0) gives −1 and 0; row 2, (1, 0), gives 0 and −1. So is the matrix (−1 0; 0 −1), which sends every point (x, y) to (−x, −y): the half turn, as two quarter turns should be.
Reflecting twice in the x-axis is M M. The first reflection sends (x, y) to (x, −y), and the second sends it back to (x, y), so M M = (1 0; 0 1), the identity matrix, which moves nothing.
Some pairs do commute. Two turns about the origin give the same result in either order, and an enlargement (k 0; 0 k) commutes with every 2 × 2 matrix, because it only multiplies each point by k. A reflection and a turn, as above, do not.
The usual mistakes
Writing the matrices in the order the transformations happen. "Reflect, then turn" is R M, not M R: the first transformation is written next to the point, on the right.
Assuming the order does not matter, as it does not when multiplying numbers. R M sent (2, 1) to (1, 2), and M R sent it to (−1, −2).
Multiplying entry by entry. That would make the bottom-left entry of R M equal to 1 × 0 = 0, but row 2 of R times column 1 of M is 1 × 1 + 0 × 0 = 1.
A floor tile
In the application below, a triangular floor tile is turned a quarter turn and then reflected in the x-axis. The turn is done first, so it stands on the right of the product, and the single matrix is checked on one corner in two stages. Then the order is reversed, and the tile lands somewhere else.
Worked example: A Floor Tile Turned and Then Flipped, Written as One Matrix
Question A designer turns a triangular floor tile with corners A(2, 1), B(4, 1) and C(2, 4) through 90° counterclockwise about the origin, with R = 0−110, and then reflects the result in the x-axis, with X = 100−1. (a) Find the single matrix for the turn followed by the reflection, and use it to find where the tile ends up. (b) Find the single matrix when the reflection is done first and the turn second, and show that the tile then ends up somewhere else.
1.The turn is done first, so its matrix stands next to the point: the single matrix is XR, read from right to left.
The turn is done first, so its matrix stands next to the point: the single matrix is XR, read from right to left. The turn alone gives A'B'C'. 2.XR = 100−10−110 = 1 × 0 + 0 × 11 × (−1) + 0 × 00 × 0 + (−1) × 10 × (−1) + (−1) × 0 = 0−1−10.
XR = 100−10−110 = 0−1−10. 3.Check with one corner in two stages. The turn sends A(2, 1) to A'(−1, 2), and the reflection sends A' to A''(−1, −2). In one step, XR21 = −1−2, the same point.
In two stages A(2, 1) goes to A'(−1, 2) and then to A''(−1, −2); in one, XR21 = −1−2. 4.(a) XR sends (x, y) to (−y, −x), so the tile ends up at A''(−1, −2), B''(−1, −4) and C''(−4, −2). The single matrix is the reflection in the line y = −x.
(a) The tile ends up at A''(−1, −2), B''(−1, −4) and C''(−4, −2): XR is the reflection in y = −x. 5.(b) The other order is RX = 0−110100−1 = 0110, which sends (x, y) to (y, x). The tile ends up at (1, 2), (1, 4) and (4, 2), its reflection in y = x, in a different place, because XR ≠ RX.
(b) RX = 0110 puts the tile at (1, 2), (1, 4) and (4, 2), the dashed triangle: XR ≠ RX.
Answer: (a) XR = 0−1−10, and the tile ends up at (−1, −2), (−1, −4) and (−4, −2); (b) RX = 0110, which puts the tile at (1, 2), (1, 4) and (4, 2) instead
Common mistakes
- Writing RX for the turn followed by the reflection, because R is done first and is read first. The matrix next to the point acts first, so the turn must be on the right: XR.
- Assuming the order does not matter, as it does not for multiplying numbers. XR and RX are different matrices, and the tile lands in the third quadrant one way and the first quadrant the other.
More matrices as transformations problems, worked step by step →