- A more formal understanding of functions
- Vector transformations
- Linear transformations
- Visualizing linear transformations
- Matrix from visual representation of transformation
- Matrix vector products as linear transformations
- Linear transformations as matrix vector products
- Image of a subset under a transformation
- im(T): Image of a transformation
- Preimage of a set
- Preimage and kernel example
- Sums and scalar multiples of linear transformations
- More on matrix addition and scalar multiplication
Exploring what happens to a subset of the domain under a transformation. Created by Sal Khan.
Let's say I have three position vectors here in R2. Let me scroll this over a little bit. Let's say my first position vector is x0 and it is equal to minus 2, minus 2. So if I were to graph x0 I would go minus 2, minus 2. x0 looks like that. My next position vector I have is x1 and I'll say that's equal to minus 2, 2. If I were to graph here, minus 2, 2. That's my next position vector right there. And this is x1. And when I say it's a position vector, they specify a specific coordinate in R2. Let me draw a third one just for fun, x2. Let's say that that is equal to 2, minus 2. So if I were to draw this, 2 minus 2, it goes right here. So that vector right there is x2. Now, what I'm curious about or, I guess, not curious about. What I want to do here is define the line segments that connect these points. So let's say I have my first line segment. Let me call it L1, or let me call it L0. And I want it to be the line segment that connects x0 to x1. How can I construct that? So I want to construct this line segment right here, this little-- let me do it in a different color actually. Let me do it in orange, L0. So what I want to do is I want to find the set of all of these values right here, all of the position vectors that define points on this line right there. Well we could define it as, we could start off at x0. We could say that orange line is x0 plus scaled versions of the difference of x1 and x0. If you take x1 minus x0, you get this vector right there. That's x1 minus x0. That orange vector. I know I wrote it right there so it's hard to read. But if you just take x1 minus x0 you get that and that make sense. x0 plus this orange vector is equal to that blue factor. So if you just take different scaled up versions of this guy, you're going to end up at different points in this direction. We're starting at x0, maybe I should do that in green. We're starting at x0 and then we're going to add up scaled up versions of this orange vector, which is just the difference of x1 and x0. Let me write that. So scaled up versions of x1 minus x0. Now, we have to constrict. If we just want to be in this line segment, we have to constrict Rt. If we said t was a member of real numbers, if it was any real number, then we would essentially be defining the set of this entire vertical line going up and down to infinity in the upwards direction and the downwards direction. But we just want to restrict it to start here and then go up here. And it doesn't necessarily have to have any direction. We could say this is true, our little line segment here is true, for t-- let me write it this way. t is greater than or equal to 0. So when t equals 0, this term cancels out and we just have this point or this position right here. Let me draw it in green. We just have that position there. And then t is going to be less than or equal to 1. What happens when t is equal to 1? When t is equal to 1, this becomes x1 minus x0. You have an x0 there. This x0 and that x0 cancel out and you're just at this point right there. When t is equal to 1/2, just to make sure this all make sense to you, what happens? You have x1 minus x0, which is this orange vector right here. When t is equal to 1/2 you're essentially scaling that orange vector by half and you end up right at that point, which is exactly where you want to be. You want halfway along that line segment. At t is equal to 0.25, you're going to be here. t is equal to 0.75, you're going to be there. So at any value for t being any real number between 0 and 1, you're going to end up at all of the points along that line segment. So that's our L0. It's just a set of vectors. Now we can do the same exercise if we wanted to find out the line, the equation of the line, that goes between x1 and x2. If we wanted to find the equation of that line, we could call this L1. And L1 would be equal to x1 plus t times x2 minus x1 for 0 is less than or equal to t is less than or equal to 1. That's L1. And then finally, if we want to make a triangle out of this, let's define this line right here. Let's define that as L2. L2 would be equal to the set of all of vectors where you start off at x2. Set of all of vectors that are x2 plus some scaled up sum of x0 minus x2. x0 minus x2 is this vector right here. So x0 minus x2 such that 0 is less than or equal to t is less than or equal to 1. And so if you take the combination, if you were to define kind of a super set-- I could have defined my shape as-- let's say it's the union of all of those guys. Well, let me just write it. L0, L1, and L2. Then you'd have a nice triangle here. If you take the union of all of these three sets, you get that nice triangle there. Now, what I want to do in this video, I think this is all a bit of review for you. But it's maybe a different way of looking at things than we've done in the past. Is I want to understand what happens to this set right here when I take a transformation, a linear transformation, of it? So let me define a transformation. I'll make it a fairly straightforward transformation. Let me define my transformation of x, of any x, to be equal to the matrix 1 minus 1, 2, 0 times whatever vector x. So times x1, x2. And we know that any linear transformation can actually be written as a matrix and vice versa. So you might have said, hey, you know, you're giving an example with the matrix, what about all those other ways to write in your transformation? You can write all of those as a matrix. So let's translate-- let's try to figure out what this is going to look like. What our triangle is going to look like when we transform every point in it. Let me take the transformation first. The transformation of L0 is equal to the transformation of this thing. This is just one of the particular members. For a particular t, this is one of the particular members of L0. So it's going to be equal to the transformation of x0 minus the transformation of x1 minus x0 such that-- sorry. Minus t times x1 minus x0. That's a lowercase t, not the transformation. Such that 0 is less than or equal to t is less than or equal to 1. Let me switch colors. This, just by the properties of linear transformations, this is equal to the transformation-- let me put the brackets out-- of x0 minus the transformation of our scalar t times x1 minus x0 for all t's between 0 and 1. That part is getting a little redundant to keep saying it. And then, what does this equal to? If you I take the transformation of a scaled up vector, that's just the scaled up transformation of that vector. So this is going to be equal to this part, the transformation of x0 minus t, our scalar multiple t, times the transformation of the vector x1 minus x0. And then let me make sure I get my parentheses right. Such that 0 is less than or equal to t is less than or equal to 1. And then the transformation of the sum of two vectors is equal to the sum of their transformations. We've all seen this before. So our transformation of our first line-- this one right here-- L0, is equal to the set where it's the transformation of x0 minus t times the transformation of x1 minus the transformation of x0. And we've just done our first line so far. I have a parentheses there. For 0 is less than t is less than or equal to 1. Now this is a pretty neat result and it's going to simplify our lives a lot. The transformation of the line segment that goes from x0 to x1 ends up just being the line segment that goes from the transformation of x0 to the transformation of x1. Let me make this clear. What is the transformation of x0? Let's calculate these things. So x0 was minus 2, minus 2. Let me write out the transformation of x0. So the transformation of x0 is equal to-- let me write it out, so I don't make any careless mistakes. 1, 2, minus 1, 0 times minus 2 minus, minus 2. And so what would this be equal to? 1 minus 2 minus-- so it's 1 minus 2 plus minus 1 times minus 2. That's going to be plus 2. So it's minus 2 plus a plus 2, so it's equal to 0. And then we have 2 times minus 2, which is minus 4. 2 times minus 4. And then plus 0 times, so it's minus 4. So that's the transformation of x0. Let me graph it. So it's 0 minus 4. So our x0 vector. So this is the transformation of x0. So the transformation associated this vector with this vector down here, the one that goes straight down. Now let me take the transformation of the other guys. The transformation of x1. I'll just do it right here. I'm running out of space. The transformation of x1 is equal to 1, 2, minus 1, 0 times minus 2, 2. So what is this equal to? This is equal to 1 times minus 2, plus minus 1 times 2. So that's minus 4. And then 2 times minus 2 is minus 4. Plus 0. So minus 4, minus 4. So x1 is minus 4, minus 4. So our x1 looks like this. Our transformation of x1 is this vector right here in R2. Our transformation is going from R2 to R2. So that's why I'm able to draw them both on this nice Cartesian coordinate plane. And we have one left. Let's take our transformation of x2. So the transformation of x2 is equal to our transformation matrix 1, 2, minus 1, 0 times 2, minus 2. And so this will be equal to 1 times 2 is 2. Plus minus 1 times minus 2. So it's 2 plus 2 is 4. And then have 2 times 2 is 4. Plus 0 times minus 2. So it's 4, 4. So x2 is 4, 4. So it's this point right here. 4, 4 right there. So the transformation of x2 is that vector right there. And so, we are able to take the transformation of each of these points of this triangle. But who knows what the transformation does to everything in between, to all of these other-- the actual sides of the triangle. We're able to do a little math and we just did the first side. We just did L0 right there we found, just using the properties of a linear transformation, the definition of a linear transformation actually, we were able to find that the transformation of L0 of this vertical line here, it just ends up becoming the line where we can start off at the transformation of x0. The point specified by this vector right here. And to that I add up scaled multiples of the transformation of x1 minus the transformation of x0. What is this, the transformation of x1 minus the transformation of x0? The transformation of x1 is just this vector right here. The transformation of x0 is just that vector. So this whole term right here is just this vector minus that vectors or it's this vector right there. It's just that vector right there. And so, what we essentially have, we've defined the same way that we did in the first part of this video. This is just the same thing as the line segment that connects the point defined here and the point defined there. We took the difference of the two and we have scaled up versions of that between t is equal to 0 and 1. So the transformation of L0 really just became the transformation-- is just the line between the transformations of both of the endpoints, which is a pretty neat result. It makes our lives simple. We can do the exact same logic to say, you know what? What's going to be the transformation of L1? Well L1 was between the points x1 and x2. It was between that point and that point. That was L1. So using the same logic, we can do the math all over again. But it applies to any line. I did it all abstractly here. The transformation of L1 is going to be the line that connects the transformation of the two endpoints. So it's going to be the line that connects the transformation of x1 and the transformation of x2. Let me make this right here, is the transformation of L1. This right here is the transformation of L0. And then finally, what's the transformation of L2? L2 connects the points x2 and x0. So that is L2 right there. So the transformation of it using the same math that we've done before is really just the line connecting the transformations of those two points. So the transformation of L2 is going to be equal to the line that connects the transformation of x2 to the transformation of x0. So it's going to be that line right there. So this is the transformation of L2, or if we defined our whole shape or our whole triangle as the set of all of these, the transformation of that. So the transformation of our whole shape is now this skewed triangle. I think you're now getting a sense of why this might be useful in things like computer graphics or game development. Because when you look at things from different angles, you start to skew them and whatever else. But taking this transformation, we were able to turn this set of vectors or the positions-- or I guess this shape, which is specified by this set of vectors right here. We were able to change it into this shape in R2 specified by a different set of vectors. But the whole takeaway from this video is, you don't have to individually figure out, gee, what does this point right here translate into over here? All you have to say is what were my endpoints? Figure out their transformations and then connect the dots in the same order. That's what is essentially the big takeaway from here. And this idea of when you transform one set into another set, they have some terminology associated with it. So let's say the transformation of L0. L0 was the set of vectors that specified this line right here. The transformation of L0, which is this set, is a set of vectors-- sorry. L0 was this set. It was the set of vectors in our co-domain that specified these points. This is called the image of L0 under T. And it kind of makes sense. Why do they call it the image? Because t is taking this thing right here, this L0, and kind of distorting it or creating a new image of it in the co-domain. It's taking a set in the domain and creating a new image of it in the co-domain right there. We could say that t of the transformation of our entire shape, I defined our entire shape up here as this whole triangle right there. That's the image and that turned into this purple triangle here. That's the image of s under T. So hopefully you found that pretty interesting. This is actually a super useful takeaway if you ever want to become a 3D programmer of some type. In then next video, we'll explore what happens when s is no longer just a subset of our domain. Everything we've been dealing so far-- L0, L1, and L2, or our entire triangle, these were all subsets or Rn. In the next video we'll talk about what happens when you take the transformation of all of Rn.