Six matrices, six ways to move a picture. Watch the letter F turn, grow, stretch, lean, flip and flatten.
Six ways to move a picture
Turn, scale, stretch, shear, reflect, flatten. Read each matrix's columns before it plays.
Six matrices, one after another. Before each one plays, read its columns: they are where e_1 and e_2 will land.
Describe this picture
One panel with a faint square grid, the two unit arrows and the letter F drawn on the grid. The panel plays six maps in turn. Each starts from the square grid, moves the grid and the F to its end state, and holds there. Its matrix stays in the corner of the panel the whole time, the first column in the colour of and the second in the colour of . In order: a turn by 30° anticlockwise, ; a scaling by 1.5, ; a stretch along the horizontal axis, ; a shear, ; a reflection in the line , ; and a projection onto that line, . The turn sweeps round. The scaling, the stretch and the projection glide straight; the shear turns a little as it stretches. The reflection folds the plane across a dotted mirror line, the line : halfway through, the F lies flat on that line for a moment, then opens out mirrored. A transport plays, pauses and steps from one map to the next; there is no other control.
Read the columns
In A matrix moves the plane a matrix was the table of where two arrows land. I call those arrows and . A bold with a number under it always means one of these arrows on this site, never the number . The first column of a matrix is where lands, and the second column is where lands.
That one rule lets you read every picture in the gallery from its matrix. Step through the clip and, before each map plays, guess the picture from the two columns.
Turn. A turn by an angle anticlockwise moves round the unit circle to . The arrow starts a quarter turn further on, and it lands at , a quarter turn ahead of ‘s new place. So
The minus sign sits at the top right because swings to the left. For 30°, which is rad, the columns are and .
Scale. makes both arrows 1.5 times as long. The F grows and keeps its shape.
Stretch. doubles and leaves alone. The F becomes twice as wide and just as tall.
Shear. keeps and sends to . Each row of the grid slides sideways by its height, and the F leans over.
Reflect. swaps the two arrows. The line acts as a mirror, and the F comes out back to front.
Project. sends both arrows to the same place, . Every point goes to , the point of the line straight across from it at a right angle. The whole F is flattened onto the line.
Reading also works backwards. Draw where the two arrows should land, and their coordinates, written as columns, are the matrix.
The two rules
Every map in the gallery keeps grid lines straight, parallel and evenly spaced, and keeps the origin in place. Written as rules, a map of the plane is linear when, for all vectors , and every number ,
The first rule says adding first and mapping first give the same answer. The second says the same for scaling. I write a map with braces, , as the signal processing course writes a system, and the two rules are the same there.
These two rules are why the columns are enough. Every vector is a combination of the unit arrows, . Apply both rules:
So once you know where and land, you know where everything lands. The matrix of is those two landing places side by side:
Here is a check on the shear. sends to . Doubling the input, goes to , which is twice , as the second rule says.
In signal processing · superposition
System properties, in the signal processing course, calls the first rule additivity and the second homogeneity; together they are superposition. A linear system of signals and a linear map of the plane obey exactly the same two rules.
Not linear: a shift
Here is a move that looks harmless: slide the whole plane one step to the right. Every point goes to . Watch what the grid does.
A shift is not linear
Every point x goes to x + (1, 0).
The square grid, with its origin marked.
Describe this picture
The square grid with the origin marked and the unit square shaded. The whole grid slides one step to the right, by , and holds. The grid lines stay straight and evenly spaced, but the mark for the origin moves to , and a ring marks where it was. A readout gives where the origin is now. There is no control.
The grid lines stay straight, so the shift looks linear. But watch the origin: it moves, and a linear map never moves the origin. Both rules fail. Take :
- , not . With the second rule would need .
- gets one shift, but gets two.
No 2×2 matrix can do a shift, because every matrix sends to . Matrices in computer graphics shows the way round this.
Watch out
In school algebra, a “linear function” is a straight-line graph such as . In linear algebra that function is not linear: at 0 it gives 1, not 0, and adding first gives a different answer, since while . Only , with no added constant, is linear here.
Maps of space
In space a matrix has three columns: where , and land. Take a quarter turn about the vertical axis, the third one. It turns to and to , and it leaves , the axis itself, where it is:
It sends the point to
The first two numbers turn exactly as in the plane, and the height stays 3.
Worked example
1. From a picture to a matrix. A map sends to and to . Its columns are those two landing places:
It sends to . By rows: and . In words, this map turns everything a quarter turn anticlockwise and then doubles every height: the turn takes to , which doubles to , and to , whose height is 0.
2. The shift fails. gives , so it is not linear.
3. The shear passes the scaling rule. .
4. A reflection you write yourself. The mirror in the horizontal axis keeps and flips to , so its matrix is .
5. A turn by 30°. It sends to its first column, .
Predict before you watch the gallery again: which of the six maps can’t be undone? The projection. It sends a whole line of points to each single point of , so nothing can tell where a point started.
Where you’ll meet this
Image editors. Rotate, resize, skew and flip are these matrices, applied to the position of every pixel. Skew is the shear, and flip is a reflection.
Turning a phone. A phone’s motion sensor reports gravity in the sensor’s own axes. Turn the phone a quarter turn and the reading m/s² becomes m/s² in the screen’s axes: with , a quarter turn, applied to the reading.
Complex numbers. Multiplying a complex number by gives . That is applied to the point , the rotate-and-scale picture of Complex numbers for signals in the signal processing course.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Matrix of a map | columns: where the unit arrows land | |
| Turn | anticlockwise by | |
| Scale, stretch | , | numbers on the diagonal stretch the axes |
| Shear | rows slide sideways by their height | |
| Reflection in | swaps the two arrows | |
| Projection onto | flattens the plane; can’t be undone | |
| Linear | , | origin stays put |
| Shift | not linear: it moves the origin |