Lecture 13 · Week 4· 19:25

Linear transformations of Rn

Linearity, standard matrix, rotations, shears, projections, reflections.

Play: Lecture 13: Linear transformations of Rn
Lecture · 19:25 · Open on YouTube · Report a problem with this video
TranscriptThe full text of the lecture. Click any sentence to play the video from there.

Today: linear transformations

Welcome back. Last time, we defined the product of a matrix and a vector, and we proved that it is linear: A, times u plus v, is A u plus A v, and A, times c u, is c times A u. Today we change our point of view. Instead of a table of numbers, we think of a matrix as a machine. A vector goes in, and a new vector comes out. Watch what this matrix does to the whole plane. Every point moves. Yet straight lines stay straight, parallel lines stay parallel, and the origin stays where it is.

Maps of this kind are called linear transformations. Today we define them, we prove that every one of them is given by a matrix, and we find the matrices of the basic moves of the plane: rotations, shears, projections, and reflections.

Transformations and linearity

First, some words. A function T from F n to F m is a rule that assigns to each vector x in F n exactly one vector, T of x, in F m. F n is called the domain of T, and F m is called the codomain. The vector T of x is called the image of x under T. We also call T a transformation, or a map. For example, a matrix A with m rows and n columns gives a transformation: it sends each x in F n to A x in F m. We call it T sub A.

Here is the main definition. A transformation T from F n to F m is linear if two rules hold. First, T of u plus v equals T of u plus T of v, for all u and v in F n. Second, T of c u equals c times T of u, for every u in F n and every scalar c. In words: adding first and then transforming gives the same result as transforming first and then adding. And the same holds for scaling. A picture makes this concrete. Take two vectors u and v, and their sum, the diagonal of the parallelogram they span. A linear transformation carries the parallelogram to a new parallelogram, so the image of the sum is the sum of the images.

By the theorem of the last lecture, every matrix transformation T sub A is linear. This is our first source of examples. Soon we will see that it is the only one.

First consequences

Two consequences follow straight from the definition. First, a linear transformation sends the zero vector to the zero vector. The proof is one line. The zero vector of F n is zero times itself. So T of zero equals T of zero times zero, which by the scaling rule is zero times T of zero. And zero times any vector is the zero vector of F m. Second, a linear transformation respects every linear combination: T of c one v one, plus and so on, up to c k v k, equals c one T of v one, plus and so on, up to c k T of v k.

For two vectors, apply the addition rule, and then the scaling rule to each term. For more vectors, repeat the same step, one vector at a time. This is what makes linear transformations so manageable. Once we know what T does to a few vectors, we know what it does to every combination of them.

Linear or not?

Let's test the definition on an example. Let T send the vector with entries x one and x two to the vector with entries x one plus two x two, and three x one. Take u with entries u one and u two, and v with entries v one and v two. Then u plus v has entries u one plus v one, and u two plus v two. So the first entry of T of u plus v is u one plus v one, plus two times u two plus v two. Regrouping, that is u one plus two u two, plus v one plus two v two: the first entry of T of u, plus the first entry of T of v.

In the second entry, three times u one plus v one is three u one plus three v one: again the second entry of T of u, plus that of T of v. So the addition rule holds. For scaling, T of c u has entries c u one plus two c u two, and three c u one. Taking c out of each entry gives c times T of u. So T is linear. Now two maps that are not linear. First, a translation: T of x equals x plus the vector (one, zero). It moves every point one step to the right.

It sends zero to the vector (one, zero), not to zero. A linear transformation must send zero to zero, so this translation is not linear. Second, let S square the first entry: S sends x one and x two to x one squared and x two. This map does send zero to zero, so we need a different test. Take u equal to (one, zero), and c equal to two. Then S of two u is S of the vector (two, zero), which is the vector (four, zero). But two times S of u is two times the vector (one, zero), which is the vector (two, zero). The scaling rule fails, so S is not linear.

One counterexample is enough to show that a map is not linear. To show that a map is linear, we must check the rules for all vectors, as we did for T.

