# Linear transformations and matrices | Essence of linear algebra, chapter 3

Unfortunately, no one can be told, what the

Matrix is. You have to see it for yourself.

– Morpheus Surprisingly apt words on the importance of

understanding matrix operations visually 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 got to 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, i-hat and j-hat, each land. and everything else will follow from that. For example, consider the vector v with coordinates

(-1,2), meaning that it equals -1 times i-hat + 2

times j-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 v lands will be -1 times the

vector where i-hat landed plus 2 times the vector where j-hat landed. In other words, it started off as a certain

linear combination of i-hat and j-hat and it ends up is that same linear combination

of where those two vectors landed. This means you can deduce where v must go

based only on where i-hat and j-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 i-hat lands on the coordinates (1,-2). and j-hat lands on the x-axis over at the

coordinates (3, 0). This means that the vector represented by

(-1) i-hat + 2 times j-hat ends up at (-1) times the vector (1, -2) +

2 times the vector (3, 0). Adding that all together, you can deduce that

it has to land on the vector (5, 2). This is a good point to pause and ponder,

because it’s pretty important. Now, given that I’m actually showing you the full transformation, you could have just looked to see the v has

the coordinates (5, 2), 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 i-hat

and j-hat each land, without needing to watch the transformation

itself. Write the vector with more general coordinates

x and y, and it will land on x times the vector where

i-hat lands (1, -2), plus y times the vector where j-hat lands

(3, 0). Carrying out that sum, you see that it lands

at (1x+3y, -2x+0y). 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 i-hat lands and the two coordinates for where j-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 i-hat and j-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 a, b, c, d 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,

(a, c), as the place where the first basis vector

lands and that second column, (b, d), is the place

where the second basis vector lands. When we apply this transformation to some

vector (x, y), what do you get? Well, it’ll be x times (a, c) plus y times (b, d). Putting this together, you get a vector (ax+by,

cx+dy). 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° counterclockwise then i-hat lands on the coordinates (0, 1) and j-hat lands on the coordinates (-1, 0). So the matrix we end up with has columns

(0, 1), (-1, 0). To figure out what happens to any vector after

90° rotation, you could just multiply its coordinates by

this matrix. Here’s a fun transformation with a special

name, called a “shear”. In it, i-hat remains fixed so the first column of the matrix is (1, 0), but j-hat moves over to the coordinates (1,1) 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 want to go the other way around, starting with the matrix, say with columns

(1, 2) and (3, 1), 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 i-hat to (1, 2). Then, move j-hat to (3, 1). Always moving the rest of space in such a

way that keeps grid lines parallel and evenly

spaced. If the vectors that i-hat and j-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 on to 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 take-away 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 determinant, 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!

this is my fourth time watching this series and each time i'm blown away by something new that i missed.

So the [ [1 0] [0 1]] matrix is called identity matrix because the unit vectors are not moved at all!

WHAT WAS I DOING IN MY MATH CLASSES???

9:16 doesn't this transformation turn -ve numbers of x coordinate to RHS

why i only see this video after my exam????

shear = transformación de cizalladura en español.

This is what annoyed the shit out of me in high school and college. No one even questions why we're learning matrices and transformations. Everyone is just concerned with the formula and practicing problems with the formula. Why not teach students this amazing concept? Why not tell them here it comes from and why they're even being tested on it?

U are gonna win a Nobel prize of teaching

Can someone explain me how transformed i and j hat derived???

Thanks in advanced 😊😊

it's astounding why anyone goes to college anymore when this content is so much more well crafted. I'm currently taking my university's linear algebra course and just three videos have clarified more than the past month and a half of classes. I literally cannot believe what I'm paying for and I'm so grateful for the time we live in.

I love you

I wish I had tools and materials like this during my school and engineering.

Awesome animation and explanation, even the dumbest person on the planet would be able to understand it.

How awesome are these videos!!!! I am glad I came across them!!!

Grant Sanderson a big thank you for making these

I was waiting for this statement – "adding scaled version of the new basis vectors" and finally he did

Thank you for your video! It's AMAZING! I am taking a linear algebra class but sadly it is a memory and mechanical repeat class. Who needs that? I thank you for offering me the rational origin of all those great stuff. Thanks.

after years… thank you.

To be honest, I think those dislikes are from high school mathematics teachers.

To 3B1B: You just made me fall in love with mathematics, yet again!

Man are funking crazy…how do you do these so easily OMG..You should get an award. Making mathematics smooth as butter.

i love you bro

Incredible. I am a junior high school student and you've given me the ability to invent the 2D Rotation matrix (which already has existed for a while now). Thank you giving me

the foundationof basis vectors.🎩 🎩

I J

I thought I got it but now I’m totally lost (in the matrices). 😕

Gawd <3

Really JEE ruined such a beautiful topic

You saved my life.

The shade at 7:40 is so satisfying

