Advanced Placement
Skip to the notes

AP Precalculus

Topic 4.12: Linear Transformations and Matrices

Watch now20 min

Updated · For the May 2027 AP exam

Linear transformations and matrices: L(v) = Av, where four numbers move every point and the origin stays put. Tilt, stretch and turn a whole city at sunset by changing four numbers, while every street stays straight.

Topic 4.12 key terms

linear transformation
A function that takes an input vector to an output vector so that each output component is a sum of constant multiples of the input components, like L(x, y) = (2x − y, x + y).
vector as a column
A vector in the plane can be written as a 2 × 1 matrix, x on top of y. Written this way it can be multiplied by a 2 × 2 matrix from the left.
L(v) = Av
Every linear transformation of the plane is multiplication by a unique 2 × 2 matrix A, and every 2 × 2 matrix gives a linear transformation. Row 1 of A makes the new x, row 2 the new y.
the origin stays put
A linear transformation always sends the zero vector to the zero vector, because A·0 = 0. A rule that moves the origin, like (x + 1, y), is not linear.
columns of a matrix
A(1, 0) is the first column of A and A(0, 1) is the second, so the transformation decides every entry of its matrix.
2 × n matrix of vectors
n vectors in the plane can be stood side by side as the columns of a 2 × n matrix P. Then AP is the 2 × n matrix whose columns are their images, in the same order.
linear function vs linear transformation
f(x) = mx + b is called linear because its graph is a line, but it is a linear transformation only when b = 0, since a linear transformation must send 0 to 0.

Transcript

2,561 words · 8 parts

Four numbers

This is a whole city at sunset, thousands of buildings, a river, a park, and more than a thousand street corners. And right in the middle of it is a round plaza with one little brass pin.

Up in the corner there’s a little box with four numbers in it. I’m going to change just one of them, and every avenue in the whole city tilts at the same time. Now a second number, and the whole city stretches out sideways. And now all four of them at once.

And look at what doesn’t happen. The streets all stay perfectly straight, and the blocks stay evenly spaced, and that little pin in the middle of the plaza never moves, not even a millimeter. By the end of this lesson you’ll be able to bend this whole city with four numbers, and work out exactly where any street corner is going to land before it moves.

It isn’t just a trick for one city, either. Every time you twist a map on your phone, its graphics chip does this same kind of multiplication to every corner of every shape on the screen. So let’s start with just one corner. The rest of the city will come along for free.

One corner

Here’s a corner I like. It has a little cafe on it. It’s right where 3rd Avenue crosses 2nd Street. Seen from straight above, the streets of this city make a coordinate grid. The avenues are numbered east from the plaza and the streets north from it, so the pin sits at zero, zero.

That means our cafe’s address is really a pair of coordinates, three, two, because it’s three blocks east of the pin and two blocks north. Now let’s give the whole city a rule. Every point’s east-west number doubles, and its north-south number stays the same.

So the whole city stretches out to twice as wide, and our cafe rides from three, two all the way over to six, two. Every point in the city followed that one rule at the same moment. Now let’s lift the grid off the city, and look at it on the board.

A rule that takes in a point and gives back a point is still a function, so let’s call it L. L of three, two is six, two. The big new thing today is that this function takes in two numbers and gives back two. Doubling is a fairly tame rule, so let’s try one that mixes things up. The new x is two x minus y, and the new y is x plus y.

Where does our cafe go now? For the new x it’s two times three, minus two, which is four, and for the new y it’s three plus two, which is five. So the cafe lands at four, five. And here’s what that same rule does to the whole grid at once. Every grid line is still straight and evenly spaced, and the pin at the origin hasn’t moved at all.

Notice that each new coordinate is a recipe, and it uses both of the old ones. The new x takes two of the old x, and minus one of the old y. The new y takes one of each.

And that’s exactly what makes it a linear transformation. Each output coordinate is a sum of constant multiples of the input coordinates, and constant means the same numbers for every single point in the city. So you’re only ever allowed to multiply each input by a fixed number and add the results. Let’s try one. Using the same rule, where does the corner at one, four end up?

The sun does it too

Rules like this aren’t only something computers do. Here’s an old loft in the same city at four in the afternoon, with sunlight pouring through one huge window onto the floor. The window bars draw a whole grid of light on the floor, slanted and stretched. But every line is still straight, and every little patch of light is the same size.