The standard matrix

Now the central question of today. Every matrix gives a linear transformation. Does every linear transformation come from a matrix? The key is a special list of vectors. The standard basis vectors of F n are e one, e two, up to e n. The vector e j has a one in position j, and zeros everywhere else. In the plane, e one is (one, zero), one step along the first axis, and e two is (zero, one), one step along the second axis.

Every vector is a combination of them, with its own entries as weights. For example, (three, two) is three e one plus two e two. In general, x equals x one e one, plus and so on, up to x n e n. Here is the theorem. Let T be a linear transformation from F n to F m. Then there is exactly one m by n matrix A with T of x equal to A x for every x in F n. Its columns are T of e one, T of e two, up to T of e n. This matrix is called the standard matrix of T. The proof is short, but it carries the main idea of the lecture, so take it slowly, and feel free to pause or rewatch it.

Write x as x one e one, plus and so on, up to x n e n. Since T respects linear combinations, T of x equals x one T of e one, plus and so on, up to x n T of e n. Now let A be the matrix whose columns are T of e one up to T of e n. By the definition of the matrix vector product, that same combination is exactly A x. So T of x equals A x. For uniqueness, suppose that B x equals T of x for every x as well. Then B e j equals T of e j. In the last lecture we saw that B e j is column j of B. So B has the same columns as A, and B equals A.

In pictures: a linear transformation is completely decided by where it sends e one and e two. The whole grid follows them, with every grid line going to a line, evenly spaced, through their new positions.

Finding a standard matrix

Let's find the standard matrix of the map T from before, which sends x one and x two to x one plus two x two, and three x one. First, T of e one. We put x one equal to one, and x two equal to zero. The first entry is one plus two times zero, which is one, and the second is three times one, which is three. So T of e one is (one, three). Next, T of e two. We put x one equal to zero, and x two equal to one. The first entry is zero plus two times one, which is two, and the second is three times zero, which is zero. So T of e two is (two, zero).

These are the columns. So the standard matrix of T has rows (one, two) and (three, zero). Let's check with the row rule. The first row, times x, gives x one plus two x two. The second row gives three x one plus zero x two, which is three x one. That is T of x, as it should be. And here is T in action. The first column shows where e one lands, the second column shows where e two lands, and the whole grid follows.

Rotations

Now the moves of the plane, starting with rotations. Let R be the rotation of R two about the origin, counterclockwise, through an angle theta. To find a formula, describe a point by its distance r from the origin, and by its angle alpha from the first axis. Its coordinates are x equals r cosine alpha, and y equals r sine alpha. Rotating through theta keeps the distance r, and adds theta to the angle. So the image of the point is r cosine of alpha plus theta, and r sine of alpha plus theta.

Now we use the angle addition formulas from trigonometry. Cosine of alpha plus theta is cosine alpha cosine theta, minus sine alpha sine theta. And sine of alpha plus theta is sine alpha cosine theta, plus cosine alpha sine theta. Multiplying by r, and replacing r cosine alpha by x, and r sine alpha by y, the image is x cosine theta minus y sine theta, and x sine theta plus y cosine theta. This is a matrix times the vector (x, y): the matrix with rows (cosine theta, minus sine theta) and (sine theta, cosine theta). So the rotation is a matrix transformation, and therefore it is linear.

The columns tell the same story. Rotating e one through theta gives (cosine theta, sine theta), a point on the unit circle. Rotating e two gives (minus sine theta, cosine theta), a quarter turn further on. For example, take a quarter turn, theta equal to ninety degrees. Cosine of ninety degrees is zero, and sine of ninety degrees is one, so the matrix has rows (zero, minus one) and (one, zero). It sends (two, one) to (minus one, two). In the first row, zero times two, plus minus one times one, is minus one. In the second row, one times two, plus zero times one, is two.

And in the plane, that is what a quarter turn should do: the arrow to (two, one) swings round to the arrow to (minus one, two), at a right angle to where it started.