2:55 , 3:15→ What is the formula of that transformation?

What program do you use for these nonlinear transformations?

I got the real awesome of matrix… Even completing the degree I felt intuitively I've missed something.. Thank you dude so much ❤😍❤

4:20 Can someone explain exactly what he did here? I don't follow at all. was this transformation just some arbritary one, or did it have a connection with the matrix [-1, 2]. I thought i-hat and j-hat always only had an x-component and y-component respectively that's equal to some number, and then the other component is just 0, so they're always parallel to the x- or y-axis, but now they're not? How come i-hat suddenly has a y-component and j-hat has an x-component? where did they come from? What's going on here?

All of 3Blue1Brown videos should be stored in case of a global apocalypse

God bless you

Wish I could give you two likes…the most imp thing to learn before going to learn linear algebra.

The rotations were cool

Can anybody tell me how this idea translates into higher dimensional spaces?

Am I… Learning?!?

Thank you.

this has completely blown my mind, I am overwhelmed ahahh, thank you so much for such a brilliant and deep explanation, you've cleared up so many questions I didnt even know I had.

I'm just wondering what is the geometrical (space) interpretation of non square matrices?

Grant, your videos are a delight to watch and are wonderfully insightful into the world of mathematics that has too often been ruined by poor, unoriginal, and disinterested teachers. I am a sophomore in college studying applied math and your videos are an absolute gift. Please continue what you're doing. I can't thank you enough.

Wow, this video just made linear algebra click for me. Well done.

is translation a linear transformation?

Imo this is the most important video of the whole series. Once you realise what a matrix is, linear algebra becomes a piece of cake for breakfast

Waow

That's awesome. Now I know why multiplying any vector with identity matrix equals itself. Great video.

When he told me to think about it, I thought about it for a while, and determined the following! A linear transformation will flip the basis vectors/space (such that i hat will now be "to the left of" j hat) iff the 2nd coordinate of i hat and the 1st one of j hat (that left-right bottom-top diagonal) are both strictly greater than at least one of the other 2 remaining coordinates (the right-left-top-bottom diagonal). You can even define a flip that way in case you get confused by the visual. Try it out with all the examples, and use it to explain to yourself why the shear example didn't result in a flip: it's because the 2nd coordinate of i hat ofc can't overtake the 1st one, since neither change and it was 0 (which is < 1) to begin with, and then it can't overtake the 2nd coordinate of j hat either so long as j hat stays within the positive (1st) quadrant, since that coordinate will just keep growing; and even if it goes to 0, it won't be strictly less than i-hat's 2nd coordinate until it goes into the 4th quadrant, at which point the basis vectors will flip in this example as long as the 1st coordinate of j hat stays positive (specifically, in this example, stays greater than the 2nd). Anyway, it's easier to just take the rule and apply it to the visuals yourself! And thinking about things yourself in this way instead of trying to interpret a wall of text is a much better way of internalizing these things. Anyway, this video series is the greatest thing ever!

ohhhhh Sir this is sooooooooo beautiful!!!!!!!!!

God Bless You God Bless You God Bless You

Is it possible to get a real grid as an educational toy? Or is it possible to make such a grid at all?

when Grant said "Then, you can make high-schoolers memorize it, and hide the most crucial part that makes it intuitive." i felt that

Math is powerful, but is heavy for me.

i love you

Dude, gotta say Im doin some transformations in quantum chemistry and you are just making everything beautiful! We can feel u are doing this because u love it. And we love you for that!

Peace!

Just Waaao! You made me realize, how beautiful math is. Thanks a lot.

An amazing… Explanation ….of mathematical concepts….🙏🙏🙏

8:15

should the vectors rotate independently of plane? what dictates coordinates for rotated i-hat, j-hat unit vectors?

I think this video will change the way I see these problems forever.

想要用 3Blue1Brown 風格動畫來了解線性變換跟神經網路之間關係的人可以參考：

「給所有人的深度學習入門：直觀理解神經網路與線性代數」

https://leemeng.tw/deep-learning-for-everyone-understand-neural-net-and-linear-algebra.html

I wish I studied this in school..and immensely thankful that I found this channel..just helped me think

I know how to solve linear equation systems using matrices, but I never knew what that actually hast to do with vectors and coordinate systems. Now i just realized that solving a linear equation system is basically just searching the inital vector, given the transformation of space and where the inital vector landed after the transformation. That really revolutionised my view on mathematic.

After decades from the video revolution, now we finally encountered the start of 'real' video education revolution.

So rather than bang our heads on our desks for a couple of months in high school because they insisted on teaching us matrices purely from a mathematical perspective, our teachers could have shown us the beauty of using matrices in the first place, thereby having given us a conceptual basis (and interest) in working with the figures in the matrices. It all seemed so arcane and arbitrary back then; but here it all seems so obvious. We could have learned mathematics so much better and faster with more visuals, more concrete examples. I took Physics 1 and Calculus A and B simultaneously and it made all the difference in the world for both classes. I kept getting hung up on the BS way we were introduced to the Fundamental Theorem of Calculus, because it was obviously not a real proof, but that's another issue. XD