Let’s measure the window and the floor from the corner where they meet. We’ll have x going along the bottom and h going up, both counted in panes. Take the corner of a pane that’s one across and two up. Its light comes down through the dust and lands right here on the floor, three panes along the wall and four out into the room.

At four o’clock all the light follows one rule. Along the wall it lands at u equals x plus h, and out into the room at w equals two h, so our corner goes to one plus two, and two times two, which is three, four. So this is a linear transformation too, because both of its outputs, x plus h and two h, are built from constant multiples of x and h.

The multiples stay the same for every point because the sun’s rays are all parallel, so every pane you climb up the window pushes your light the same distance across the floor. As the afternoon goes on, the sun drops and swings around, so the two numbers in the rule keep changing, and the whole patch sweeps across the floor. But look at the corner where the window meets the floor. All afternoon, its light never moves at all.

Now you try a different corner. Drag the marker to where you think the light from the pane corner at two, three lands on the floor.

Four numbers in a box

Let’s go back to our rule from the city. The new x is two x minus y, and the new y is x plus y. Everything it does is decided by four numbers, two and negative one in the first line, and one and one in the second.

So we pull those four numbers out and stack them in a box. Then we stand the point up as a column. The x goes on top of the y. And the new point comes out as a column too. That box is a two by two matrix. The point, standing up as a column, is a two by one matrix, and we usually call it a vector.

And multiplying them, row times column, gives us the rule right back. The first row, two and negative one, times x, y, gives two times x plus negative one times y, which is two x minus y. And the second row, one and one, times the same column gives x plus y. That’s the whole rule again.

So the whole rule fits in a few letters, L of v equals A times v, where A is the matrix and v is the input vector. And the sizes work just like before. A two by two, times a two by one, gives a two by one. That’s one point out.

Let’s call this matrix B, and run a point through it. Say, negative one, three. The top row gives two times negative one, minus three, which is negative five, and the bottom row gives negative one plus three, which is two. So negative one, three lands at negative five, two.

One thing to be careful about is that the vector goes on the right, standing up as a column. Lying down on the left, it still multiplies, but it gives you the wrong point. Now you try one. What do you get when you multiply this matrix by this vector?

The pin

Back in the city, it’s getting dark. Let’s get a close look at that little pin. It’s right in the plaza. I’ll throw all kinds of matrices at the city. And whatever the four numbers are, the pin stays exactly where it is.

That isn’t luck. The pin is at zero, zero, and when you multiply zeros by any numbers at all and add them up, you just get zero again, which is also why that corner of light in the loft never moved. Now here’s a move that looks even simpler than tilting or stretching. Let’s slide the whole city one block east. Which four numbers in the box would do that?

None of them. Every point moved over by one, including the pin, which now sits at one, zero, and no two by two matrix can ever move the pin. So sliding isn’t a linear transformation.

Let’s put it back and try something sneakier. This rule wiggles every point sideways, and it leaves the pin alone. But the avenues have turned into snakes, and a linear transformation can never bend a straight street into a curve, so this one fails too. Let’s put both of these on the board. Then we’ll check them against the definition.

Here’s why the origin can never move. Put zero, zero into any matrix at all, and the two rows give you a times zero plus b times zero, and c times zero plus d times zero, which are both zero. The slide’s rule adds one to every x and leaves y alone, and it sends zero, zero to one, zero, so it fails the very first test.

The wiggle rule adds a little sine of y to every x, and leaves y alone. It sends zero, zero to zero, zero, so it passes the pin test. But sine of y isn’t a constant times y, so it isn’t a sum of constant multiples, and it bends the straight avenues.

This also clears up a confusing word. A linear function takes in a number, and a linear transformation takes in a vector. The function’s rule is m x plus b, and the transformation’s rule is A times v.

And at zero, the function gives you b, but the transformation always gives you zero. So three x plus two is linear in the algebra sense, because its graph is a line, but as a transformation it isn’t, because it sends zero to two. Only the ones with nothing added on, like three x, pass. Which one of these rules is a linear transformation?

One map, one matrix

