Video: Linear Transformations and Matrices

Grant Sanderson • 3Blue1Brown • Boclips

Linear Transformations and Matrices

10:58

Video Transcript

Hey everyone! If I had to choose just one topic that makes all of the others in linear algebra start to click and which too often goes unlearned the first time a student takes linear algebra, it would be this one: the idea of a linear transformation and its relation to matrices.

For this video, I’m just going to focus on what these transformations look like in the case of two dimensions and how they relate to the idea of matrix-vector multiplication. In particular, I want to show you a way to think about matrix-vector multiplication that doesn’t rely on memorization. To start, let’s just parse this term “linear transformation”. “Transformation” is essentially a fancy word for “function”. It’s something that takes in inputs and spits out an output for each one.

Specifically in the context of linear algebra, we like to think about transformations that take in some vector and spit out another vector. So why use the word “transformation” instead of “function” if they mean the same thing? Well, it’s to be suggestive of a certain way to visualize this input-output relation. You see, a great way to understand functions of vectors is to use movement. If a transformation takes some input vector to some output vector, we imagine that input vector moving over to the output vector. Then to understand the transformation as a whole, we might imagine watching every possible input vector move over to its corresponding output vector.

It gets really crowded to think about all of the vectors all at once, each one is an arrow. So, as I mentioned last video, a nice trick is to conceptualize each vector, not as an arrow, but as a single point: the point where its tip sits. That way to think about a transformation taking every possible input vector to some output vector, we watch every point in space moving to some other point. In the case of transformations in two dimensions, to get a better feel for the whole “shape” of the transformation, I like to do this with all of the points on an infinite grid. I also sometimes like to keep a copy of the grid in the background, just to help keep track of where everything ends up relative to where it starts.

The effect for various transformations, moving around all of the points in space, is, you’ve gotta admit, beautiful. It gives the feeling of squishing and morphing space itself. As you can imagine, though arbitrary transformations can look pretty complicated, but luckily linear algebra limits itself to a special type of transformation, ones that are easier to understand, called “linear” transformations. Visually speaking, a transformation is linear if it has two properties: all lines must remain lines, without getting curved, and the origin must remain fixed in place.

For example, this right here would not be a linear transformation since the lines get all curvy. And this one right here, although it keeps the line straight, is not a linear transformation because it moves the origin. This one here fixes the origin and it might look like it keeps line straight, but that’s just because I’m only showing the horizontal and vertical grid lines. When you see what it does to a diagonal line, it becomes clear that it’s not at all linear since it turns that line all curvy.

In general, you should think of linear transformations as keeping grid lines parallel and evenly spaced. Some linear transformations are simple to think about, like rotations about the origin. Others are a little trickier to describe with words. So how do you think you could describe these transformations numerically? If you were, say, programming some animations to make a video teaching the topic, what formula do you give the computer so that if you give it the coordinates of a vector, it can give you the coordinates of where that vector lands? It turns out that you only need to record where the two basis vectors, 𝑖-hat and 𝑗-hat, each land. and everything else will follow from that.

For example, consider the vector 𝐯 with coordinates negative one, two, meaning that it equals negative one times 𝑖-hat plus two times 𝑗-hat. If we play some transformation and follow where all three of these vectors go, the property that grid lines remain parallel and evenly spaced has a really important consequence: the place where 𝐯 lands will be negative one times the vector where 𝑖-hat landed plus two times the vector where 𝑗-hat landed. In other words, it started off as a certain linear combination of 𝑖-hat and 𝑗-hat, and it ends up is that same linear combination of where those two vectors landed. This means you can deduce where 𝐯 must go based only on where 𝑖-hat and 𝑗-hat each land. This is why I like keeping a copy of the original grid in the background; for the transformation shown here, we can read off that 𝑖-hat lands on the coordinates one, negative two and 𝑗-hat lands on the 𝑥-axis over at the coordinates three, zero. This means that the vector represented by negative one 𝑖-hat plus two times 𝑗-hat ends up at negative one times the vector one, negative two plus two times the vector three, zero. Adding that all together, you can deduce that it has to land on the vector five, two.