oh

thanks god i found this

men who explain what is math

Please say that this is used to tell the curvature of space time in GENERAL RELATIVITY

Hi and thx for the brilliant videos. Should we understand that any linear transformation in the 2D plane can be described as composed of shears and rotations about the origin only ?

JPP

Very nice and helpful u make this very interesting which gives me a imagination of mathematical problem i use this to solve maths problems

I am halfway through the semester in Linear Algebra, and I have been spending hours upon hours studying linear algebra out of my text book. I felt like I must be studying the wrong things, because I got my first test back and I failed (which has never happened to me in a math class ever)… After watching a few of his videos, I totally get why I failed the test, I couldn’t conceptualize what these numbers were telling me at all even though I was doing computing the numbers correctly on the homework.

I’m at university and my teacher has failed to ever really present a graph in lecture. I don’t understand why, this is such an important part to understanding this shit…

Especially linear transformations!! This made it seem so much easier to understand! Even my textbook said “linear transformations are hard for most students to conceptualize”. Well thanks!! I bought a few hundred dollar book and this

freeYouTube video cleared my confusion!Thank you soooo much for what you do!

Wow thanks. İ can understand now lorentz transform and special relativity.

this was so beautiful. I always struggle to visualise these things and now I know why. Im never given a chance to fully appreciate the beauty of these concepts

Is it my video game mind, or is that how moving a character in a 3d game is done.

It looks like you are looking at the plane from a different location.

Bruh

3Blue1Brown: "you can make high schoolers memorize this…"

.

.

me, studying for my master degree in engineering:

*looks away in shame*what is the engine/library used to make these effects

Merci <3

I can not express my gratitude for your explanation! I have never seen a person with such a fine sense for visualizing math and teaching it to others.

After watching this great video which makes me angry at my math teacher, a few questions come up: if we can represent the transformation of a plane using a square matrix of size 2, what would a matrix of unequal sides (2 by 3, 4 by 1, 5 by 3, …) represent in terms of the transformation of a plane? Would adding more columns mean adding more dimensions? What would adding more rows mean?

When I learn new mathematical concepts I do try to visualize them in my head, but that can get really difficult when you have not already seen the visualization beforehand. To see these visualizations empowers my own visualizations. Thank you!

I've never understood linear transformations like this

the clouds parted and the entire world is now clear and beautiful

got my algebra final tomorrow… wish me luck

im way too high to understand this, these visuals are doing the tings

You make stuff so easy and i feel myselve geant. Thank you soooomuch

Cancer has been cured after watching this video

Thank you for all you’ve done. You might not know it but you just save my life.

Thanks buddy you made me enthusiastic of maths…

This must be my favorite youtube channel. Finally a clear visual explanation of why [1 0 0 1] is the identity matrix.

Probably stupid question. But: on 2:01 he is transforming space, however before he was transforming vectors on this space? How this happened? I didn’t understand the explanation “for the convenience of it”, can someone help?)

Can I find somewhere that piano intro? I feel I could just listen to that simple melody all day and meditate.

I love that you put a summary at the end, thanks!

engineering-and-science.com/tensor-calculus.html

the moment i understood 5:13 i felt like a genius. thank you

Thank you so mutch!!

I love you

why there are dislikes on this video? In the scale of the American talents show this channel deserves a golden button!

4:18 I don't understand how the transformation works. Did I miss the formula? I mean, sure, you can understand where v ends up based on i and j, but what actually happened there? Nothing more detailed as "some transformation"?

SIR! You have just changed my life! I am studying computer science and have always struggled a bit with linear algebra because it felt too theoretical to me and I was never able to grasp the concept logically. It was all memorization.

Now, finally, for the first time I truly understand what it all mean! Bless your heart for taking the time to safe this poor confused student and making them love math again!

the quote at the beginning gave me a chuckle

5:14 It confused me at first because it was not intuitive that multiplication is used.

I really hope this eventually gets into angles and vector length. I have a feeling it's not going to though 😔

You saved my life. Thank you

You are amazing! Thank you for sharing all this knowledge in such a simple and comprehensive language!

How do you get to do those animations on planes for understanding?

Thank you for this explanation. I was one of those poor saps who got through linear algebra by just memorizing the formulas. This video makes understanding linear transformations easier to grasp especially with all of these visuals. I will try applying this mentality while I implement Principal Component Analysis for my machine learning project. I especially liked the comment where you said that it is more fun to think of the transformation matrix columns as the transformed basis vectors and the output of the transformation as linear combinations of those transformed basis vectors.

So after transformation, one rhombus contains a total of 6 squares.

No matter how much other people are praising you, i still didn't understand anything.