So far, we’ve gone from a rule to a matrix. And it works the other way around too. You can go from any matrix to a rule. Any two by two matrix makes each output a sum of constant multiples of the inputs, so every matrix gives you a linear transformation. And any linear transformation has a rule like a x plus b y for the new x and c x plus d y for the new y, so its four constants make a matrix.

Better still, each transformation has exactly one matrix, and there’s a neat way to see why. Feed it the point one, zero, and out comes a, c, the first column of the matrix. Feed it zero, one, and out comes b, d, the second column. So the transformation itself decides every one of the four entries, and there’s no room for a second matrix.

The sun in our loft does exactly this. The light from one, zero stays at one, zero, and the light from zero, one lands at one, two, and those are the two columns of the sun’s matrix.

One more rule: the new x is x minus four y, and the new y is three x. The top row is one and negative four, and the bottom row is three and, careful, zero, because three x means three x plus zero y. Now you set the dials. Make every corner slide east by as many blocks as its street number, without moving anything north or south.

The whole block at once

Let’s put the city back. To a computer, a city like this is just a long list of corners, the corners of every building and every street, almost thirty thousand of them, each one a pair of numbers.

Let’s take just one block, the market, with its four corners numbered one to four. Each corner becomes a column, with x on top and y underneath, and we stand all four columns side by side in one wide matrix. That’s a two by four matrix, two rows because every point has two coordinates, and four columns because there are four corners.

Now we hit the whole thing with our matrix from before. One multiplication, and all four corners move at once, and then the rest of the city follows them. Let’s do that multiplication ourselves, on the board.

Here’s our block as a matrix P, with the corners as its columns, and here’s B, our matrix from before. To find B times P, we multiply B by each column in turn. The first corner, one, one, gives two times one, minus one, which is one, and one plus one, which is two.

The second corner, three, one, gives six minus one and three plus one, which is five, four. And the last two corners, three, two and then one, two, land at four, five and then zero, three. So B times P is this two by four matrix. And look at the third column, four, five. That’s exactly where we sent the cafe corner all by itself when we first tried this rule.

Multiplying by the wide matrix just does each column on its own and lines up the answers in the same order, so column one of the answer is where corner one went, and so on. The sizes tell the same story. A two by two times a two by four gives a two by four, four points in and four points out.

That’s why the corners go in as columns. Stacked as rows they’d make a four by two, and a two by two can’t multiply that from the left. Here are a triangle’s three corners, as the columns of P. Where does A send them?

Bend the city

So let’s do what I promised at the very beginning. Here’s the old park, a lopsided plot with slanted sides, with its corners numbered one to four. Its corners make this two by four matrix, and here’s a brand new matrix, C, with one and negative one on top, and one and one underneath.

Work out where the park’s four corners land, drag the four markers onto your answers, and then bend the city. Look at that. The whole city turned and grew around the pin, and every corner of the park landed exactly where the multiplication said it would.

So a linear transformation builds each new coordinate by adding up constant multiples of the old ones, and it never moves the origin. Its four constants make a matrix A, and the rule is just A times v, with v as a column. Every matrix gives you a linear transformation, and every linear transformation has exactly one matrix.

And to move a whole picture, line its points up as the columns of a two by n matrix. The answer’s columns are where they land. Next we’ll build the matrices that turn, flip and stretch things on purpose, and after that, this idea runs all through linear algebra and computer graphics, where one slightly bigger matrix can even do the slide that no two by two could.

So think about the next time you twist a map on your phone. You’ll know what it’s doing to every corner of the city. And now the four dials are yours. Pause whenever you like and bend the city any way you want.

Unit 4: Functions Involving Parameters, Vectors, and Matrices

  1. 4.1Parametric Functions
  2. 4.2Parametric Functions Modeling Planar Motion
  3. 4.3Parametric Functions and Rates of Change
  4. 4.4Parametrically Defined Circles and Lines
  5. 4.5Implicitly Defined Functions
  6. 4.6Conic Sections
  7. 4.7Parametrization of Implicitly Defined Functions
  8. 4.8Vectors
  9. 4.9Vector-Valued Functions
  10. 4.10Matrices
  11. 4.11The Inverse and Determinant of a Matrix
  12. 4.12Linear Transformations and Matrices
  13. 4.13Matrices as Functions
  14. 4.14Matrices Modeling Contexts