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:15:13

we've talked a lot about linear transformations what I want to do in this video and actually the next few videos is to show you how to essentially design linear transformations to do things to vectors that you want them to do so we already know that if I have some linear transformation T and it's a mapping from RN to R M that we can represent T what T does to any vector in X or the mapping of T in of X in RN to RM we can represent it as some matrix times the vector X where this would be an M by n matrix M by n matrix and we know that we can always construct this matrix that any linear operation any linear transformation can be represented by a matrix this way and we can represent it by taking our identity matrix you've seen that before by taking the identity matrix with n rows and n columns so it literally just looks like this so it's a 1 and then it has n minus 1 zeros all the way down then it's a 0 1 and then there everything else is zeros all the way down and so essentially you just have ones down as diagonal it's an N by n matrix all of these are zeros just like that you take your diet identity a matrix and your prop and you up and you perform the transformation on each of its columns on each of its columns and we call each of these columns the standard basis for RN so this is column e 1 this is column e 2 and it has n columns en and each of these columns are of course members of RN because this is an N n rows and n columns matrix and we know that a our matrix a can be represented as the transformation being operated on each of these columns so the transformation on e 1 and the transformation on e 2 so forth and so on all the way to the transformation the en and this is a really useful thing to know because it's very easy to operate any transformation on each of these basis vectors that only have a 1 kind of in its corresponding dimension or endurance court with respect to the corresponding variable and everything else is zero so let's you know all of this is review let's actually use this information to construct some interesting transformations so let's start with some set in R in RN and actually everything I'm going to do is going to be an r2 but you can extend a lot of this into just general dimensions but we're dealing with r2 right here obviously it's only two dimensions right here let's say we have a triangle formed by the points formed by the points let's say the first point is right here let's say it's the point three two three two and then you have the point let's say that your next point in your triangle is the point well let's just make it the point - three - three - I shouldn't have written that as a fraction I know I did that three - then you have the point - three - and that's this point right here - three - and then let's say just for fun let's say you have the point let's say we have the point or the vector the position vector right 3 - 2 3 - 2 which is right here now each of these are position vectors and I can draw them I could draw this 3 2 is in the standard position by kind of drawing an arrow like that I could do the - 3 - and its standard position like that and 3 - 2 I could draw like that but more than the actual position vectors I'm more concerned with the positions that they specify and we know that if we take the set of all of the positions or all of the position vectors that specify the triangle that essentially formed by connecting these dots the transformation of this set the transformation of this set so we're going to apply some transformation of that is essentially you take the transformation of each of these endpoints and then you connect the dots in the same order and we saw that several videos ago but let's actually design a transformation here so let's say we want to let's just write down in words what we want to do with our without what whatever we start in our domain let's say we want to reflect around the x-axis reflect around around the well actually let's reflect around the y-axis around the y-axis so we essentially want to flip it over we want to flip it over that way so I'm kind of envisioning something that'll look something like that when we flip it over so we're going to reflect it around the y-axis and let's say we want to we want to stretch stretch in y direction by two in y direction times two so what I envision we're going to flip it over like this what I just drew here and then we want to stretch it so we're going to first flip it that's kind of step one and then step two is we're going to stretch it so instead of looking like this it'll be twice as tall so it'll look like this without necessarily stretching the X so how can we do that so the first idea of reflecting around the y axis right so what we want is this point that was a minus three and the x coordinate right there we want this point to have its same y-coordinate we want it to still have a two there and I'm calling the second coordinate here our y coordinate I call it I could call that our X 2 coordinate but we're used to dealing wet with the y coordinate when we graph things so I'll just keep calling it the y coordinate what we want is this this negative 3 to turn to a positive 3 and week because we want this point to end up over here and we want this positive 3 here to end up becoming a negative 3 over here and we want this positive 3 for the x coordinate to end up as a negative 3 over there so you can imagine all we're doing is we're flipping the sign when we this reflection around y this is just equivalent to flipping the sign flipping the sign of the x coordinate so this statement right here is equivalent to minus 1 times the x-coordinate so let me call that or you know let's call that x x-1 because this is X 1 X 1 and then stretching in the y-direction so what does that mean that means that whatever whatever height we have here so this next step here is whatever height we have here I want it to be two times as much so right here this coordinate is 3/2 if I didn't do this first step first I would want to make it 3 4 I want to make two times the y coordinate so the next thing I want to do is I want to do two times well I could either call it well let me just call it the the y coordinate it's a little bit different convention than I've been using but I'm just calling these vectors instead of calling them X 1 and X 2 I'm saying that my vector is in R 2 the first time I'm calling the X term or the X entry and the second term I'm calling the Y entry but it's the same idea that we've been doing before I'm just switching to this notation because we're used to thinking of this as the Y axis as opposed to the X 1 and the X 2 axis so how do we construct this transformation I mean I can write it down in kind of transformation words I could say I could define my transformation as T of some vector X let me write it this way T of some vector X Y is going to be equal to I want to take minus 1 times the X so I'm going to minus the X and then I'm going to multiply 2 times the Y so that's how I could just write it in transformation language and that's pretty straightforward but how would I actually construct a matrix for this so what you do is you just take your we're dealing in r2 so you start off with the identity matrix in r2 which is just 1 0 0 1 and you apply this transformation to each of the columns of this identity matrix to each of the columns of that identity matrix so if you apply this if you apply the transformation to this first column what you get so what we're going to do is we're going to create a new matrix a and say that is equal to the transformation of let me write it like this transformation of 0 of 1 0 that's going to be our new column we're just going to transform this column and then the second column the second column is going to be the transformation of that column so it's transformation of 0 1 just like that and so what are these equal to the transformation of 1 0 so let me write it down here in green so a is equal to what's the transformation of 1 0 where X is 1 where we just take the minus of the X term so we get minus 1 and then 2 times the y term so 2 times 0 is just 0 now to do the second term the minus of the 0 term is just minus 0 so that just stays is 0 and then multiply 2 times the y term so 2 times y is going to be equal to 2 times 1 so it's equal to 2 so now we can describe this transformation so now we could say the transformation of some vector X Y we can describe it as a matrix vector product it is equal to minus 1 0 and 0 2 times our vector times X Y and let's apply it to to verify that it works the verify that our matrix works so this first point and I'll try to do it color coded let's do this first point right here this is minus 3/2 so that's minus 3/2 so what is what is minus 3/2 I'll do it right over here I could just look at that so what is 1 minus 1 0 and 0 2 times minus 3/2 well this is just a straight up matrix vector product minus 1 times minus 3 is positive 3 plus 0 times 2 so plus 0 so this is 3 and then 0 times minus 3 is 0 plus 2 times 2 so this is 3/4 so that point right there will now become the 0.34 it now becomes that point right there let's look at this point right here the 0.32 so let's take our transformation matrix - 1 0 0 2 times 3 - this is equal to minus 1 times 3 is minus 3 plus 0 times 2 so it's just minus 3 you have 0 times 3 which is 0 plus 2 times 2 which is 4 0 plus so you get that point so this point by our transformation T becomes minus 3 4 so minus 3 4 and I kind of switch in my terminology I say it becomes or you could say it's mapped to if you want to be kind of used the language that I use when I introduce the ideas of functions and transformation this point is mapped to this point in R 2 and then finally let's look at this point right here apply our transformation matrix that we've engineered let's multiply minus 1 0 0 2 times this point right here which is 3 minus 2 3 minus 2 which is equal to minus 1 times 3 is minus 3 and then 0 times minus 2 is just 0 so this becomes minus 3 and then 0 times 3 is 0 2 times minus 2 is minus 4 so minus 3 minus 4 so this point right here becomes minus 3 minus 4 becomes that point right there and we know that the set in R 2 that connects these dots by the same transformation will be mapped to the set in R 3 that connects these dots we've seen that already I think those three videos ago so the image the image of this set that I've drawn here this triangle is just a set of points specified by a set of vectors the image of that set of position vectors specifies these points right here specifies the points that I'm drawing right here let me see if I'm doing it right there you go just like that and lo and behold it has done what we wanted to do we flipped it over so that we got kind of this side on to the other side like that and then we stretched it and we stretched it in the y-direction and we see that it has stretched by a factor of two we flipped it first and then we stretched it by a factor of two and in general any of these operations can be can be performed and you can always go back to the basics you can always say look I can write my transformation in this type of form that I can just apply that to my to my basis vectors or the columns in my identity matrix but a general theme is is any of these any of these transformations that literally just scale and neither the X or Y direction and when I or essentially just well you could say scale they can either shrink or expand in the X or Y direction or flip in the X or Y direction creating a reflection these are going to be diagonal made diagonal matrices diagonal matrices diagonal matrices and why are they diagonal matrices because they only have nonzero terms along their diagonal this is a two by two case if I did a three by three it would be zeros everywhere except along the diagonal and it makes a lot of sense because this first term is essentially what you're doing to the x one term the second term is what you're doing to the x2 term if you had or the Y term in our example if I had multiple terms if I in this was a three by three that would be what I would do to the third dimension then the next term would be what I would do to the fourth dimension so you could expand this idea to an arbitrary RN anyway this whole point of this video is to kind of introduce you to this idea of creating custom transformations and I think you're already starting to realize this could be very useful if you want to do especially in computer programming if you're going to do some graphics or create some type of multi-dimensional games