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

Transforming polygons using matrices

Video transcript

we've already used a transformation matrix to transform one point what I want to do in this video is transform a series of points and so I have these position vectors P 1 P 2 and P 3 and I've plotted them right over here and you could imagine them to even be vertices of a triangle that looks something like this that's one side that's another side and that's another side right like that and what I'm curious about is what would what happens if I would transform these three points and like the last video I could apply this transformation matrix separately to each of them to see what they transform into or instead I could take this transformation matrix I should take this transformation matrix and multiply it times a matrix composed of these position vectors so let me do that so let me whoops let me take my transformation matrix so let me copy and paste that so copy and paste so I'm going to take my transformation matrix and I am going to multiply that by a matrix that has all three of these position vectors in it where each of the columns of this matrix is going to be one of these position vectors so the first one is 2 comma 1 then we have negative 2 0 and then we have 0 2 0 2 so one way you could think about it is we're taking this we're taking our transformation matrix and we're multiplying it by a by a matrix that is composed of that is composed of the first column its position vector 1 the second column is position vector 2 position vector 2 and the third column is position vector 3 position vector 3 now what is this going to give us well this is a 2 by 2 matrix 2 by 2 matrix we're multiplying it by a 2 by 3 matrix 2 by 3 matrix so matrix multiplication is defined over here because the number of columns here is the same as the number of rows here and it's going to result in a two by three matrix so it's going to result in a two by three matrix so two rows and three columns which we could imagine represents three new column or three new position vectors so what's this going to be so let's go step by step so this first entry first row first column is this row times this column so two times two which is four plus one plus one so it's four plus one so this is going to be five let me do it in the same colors so this is going to be five negative 1 times 2 is negative 2 this negative 1 times 2 is negative 2 plus 2 times 1 plus 2 this negative 2 plus 2 which is 0 so we already see it transformed 2 comma 1 2 5 comma 0 1 2 3 4 5 so if we consider this p1 we consider this p1 prime p1 after our transformation now let's go to p2 2 times negative 2 is negative 4 plus 1 times 0 so it's negative 4 plus 0 which is just negative 4 and then negative 1 times 2 is positive 2 plus 2 times 0 which is just going to be 0 so it's going to be positive 2 plus 0 which is just 2 so negative 4 comma 2 negative 4 negative 1 2 3 4 comma 2 is right over here so if this is p2 this was P 2 right over here this is P 2 prime this is P 2 this is position vector P 2 prime or the position that position vector P 2 prime would would specify and then finally let's look at P 3 so we have 2 times 0 which is zero plus one times two so it's going to be zero plus two or just two and then we have negative one times 0 which is 0 plus two times two is four so we get the point 2 comma 4 so 2 comma 1 2 3 4 we go right over here so if this is P 3 right over here this is P 3 through P 3 Prime and so something interesting has happened we now have the vertices you could imagine of another triangle of a new triangle of a new triangle that looks something like this that looks something like this that looks something like this and so what you could imagine is actually let me draw it a little bit let me draw our new one with this this blue color here so we can see a little bit better so we went from we went from that smaller triangle we went from that smaller triangle to the larger one this is the smaller one right over here that's our smaller triangle to the larger one or another way you could think of it this entire triangle was transformed and right now we only transform the vertices but it actually turns out and I'm not proving in this video that if you transformed if you took any of these points on this triangle it would have transformed to a corresponding point on this larger on this larger triangle and what's neat about this is hopefully you're starting to appreciate what it the power of a transformation matrix and hopefully you're starting to appreciate why this is useful as you start to think about things like computer games and animation because what transformation matrices allow us to do and this is what actual these computer programs that allow us to do view things from different perspectives what they're actually doing under the covers is they're using transformation matrices and they're multiplying them times coordinates in order to get new coordinates based on the position or the perspective of the player or the position or the perspective of the of the camera or the the virtual camera in in a kind of a computer graphics world so - I guess several neat things here is we haven't just transformed a point now we've transformed three points which could represent the vertices of a triangle and you see this kind of is this kind of expansion and rotation that seems this expansion and rotation that seems to have happened when we used this transformation matrix if we use a different transformation matrix we would have a different transformation and this not only did we do it but we saw that we could do it with multiple multiple position vectors at the same time I could have done it independently and gotten the same result but this is hopefully starting to show you the power of matrices and why it also could be useful and things like computer graphics and animation and things like that