Scalings and shears

Next, maps that stretch. The matrix with rows (k, zero), and (zero, k), sends every x to k x. For k greater than one, it stretches the plane away from the origin, and for k between zero and one, it shrinks it. More generally, the matrix with rows (a, zero), and (zero, d), stretches by a factor of a along the first axis, and by a factor of d along the second. Here a is two and d is one half: the plane gets wider, and flatter. A shear is different. The shear with rows (one, k), and (zero, one), keeps e one where it is, and sends e two to (k, one).

Its formula is: x goes to x plus k y, and y stays the same. So each point slides sideways, by k times its height. Points on the first axis do not move at all, and points higher up slide further. Each square of the grid becomes a parallelogram with the same base and the same height. Think of a deck of cards pushed sideways: every card slides, but no card changes its shape. So a shear keeps every area unchanged. Measuring how a matrix changes area will lead us to the determinant, in lecture thirty three.

Projections

Now projections. Let L be a line through the origin, in the direction of a unit vector u. The projection onto L sends each vector x to the point of L closest to x: the foot of the perpendicular from x to L. That point lies on L, so it is t u for some number t. And the difference, x minus t u, must be orthogonal to u. So its dot product with u is zero. Expanding, x dot u, minus t times u dot u, equals zero. Since u is a unit vector, u dot u is one. So t equals x dot u.

So the projection is P of x equals x dot u, times u. And it is linear, because the dot product respects addition and scaling: x plus y, dotted with u, is x dot u plus y dot u, and c x dotted with u is c times x dot u. Its standard matrix comes from its columns. P of e one is u one times u, and P of e two is u two times u. So the matrix has rows (u one squared, u one u two) and (u one u two, u two squared). For the first axis, u is e one, and the matrix has rows (one, zero) and (zero, zero): it keeps the first entry, and replaces the second by zero.

Let's go back to our picture, now with actual values. The line L is y equals x, so its unit direction is u equal to the vector (one over the square root of two, one over the square root of two). And x is the vector (three, one). Where does its projection land? Both entries of u are one over the square root of two. So each product of two entries is one half, and every entry of the matrix is one half. Let's project (three, one). In each row, one half times three, plus one half times one, is two. So the projection is (two, two). And indeed, the difference (one, minus one) is orthogonal to the line.

A projection flattens the whole plane onto the line. Many points land on the same point, so a projection can never be undone. We will see what this means for its matrix in lecture sixteen.

Reflections

Finally, reflections. The reflection across L sends each vector x to its mirror image on the other side of L. Where does the mirror image land? To find out, let's split x into two pieces. The first piece is P of x, the part of x along the line. The second piece is x minus P of x. It goes from the line straight to x, at a right angle to the line. Together, the two pieces make x: x equals P of x, plus x minus P of x.

Now reflect across L. The mirror is the line itself, so the piece along the line stays exactly where it is. The piece at a right angle flips to the other side of the line: same length, opposite direction. So the mirror image is P of x, minus the second piece. That is, Q of x equals P of x, minus the bracket x minus P of x. Opening the bracket gives P of x minus x, plus P of x. The two copies of P of x add up to two P of x. So Q of x equals two P of x, minus x.

In the picture: from x, we walk to P of x, and then take the same step again. That is why P of x lies exactly halfway between x and its mirror image. Q is linear too. Since P is linear, two P of u plus v, minus u plus v, splits into two P of u minus u, plus two P of v minus v, which is Q of u plus Q of v. Scaling works in the same way. For the line y equals x, Q of e one is two times (one half, one half), minus (one, zero). In the first coordinate, one minus one is zero, and in the second, one minus zero is one. So Q of e one is (zero, one).

In the same way, Q of e two is two times (one half, one half), minus (zero, one), which is the vector (one, zero). So the reflection across y equals x has rows (zero, one) and (one, zero). It swaps the two entries: (three, one), goes to (one, three). Back to our picture, with actual values. x is the vector (three, one), and its projection is the point (two, two). So Q of x is two times the vector (two, two), minus the vector (three, one), which is the vector (one, three): the mirror image of x, on the other side of the line y equals x. And the reflection across the first axis has rows (one, zero) and (zero, minus one): it keeps the first entry, and changes the sign of the second.

