Main content

## Linear algebra

### Unit 2: Lesson 1

Functions and linear transformations- 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

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Image of a subset under a transformation

Exploring what happens to a subset of the domain under a transformation. Created by Sal Khan.

## Want to join the conversation?

- Why does Sal use (1 2, -1 0) matrix at6:21?(17 votes)
- It's just an example. He could have used any matrix with the right dimensions.(14 votes)

- What is a subset?(5 votes)
- First, you need to have a set for the term subset to mean anything. A set is a collection of elements. A subset of a set contains elements
**only**from that set.

For example, set A = {1,2,3,4,5,6} and set B = {4,5}. B is a subset of A. A is**not**a subset of B.

My examples above are finite sets, but you can have infinite sets. For instance, R^2 is the set of all points in the plane. In this case, the set C = {[4,5],[6,7]} is a set with 2 points [4,5] and [6,7], and C is a subset of R^2.(26 votes)

- It should be + sign not -...please modify(20 votes)
- in parametric equation of a line we can express it in different ways.

and however lines doesnt have a direction.(0 votes)

- Why do you need to add X0 for the L0? Does not the X1 - X0 equals the L0?(8 votes)
- I hope that anyone can explains this thing because I really dont get why he added x0 for L0 even that he said that "the orange Vector is equal to x1-x0 "and the orange vector is the line segment(6 votes)

- At7:15, why is it a minus sign after T(X0) instead of a + sign in the T(L0) equation, since the original equation of L0 has a + sign after X0(9 votes)
- In past videos, we would just draw the vector between x1 and x0 as (x1-x0), the difference between the two vectors. The orange arrow Lo was just (x1-x0). How come when we define the orange line this time, we have to add in a starting position x0 and then scale (x1-x0) by t? Fundamentally, I understand why starting at x0 and then adding a scale of (x1-x0) works, but what's the difference if we just said L0 = (x1-x0)?(5 votes)
- I believe it's because you can do different kinds of things with these vectors than you can do with points and distances between points. A vector is very similar to a directed line segment (the difference between 2 points "P2 - P1").

A fixed vector seems to me to be a difference between two points, after you perform the subtraction, not before as in the equation for a plane n dot (v - v0), where the properties of both directed line segments and vectors are maintained.(1 vote)

- at4:45wouldn't it be accurate to say that L1 = t(x1) where -1 <= t <= 1 ?

Proof: t(x1) = x2 where t = -1(4 votes)- Yes, it is correct to say that L1 = { t(x1) | -1 <= t <= 1 }

This is true because x2 = -x1

It should be noted, however, that you defined L1 from x2 to x1, while Sal defined it as x1 to x2. It doesn't make a difference, but I just wanted to inform you as to the direction of your L1. If you wanted to define L1 the exact same way, you could just flip t like this:

L1 = { -t(x1) | -1 <= t <= 1 } or L1 = { t(x2) | -1 <= t <= 1 }

That way when t = -1, L1 = -(-1(x1)) = x1, and when t=1, L1 = -(1(x1)) = -x1 = x2(2 votes)

- Sal seems to be saying that the sets L_0, L_1, and L_2 consist of spans that start at x_0, x_1, and x_2 and span the directed line segments connecting these points (In both the untransformed and transformed sets).

However, take one vector from these 3 sets, say "x0 + (3/4)(x1-x0)" = "(-2, -2) + (3/4)(0, 4)". The tail of (0, 4) is at the head of (-2, -2) by vector addition. So we have (0, 3) added to (-2, -2). But where is the tail of (-2, -2)? If it's not anywhere (which makes sense, because it's a vector), then we don't get lines in R^2 as drawn by Sal. If it's at the origin, then all the vectors in all 3 sets are from the origin and go different directions and sort of fill in the triangle defined by the (transformed or untransformed) points.

This isn't like the definition of a plane in R^3 where we took the difference between vectors, which were understood to have their tails at the origin, and got vectors that all originated from the same point "n dot (x - x0)". In this case we don't get vectors on the lines, rather, if we understand the vectors x0, x1, and x3 to start at the origin, then all the vectors in L1, L2, and L3 do also, no?

I think if e.g. "x0 + ..." were left out of the set L0, then L0 would actually be the line connecting x0 and x1; and similarly for L1 and L2. Does anyone disagree?(2 votes)- I do disagree. I will try to explain my thoughts. First, a terminology note: the span of a vector is all linear combinations of that vector (giving a line, not a line segment). It doesn't seem like that's what you are describing, so I won't use that term in this case.

If I understand your question, you want to know why L0 is the line segment between (-2, -2) and (-2, 2) rather than a different set definition, lets call K0, which would be K0 = {t(x1 – x0) : 0 ≤ t ≤ 1}. So let's consider K0.

Let t = 0. Then a vector in K0 must be (0, 0). Right away we have an issue, since the line going from the tip of x0 to the tip of x1 certainly does not go through the origin. K0 cannot describe our line.

To understand why L0 describes our line, start with x1 - x0. That gives us a vector of the correct length and slope (or non-slope in this case since it's a vertical line). But we want a set of all the vectors, so we scale by a constant Sal called t where 0 ≤ t ≤ 1. What this means is that when t = 1, we have a vector of the full possible length. When t = 0 we have a zero length vector, and as t ranges in-between, we get all lengths in-between. This is K0.

But we still need to get them in the right spot. So we take all those vectors in the set K0, and we add x0 to each. This moves them over - L0 is the line segment parallel to K0 which runs through the tip of x0. And that is what we wanted.

These types of sets are called affine sets. They are not generally subspaces, but they have a lot of other roles.(4 votes)

- At5:50Sal defines the triangle as the set containing each of the three sets he defined, L0, L1, and L2. However, if we wanted the set containing all points in that triangle, shouldn't he have defined S to be L0 U L1 U L2 (L0 union L1 union L2)? The set S, as he defined it, doesn't contain any points of the triangle at all, it just contains 3 sets.(3 votes)
- I think you are right. He hints the set Reunion though.(1 vote)

- In discussing points on a plane in a previous video, Sal painstakingly defined a vector on the plane as a subtraction of two vectors from the origin. The key point was that the two vectors from the origin did not lie on the plane (their end point did), however, the vector as a result of their subtraction does (this makes sense). In this video, in defining the line, Sal similarly represents the line as a subtraction of two vectors from the origin. However, the confusing part to me is when t=0. We are left with not a point, but a vector from the origin. And that vector, Xo, X1, nor X2 lies on the L0, L1, or L2 lines. So doesn't that mean the first X0, X1, and X2 in the equations defining L0, L1, L2 be a point and not a vector? To point to a more specific time in the video:

At4:44, Sal shows two different Lines as L0 and L1. For L0 and L1 shouldn't the first Xo or X1 be a point and not the vector X0 or X1 respectively? And for L0, shouldn't the Xo in the parenthesis be a vector as the X1 is in L1? At5:19, the L2 also shows the first X2 as a vector when it should be the point. If not if t=0 then you are left with a vector from the origin, rather than a point on the line. Or is it when a vector subtracts zero, we are left with a point? I would have expected it to still be a vector.(2 votes)- You are thinking of a point and a vector as two different objects, when really they are the same. You should think of these vectors as position vectors; they represent a position, or point, in space.(2 votes)

## Video transcript

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.