If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains ***.kastatic.org** and ***.kasandbox.org** are unblocked.

Main content

Current time:0:00Total duration:16:40

in the last video we saw that if we had some line that was defined as all of the scalar multiples of some vector or I'll just write it like this where the scalar multiples obviously are any real number then we defined a transformation and I didn't speak of it much in terms of transformations but it was a transformation we defined a projection onto that line L as a transformation and the video we drew it as transformations within R 2 but it could be in general a transformation from RN to RN and we defined it as the projection the projection of X onto L was equal to the dot product of X with this defining vector X dot this defining vector defined divided by that defining vector dotted with itself that defining vector dotted with itself all of that times the defining vector of the line this was our definition now a couple of things might have popped out at you right when we first saw this this when you dot a vector with itself what's that equal to we know that if I take some vector we know if I take some vector and i dot it with itself that is equivalent to the length of the vector the length of the vector squared so we could rewrite this as being equal to X dot V over the length of V the length of V squared all of that times V now wouldn't it be nice if the length of V was 1 if the length of V was equal to 1 because then if V was if the length of V was 1 or this is another way of saying that V is a unit vector then our formula for our projection would just simplify to X dot V all of that times this will just be some scalar number that times V you're saying hey Sal how can we just you know how do we know if this is unit vector or not and what all what you can realize is that any you know let me draw it this way so when I drew it in the previous video I just picked a line like that and the line can be really defined this vector V in the line can be any of the vectors that's contained in the line so the vector V could be like that so let's say someone gives you a vector V that isn't a unit vector so let's say that the length of V is not equal to 1 how can you can define a line using some unit vector well you can just normalize V so you can define some unit vector right here you could some define some vector right there let's call it U and let's say it's a unit vector and let's just say that that is equal to 1 over 1 over the length of V times V I showed you this in the unit vector video you can construct a unit vector that goes in the same direction as any vector essentially just by dividing or I guess multiplying that vector times 1 over its length so in general we can just always redefine the line write all of the possible scalar multiples of V are going to be the same thing as all of the scalar multiples of our unit vector U which is just a scalar multiple of V right so we can redefine our line if we redefine our line L as being equal to all of the possible scalar multiples of our unit vector where the scalars are any members of the real numbers then our projection definition simplifies a good bit the projection of X onto L then just becomes X dot our unit vector times the unit vector times the unit vector itself and so you can imagine a world let's I mean that that that case that I did in the previous video where I had those two vectors where I said the vector V that defined the line I think it was the vector 2 to 1 and our vector X was equal to 3 it was equal to 2 3 2 3 if you want to do this definition we just have to turn this guy into a unit vector first and the way you do it in two way you turn them into a unit vector is you just to figure out the magnitude so in this case the magnitude of V is equal to what 2 squared plus 1 squared is 1 you type times the square root or you take the square root of that let me just write it equal to the square root of 2 squared plus 1 squared which is equal to the square root of 5 and so you can define your you your you your unit vector could just be 1 over this times that guy so it's 1 over the square root of 5 times 2 1 and you could multiply it out or not you can just leave it in this form but you can always for any vector V you can always find a unit vector that goes in the same direction assuming that we're dealing with nonzero vectors so you can always reduce anything like this to some other definition like this where this is the unit vector version of your vector V up there now I just said that look this is a transformation from RN to RN the one thing that we're not sure of just yet is is this a little near transformation and I said we can always write it like this so let's see if this is always going to be a linear transformation so there's two conditions for it to be a linear transformation transformation the first is is that the transformation so let's see what happens if I take the projection let's see what I take what happens if I take the projection onto L of two vectors let's say the vector a plus the vector V if I take the sum of their vectors if this is a linear transformation this should be equivalent to taking each of their projections individually and then summing let's see if this is the case so this is equal to by our definition we'll use a unit vector version because it's simpler this is equal to a plus B a plus B that's our X dot u dot u and then all of that times our unit vector now we know that the dot product has the distributive property so then this is equal to a dot u plus B dot u vu these are unit vectors all of that times the vector u these are just Gayler numbers so scalar multiplication has the distributive property so this is equal to a dot times our vector you remember this is just going to be some scalar plus B dot u times our unit vector u and what is this equal to well this right here is equal to the projection of a this is equal to the projection of a onto L by definition right here by this definition if we assume that we're dealing with a unit vector definition for the line and then this is equal to this whole thing right here and then this whole thing right here is equal to plus the projection onto L of the vector B so we see our first our first our first condition for this being a linear transformation holds the projection of the sum of the vectors is equal to the sum of the projections of the vectors now our second condition is that the projection of a scalar multiple should be equal to a scalar multiple of the projection let me write that down so what is the projection onto L of some scalar multiple of some vector a well that is equal to C a dot our unit vector U times the unit vector U and then this one's a little bit more straightforward because this is the scalar multiple we've seen it in our dot product properties this is equal to C times a dot u times the vector U and this is just equal to C times this right here is the projection of a onto L the projection of a onto L so we've met both of our conditions for linear transformation so we know that our projection onto a line L in RN is a linear transformation so that tells us that we can represent it as a matrix transformation so what I want to do what I want to do we know that the projection of X onto L we already know this definition it can be rewritten entender to rewrite it as X dot some unit vector that defines our line let me draw it with a little hat to show that the unit vector times the unit vector itself so that we actually get a vector and now what I want to do is how can I write this as some matrix product some matrix vector product I want to write it as a product of some matrix times X times X times X and just to simplify things since we're actually dealing with a matrix let's assume let's let's limit ourselves to the case of r2 so I'm assuming that my projection onto L is going to be a mapping from r2 to r2 but you could do what I'm doing here with an arbitrary dimension so if we're doing an r2 then our matrix a right there is going to be a 2 by 2 matrix and we've seen in multiple videos that to figure out the matrix a we just take the identity matrix that just has it has the basis the standard basis vectors as columns 0 1 or 1 0 and then 0 1 and we apply the transformation to each of these columns so we could say that a is going to be equal to its first column is going to be equal to the projection onto L of this thing right here we do it in this orange color right here so what is that going to be that is going to be this dot u so let me write my U so my unit vector let's just assume that you can be rewritten as my unit vector is equal to some u 1 and u 2 just like that and so what I need to do is I need to take this dot my unit vector let me write this down so let me write this on the side so the first thing I want to do is figure out what the projection I'll just write here the projection onto L let me write it this way so writing the projection we know the projection is just equal to this dot this times that vector so let me write that so it's the vector 1 0 dot the vector the unit vector U which is U 1 u 2 is we're going to have that times my unit vector times my unit vector or maybe I'll write it like this times the vector u 1 u 2 this is going to be my first column in my transformation matrix my second column is going to be the same thing but I'm now going to take the projection of this guy the definition of our projection is you dot this guy with our unit vector so we get so we dot it we're taking the dot product of 0 1 0 1 dot my unit vector dot u 1 u 2 and I'm going to multiply that times my unit vector times u 1 u 2 and it seems very complicated but it should simplify when we actually try to work out our transformation matrix so let's do it when I dot these two guys what do I get let me write it here so my matrix a will become 1 times u 1 plus 0 times u 2 well that's just u 1 this whole thing just simplifies to u 1 we not take the dot product of these two things times u 1 u 2 that's going to be my first column and then my second column if I dot these two guys I get 0 times u 1 plus 1 times u 2 so I'm going to get you 2 times my unit vector u 1 u 2 and then if I multiply that out this will be equal to what now I can just write them as columns u 1 times u 1 is U 1 squared u 1 times u 2 is U 1 u 2 u 2 times u 1 is just u 2 times u 1 and then u 2 times u 2 is u 2 squared so you give me any unit vector and I will give you its transfer the transformation that gives you any projection of some other vector onto the line defined by that now that was kind of a a very long way of saying that but let's go back to what I did before we defined let's say we want to find any projection onto the line onto the vector we draw it here we'll do the same example that we did in the last video but if I have some vector V that like looks like that we said the vector V was equal to the vector 2 1 that was my vector V how can we find some transformation for the objection on to the line defined by V so on to this line right here the line defined by V well what we can first do is convert V into a unit vector so we can convert V into a unit vector so we could that goes in the same direction some unit vector U and we did that already up here where we essentially just divided BV by its length so let's take V and divide by its length the unit vector is this one over the square root of five times our vector V so it was this it was 1 over the square root of 5 times our vector V right there so you start with a unit vector there and then you just create this matrix and then we will have our transformation matrix so if this is our u what will our matrix be equal to if this is U then our matrix would be equal to u1 squared well what is u1 squared let me rewrite our let me actually rewrite our view a little bit not an angle so our vector u our unit vector that defines this line is equal to the vector 2 over the square root of 5 and 1 over the square root of 5 I just multiplied out this scalar so if we want to construct this matrix we get a is equal to u1 squared what's this squared it becomes 2 squared 4 over the square root of 5 squared which is just 5 equals 4 over 5 and then what is u1 times u2 2 times 1 over square root of 5 times square root of 5 so 2/5 2/5 I just multiplied these two what is u type 2 times u1 well same thing order doesn't matter when you multiply so this will also be 2/5 now what is u2 squared 1 squared over square root of 5 squared is just 1/5 1/5 so now we can say and that's the neat thing about creating these matrices that the projection you know let's say we have some let's say this is the origin right here we have some other vector X right here we can now define our transformation the projection of onto L where L is equal to - any scalar multiple of our unit vector u that's right here where the member of the reals that is our line L the projection onto L of any vector X is equal to this matrix is equal to the matrix 4/5 2/5 2/5 2/5 1/5 times X which is a pretty neat result at least for me because we once again reduced everything to just a matrix multiplication so you take this X and you multiply it by this matrix you're going to get its projection onto the L onto onto the line if you take if you take this vector let's say a and you multiply it times this matrix right there you're going to get its projection its projection onto the line if you take this vector now should go through the origin on a draw in standard position if you take this vector right there and multiply it times this matrix you're going to get this vector right here that is contained in the line and whose when you subtract it from this it's orthogonal we know the definition was kind of a shadow of that vector so anyway I think this is pretty neat