A reflection flips the plane over. Going counterclockwise, e one comes before e two. After the reflection, their images come in the opposite order, which no rotation can do. This too will show up in the determinant.

Try it yourself

You can try all of this yourself. On this lecture's page at Open Semester dot com, there is a figure in which a matrix moves the whole grid. Drag the tip of e one. The first column of the matrix follows it, and the grid follows too. Now drag e two. That changes the second column, and nothing else.

The buttons give the moves of today. A rotation. A shear. A stretch. And a reflection. And the last button puts both columns on one line. Then the whole plane collapses onto that line, just as it does under a projection. Try your own matrices, and before each one, guess what the grid will do.

Summary

Let's summarise. A transformation T from F n to F m is linear when it respects addition and scaling. Then it sends zero to zero, and it respects every linear combination. Every matrix gives a linear transformation, and every linear transformation is given by exactly one matrix: its standard matrix, whose columns are T of e one, up to T of e n. In the plane, this gives the matrices of the basic moves: rotations, scalings, shears, projections, and reflections. Each one is found from where e one and e two land.

Before the next lecture, read section three point two of the course book, try the problems on linear transformations on sheet four, and do the lecture check on this lecture's page at Open Semester dot com. Next time, we apply two transformations one after the other, and discover that this is exactly matrix multiplication. See you there.

In this lecture

  1. 0:00Today: linear transformations
  2. 0:52Transformations and linearity
  3. 2:22First consequences
  4. 3:21Linear or not?
  5. 5:36The standard matrix
  6. 7:48Finding a standard matrix
  7. 9:02Rotations
  8. 11:13Scalings and shears
  9. 12:29Projections
  10. 14:43Reflections
  11. 17:35Try it yourself
  12. 18:14Summary

Materials

Try it

A matrix moves the whole grid

Drag the tips of e₁ and e₂, use the sliders, or pick an example. The first column of A is where e₁ lands, the second is where e₂ lands; the shaded square shows how areas scale.

Check yourself

3 questions, from warm-up to stretch

Work each one out on paper, type your answer and press Check. Stuck? Open a hint; the worked solution is there when you need it.

  1. Question 1 of 3 Warm-up

    A linear transformation sends to and to . Compute .

    Hint 1 of 2

    Write . A linear transformation respects linear combinations (Proposition 3.2.3).

    Hint 2 of 2

    . Scale each vector, then add entry by entry.

    Worked solution
    1. , and respects linear combinations, so .
    2. .
    3. The same with the standard matrix and the row rule: and .
  2. Question 2 of 3 Core

    Let and . Is linear? The standard matrix of has how many columns, and what are its entries and ?

    Is linear?
    Hint 1 of 2

    A linear transformation sends to (Proposition 3.2.3). Where does send ? For : the columns of are , , (Theorem 3.2.7).

    Hint 2 of 2

    is the third column. Compute and in the same way.

    Worked solution
    1. , so is not linear (Proposition 3.2.3): it is a translation, as in Example 3.2.5.
    2. goes from to , so is : three columns, , , .
    3. , , , so .
    4. So and . Check with the row rule: .
  3. Question 3 of 3 Stretch

    Let be the line through the origin in the direction of , and let . Compute the projection onto and the reflection across . Fractions such as 9/5 are fine.

    Hint 1 of 2

    The formula needs a unit vector (Proposition 3.2.12). The length of is , so .

    Hint 2 of 2

    , so . Then (Proposition 3.2.14).

    Worked solution
    1. , so the unit direction is .
    2. , so .
    3. .
    4. Check: and , so it is orthogonal to . And : a reflection keeps lengths.

Found a mistake, or something not working on this page? Report it and we'll fix it. See what we've corrected.