WEBVTT
00:00:00.720 --> 00:00:05.120
Hey everyone!
00:00:05.120 --> 00:00:18.040
Where we last left off, I showed what linear transformations look like and how to represent them using matrices.
00:00:18.280 --> 00:00:20.760
This is worth a quick recap because itโs just really important.
00:00:21.360 --> 00:00:25.040
But of course, if this feels like more than just a recap, go back and watch the full video.
00:00:25.920 --> 00:00:31.360
Technically speaking, linear transformations are functions, with vectors as inputs and vectors as outputs.
00:00:31.720 --> 00:00:41.120
But I showed last time how we can think about them visually as smooshing around space in such a way the grid lines stay parallel and evenly spaced and so that the origin remains fixed.
00:00:41.840 --> 00:00:51.280
The key takeaway was that a linear transformation is completely determined by where it takes the basis vectors of the space which, for two dimensions, means ๐-hat and ๐-hat.
00:00:52.200 --> 00:00:55.960
This is because any other vector can be described as a linear combination of those basis vectors.
00:00:56.240 --> 00:01:02.280
A vector with coordinates ๐ฅ, ๐ฆ is ๐ฅ times ๐-hat plus ๐ฆ times ๐-hat.
00:01:03.480 --> 00:01:09.960
After going through the transformation, this property, the grid lines remain parallel and evenly spaced, has a wonderful consequence.
00:01:10.560 --> 00:01:17.440
The place where your vector lands will be ๐ฅ times the transformed version of ๐-hat plus ๐ฆ times the transformed version of ๐-hat.
00:01:18.360 --> 00:01:32.640
This means if you keep a record of the coordinates where ๐-hat lands and the coordinates where ๐-hat lands, you can compute that a vector which starts at ๐ฅ, ๐ฆ must land on ๐ฅ times the new coordinates of ๐-hat plus ๐ฆ times the new coordinates of ๐-hat.
00:01:33.600 --> 00:01:45.400
The convention is to record the coordinates of where ๐-hat and ๐-hat land as the columns of a matrix and to define this sum of the scaled versions of those columns by ๐ฅ and ๐ฆ to be matrix-vector multiplication.
00:01:46.240 --> 00:01:49.800
In this way, a matrix represents a specific linear transformation.
00:01:50.240 --> 00:01:57.040
And multiplying a matrix by a vector is, what it means computationally, to apply that transformation to that vector.
00:01:58.760 --> 00:01:59.640
Alright, recap over.
00:02:00.040 --> 00:02:00.840
Onto the new stuff.
00:02:01.560 --> 00:02:06.920
Oftentimes, you find yourself wanting to describe the effect of applying one transformation and then another.
00:02:07.640 --> 00:02:14.480
For example, maybe you want to describe what happens when you first rotate the plane 90 degrees counterclockwise then apply a shear.
00:02:15.400 --> 00:02:21.680
The overall effect here, from start to finish, is another linear transformation, distinct from the rotation and the sheer.
00:02:22.480 --> 00:02:28.200
This new linear transformation is commonly called the โcompositionโ of the two separate transformations we applied.
00:02:28.960 --> 00:02:36.960
And like any linear transformation, it can be described with a matrix all of its own, by following ๐-hat and ๐-hat.
00:02:37.280 --> 00:02:41.760
In this example, the ultimate landing spot for ๐-hat after both transformations is one, one.
00:02:42.320 --> 00:02:44.200
So letโs make that the first column of a matrix.
00:02:44.880 --> 00:02:51.920
Likewise, ๐-hat ultimately ends up at the location negative one, zero, so we make that the second column of the matrix.
00:02:52.680 --> 00:03:01.320
This new matrix captures the overall effect of applying a rotation then a sheer, but as one single action, rather than two successive ones.
00:03:03.360 --> 00:03:19.840
Hereโs one way to think about that new matrix: if you were to take some vector and pump it through the rotation then the sheer, the long way to compute where it ends up is to, first, multiply it on the left by the rotation matrix; then, take whatever you get and multiply that on the left by the sheer matrix.
00:03:20.400 --> 00:03:26.000
This is, numerically speaking, what it means to apply a rotation then a sheer to a given vector.
00:03:26.880 --> 00:03:40.880
But whatever you get should be the same as just applying this new composition matrix that we just found, by that same vector, no matter what vector you chose, since this new matrix is supposed to capture the same overall effect as the rotation-then-sheer action.
00:03:42.520 --> 00:03:48.680
Based on how things are written down here, I think itโs reasonable to call this new matrix, the โproductโ of the original two matrices.
00:03:49.000 --> 00:03:49.360
Donโt you?
00:03:50.560 --> 00:03:56.640
We can think about how to compute that product more generally in just a moment, but itโs way too easy to get lost in the forest of numbers.
00:03:57.120 --> 00:04:04.240
Always remember that multiplying two matrices like this has the geometric meaning of applying one transformation then another.
00:04:06.240 --> 00:04:09.680
One thing thatโs kinda weird here is that this has reading from right to left.
00:04:10.000 --> 00:04:13.080
You first apply the transformation represented by the matrix on the right.
00:04:13.640 --> 00:04:16.680
Then, you apply the transformation represented by the matrix on the left.
00:04:17.480 --> 00:04:21.560
This stems from function notation, since we write functions on the left of variables.
00:04:21.840 --> 00:04:25.440
So every time you compose two functions, you always have to read it right to left.
00:04:26.040 --> 00:04:28.880
Good news for the Hebrew readers, bad news for the rest of us.
00:04:29.920 --> 00:04:31.040
Letโs look at another example.
00:04:31.760 --> 00:04:39.000
Take the matrix with columns one, one and negative two, zero, whose transformation looks like this, and letโs call it ๐ one.
00:04:40.080 --> 00:04:49.280
Next, take the matrix with columns zero, one and two, zero, whose transformation looks like this, and letโs call that guy ๐ two.
00:04:50.000 --> 00:04:54.200
The total effect of applying ๐ one then ๐ two gives us a new transformation.
00:04:54.600 --> 00:04:55.680
So letโs find its matrix.
00:04:56.240 --> 00:05:03.920
But this time, letโs see if we can do it without watching the animations and instead just using the numerical entries in each matrix.
00:05:04.720 --> 00:05:07.160
First, we need to figure out where ๐-hat goes.
00:05:08.040 --> 00:05:15.920
After applying ๐ one, the new coordinates of ๐-hat, by definition, are given by that first column of ๐ one, namely, one, one.
00:05:16.880 --> 00:05:23.360
To see what happens after applying ๐ two, multiply the matrix for ๐ two by that vector one, one.
00:05:25.560 --> 00:05:29.840
Working it out the way that I described last video, youโll get the vector two, one.
00:05:30.720 --> 00:05:33.160
This will be the first column of the composition matrix.
00:05:34.520 --> 00:05:40.520
Likewise, to follow ๐-hat, the second column of ๐ one tells us that it first lands on negative two, zero.
00:05:42.960 --> 00:05:55.240
Then, when we apply ๐ two to that vector, you can work out the matrix-vector product to get zero, negative two, which becomes the second column of our composition matrix.
00:05:57.000 --> 00:06:05.040
Let me talk to that same process again, but this time, Iโll show variable entries in each matrix, just to show that the same line of reasoning works for any matrices.
00:06:05.560 --> 00:06:13.600
This is more symbol heavy and will require some more room, but it should be pretty satisfying for anyone who has previously been taught matrix multiplication the more rote way.
00:06:14.560 --> 00:06:21.040
To follow where ๐-hat goes, start by looking at the first column of the matrix on the right, since this is where ๐-hat initially lands.
00:06:21.880 --> 00:06:30.320
Multiplying that column by the matrix on the left is how you can tell where the intermediate version of ๐-hat ends up after applying the second transformation.
00:06:31.680 --> 00:06:38.000
So, the first column of the composition matrix will always equal the left matrix times the first column of the right matrix.
00:06:42.360 --> 00:06:47.120
Likewise, ๐-hat will always initially land on the second column of the right matrix.
00:06:48.840 --> 00:06:53.680
So multiplying the left matrix by this second column will give its final location.
00:06:54.080 --> 00:06:57.000
And hence, thatโs the second column of the composition matrix.
00:07:00.680 --> 00:07:02.280
Notice, thereโs a lot of symbols here.
00:07:02.600 --> 00:07:08.640
And itโs common to be taught this formula as something to memorize along with a certain algorithmic process to kind of help remember it.
00:07:09.240 --> 00:07:18.840
But I really do think that before memorizing that process, you should get in the habit of thinking about what matrix multiplication really represents: applying one transformation after another.
00:07:19.640 --> 00:07:26.240
Trust me, this will give you a much better conceptual framework that makes the properties of matrix multiplication much easier to understand.
00:07:27.080 --> 00:07:32.680
For example, hereโs a question: does it matter what order we put the two matrices in when we multiply them?
00:07:33.920 --> 00:07:37.000
Well, letโs think through a simple example like the one from earlier.
00:07:37.640 --> 00:07:42.720
Take a shear which fixes ๐-hat and smooshes ๐-hat over to the right and a 90-degree rotation.
00:07:43.600 --> 00:07:50.880
If you first do the shear then rotate, we can see that ๐-hat ends up at zero, one and ๐-hat ends up at negative one, one.
00:07:51.320 --> 00:07:53.040
Both are generally pointing close together.
00:07:53.920 --> 00:08:03.280
If you first rotate then do the shear, ๐-hat ends up over at one, one and ๐-hat is off on a different direction at negative one, zero.
00:08:03.800 --> 00:08:05.440
And theyโre pointing, you know, farther apart.
00:08:06.360 --> 00:08:08.160
The overall effect here is clearly different.
00:08:08.480 --> 00:08:10.600
So, evidently, order totally does matter.
00:08:12.200 --> 00:08:17.760
Notice, by thinking in terms of transformations, thatโs the kind of thing that you can do in your head by visualizing.
00:08:18.240 --> 00:08:19.920
No matrix multiplication necessary.
00:08:21.800 --> 00:08:29.000
I remember when I first took linear algebra, thereโs this one homework problem that asked us to prove that matrix multiplication is associative.
00:08:29.680 --> 00:08:44.320
This means that if you have three matrices ๐ด, ๐ต and ๐ถ and you multiply them altogether, it shouldnโt matter if you first compute ๐ด times ๐ต then multiply the result by ๐ถ or if you first multiply ๐ต times ๐ถ then multiply that result by ๐ด on the left.
00:08:44.960 --> 00:08:47.560
In other words, it doesnโt matter where you put the parentheses.
00:08:48.360 --> 00:08:55.680
Now if you try to work through this numerically, like I did back then, itโs horrible, just horrible, and unenlightening for that matter.
00:08:56.320 --> 00:09:02.840
But when you think about matrix multiplication as applying one transformation after another, this property is just trivial.
00:09:03.360 --> 00:09:03.960
Can you see why?
00:09:04.960 --> 00:09:13.280
What itโs saying is that if you first apply ๐ถ then ๐ต then ๐ด, itโs the same as applying ๐ถ then ๐ต then ๐ด.
00:09:13.480 --> 00:09:18.680
I mean thereโs nothing to prove; youโre just applying the same three things one after the other all in the same order.
00:09:19.560 --> 00:09:20.600
This might feel like cheating.
00:09:20.880 --> 00:09:21.520
But itโs not!
00:09:21.960 --> 00:09:30.560
This is an honest-to-goodness proof that matrix multiplication is associative, and, even better than that, itโs a good explanation for why that property should be true.
00:09:31.800 --> 00:09:42.160
I really do encourage you to play around more with this idea: imagining two different transformations, thinking about what happens when you apply one after the other, and then working out the matrix product numerically.
00:09:42.600 --> 00:09:46.440
Trust me, this is the kind of playtime that really makes the idea sink in.
00:09:46.960 --> 00:09:51.840
In the next video, Iโll start talking about extending these ideas beyond just two dimensions.
00:09:51.840 --> 00:10:01.320
See you then!