This is a good point to pause and ponder cause it’s pretty important. Now, given that I’m actually showing you the full transformation, you could have just looked to see the 𝐯 has the coordinates five, two. But the cool part here is that this gives us a technique to deduce where any vectors land, so long as we have a record of where 𝑖-hat and 𝑗-hat each land, without needing to watch the transformation itself. Write the vector with more general coordinates 𝑥 and 𝑦, and it will land on 𝑥 times the vector where 𝑖-hat lands — one, negative two — plus 𝑦 times the vector where 𝑗-hat lands — three, zero. Carrying out that sum, you see that it lands at one 𝑥 plus three 𝑦, negative two 𝑥 plus zero 𝑦. I give you any vector, and you can tell me where that vector lands using this formula.

What all of this is saying is that a two-dimensional linear transformation is completely described by just four numbers: the two coordinates for where 𝑖-hat lands and the two coordinates for where 𝑗-hat lands. Isn’t that cool?! It’s common to package these coordinates into a two-by-two grid of numbers, called a two-by-two matrix, where you can interpret the columns as the two special vectors where 𝑖-hat and 𝑗-hat each land. If you’re given a two-by-two matrix describing a linear transformation and some specific vector and you want to know where that linear transformation takes that vector, you can take the coordinates of the vector multiply them by the corresponding columns of the matrix, then add together what you get. This corresponds with the idea of adding the scaled versions of our new basis vectors.

Let’s see what this looks like in the most general case, where your matrix has entries 𝑎, 𝑏, 𝑐, 𝑑. And remember, this matrix is just a way of packaging the information needed to describe a linear transformation. Always remember to interpret that first column — 𝑎, 𝑐 — as the place where the first basis vector lands and that second column — 𝑏, 𝑑 — as the place where the second basis vector lands. When we apply this transformation to some vector — 𝑥, 𝑦 — what do you get? Well, it’ll be 𝑥 times 𝑎, 𝑐 plus 𝑦 times 𝑏, 𝑑. Putting this together, you get a vector 𝑎𝑥 plus 𝑏𝑦, 𝑐𝑥 plus 𝑑𝑦. You can even define this as matrix-vector multiplication when you put the matrix on the left of the vector like it’s a function. Then, you could make high schoolers memorize this, without showing them the crucial part that makes it feel intuitive. But, isn’t it more fun to think about these columns as the transformed versions of your basis vectors and to think about the results as the appropriate linear combination of those vectors?

Let’s practice describing a few linear transformations with matrices. For example, if we rotate all of space 90 degrees counterclockwise then 𝑖-hat lands on the coordinates zero, one. and 𝑗-hat lands on the coordinates negative, zero. So the matrix we end up with has columns zero, one; negative one, zero. To figure out what happens to any vector after a 90-degree rotation, you could just multiply its coordinates by this matrix.

Here’s a fun transformation with a special name, called a “shear”. In it, 𝑖-hat remains fixed so the first column of the matrix is one, zero, but 𝑗-hat moves over to the coordinates one, one, which become the second column of the matrix. And, at the risk of being redundant here, figuring out how a shear transforms a given vector comes down to multiplying this matrix by that vector.

Let’s say we wanna go the other way around, starting with the matrix, say, with columns one, two and three, one. and we want to deduce what its transformation looks like. Pause and take a moment to see if you can imagine it. One way to do this is to first move 𝑖-hat to one, two. Then, move 𝑗-hat to three, one. Always moving the rest of space in such a way that keeps grid lines parallel and evenly spaced. If the vectors that 𝑖-hat and 𝑗-hat land on are linearly dependent which, if you recall from last video, means that one is a scaled version of the other, it means that the linear transformation squishes all of 2D space onto the line where those two vectors sit, also known as the one-dimensional span of those two linearly dependent vectors.

To sum up, linear transformations are a way to move around space such that the grid lines remain parallel and evenly spaced and such that the origin remains fixed. Delightfully, these transformations can be described using only a handful of numbers. The coordinates of where each basis vector lands. Matrices give us a language to describe these transformations where the columns represent those coordinates and matrix-vector multiplication is just a way to compute what that transformation does to a given vector.

The important takeaway here is that, every time you see a matrix, you can interpret it as a certain transformation of space. Once you really digest this idea, you’re in a great position to understand linear algebra deeply. Almost all of the topics coming up, from matrix multiplication to determinants, change of basis, eigenvalues, all of these will become easier to understand once you start thinking about matrices as transformations of space. Most immediately, in the next video, I’ll be talking about multiplying two matrices together. See you then!

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.