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

# Vector transformations

Introduction to the notion of vector transformations. Created by Sal Khan.

## Want to join the conversation?

- What are tuples?(62 votes)
- A tuple is a list, with some specific number of elements. In first/second year algebra, you mainly use two and three tuples to express points in 2 and 3 space; the Cartesian and three dimensional spaces. In linear algebra, the idea of these tuples is abstracted to n-component lists. Tuples are also always ordered; the three tuple (1,2,3) is different than (2,3,1).(86 votes)

- Since R^3 has infinitely more values then R^2 how can every point in R^3 only map to one point in R^2?(11 votes)
- Actually, with a space-filling curve you can show that a plane has no more points than in a line, and that a space has no more points than a plane.

http://en.wikipedia.org/wiki/Space-filling_curve(32 votes)

- I have noticed that when talking about Vectors Sal generally denotes them as a column matrix like he did at3:00when describing vector x?

IS there a reason to do so or could your represent them as a row vector also?(8 votes)- You could use a row vector without changing any meaning. It only becomes significant when mixing vectors with matrices, where a row and column are very different and in that context one or the other is used as appropriate.(13 votes)

- In vector mapping can we map from one dimensional space? If yes, then how will the relation defined by the function be since in this case the codomain must be of 2-tuples and above.(4 votes)
- I think we can. Define a function f:R->R^2 by f(x)=(x,x). In the same way that Sal mapped 2-dimensions to 3-dimensions we can map n-dimensions to m-dimensions, where n and m are integers.

Some more examples to show that we can define it however we want :

f:R->R^2 by f(x)=(2x,x)

f:R->R^2 by f(x)=(x^2,x^3)

f:R->R^2 by f(x)=(sin(x),x+10)(7 votes)

- I've always thought of vectors as merely
**n-tuples**(as Sal states at around1:50). However, some books (and some parts of Khan Academy, such as the "Vector dot and cross products" playlist videos) make an effort to differentiate between**points**and the**position vectors**used to represent those points (for instance, the point "P(x1,x2,x3)" vs. the position vector "<x1,x2,x3>"), which has confused me because I've always thought of*both*points*and*vectors as tuples--i.e. as one and the same.

Anyway, could someone help clarify this point of confusion? In addition, could someone please explain why it's necessary to distinguish between**points**&**position vectors**and not merely represent both as n-tuples?

I apologize for the long-windedness of this question...(4 votes)- Don't apologize! There's nothing wrong with a non-TL/DR mentality :)

First of all, both are tuples. You basically say A implies C, B implies C, thus mustn't it be that A implies B? No. It could be, but for instance in this particular example it is not true. A series of points that belong to eachother, say P(x1, x2, x3), is a tuple. A position vector is a vector with its tail in O(0,0,0) and its head in P(x1, x2, x3). However, since it is a vector, we need to consider the associated unit vectors with each component in the position vector <x1, x2, x3>. This means that we can express the position vector as an N-tuple, where N is the amount of components of the point P and its position vecotr, but this N-tuple does not consist merely of x1, x2 and x3 like the point itself, it consists of 2-tuples including each component and their respective unit vector.

In other words, to express the position vector of point P(x1, x2, x3), we can use this notation: ((x1, i-hat), (x2, j-hat), (x3, k-hat)).

We can conclude that you represent both as N-tuples, but the point consists of N scalars, and the vector consists of N 2-tuples. This is due to the fact that vectors have a direction, which we can see through the fact that now every component is indeed a component vector of the position vector, thanks to the usage of unit vectors.

Hopefully my lack of theoretical knowledge (I simply thought of this all myself, so mistakes in reasoning might make this entire answer flawed), will not keep you from understanding the analysis. Anyone reading this, be sure to point out mistakes if I'm wrong and it appears that vectors by some definition cannot correctly be expressed as N-tuples of 2-tuples.(5 votes)

- Is a function in the imaginary plane a vector valued function? You are mapping from a 2D space (real and complex part) to another 2D space (another real and complex part).(3 votes)
- The definition of a vector valued function tells us that the codomain of that function must have more than one dimension. This means that it does not matter what the domain of our function is: we only care what that domain maps to, in other words the codomain. Since a codomain in 2D space simply means codomain: R^2, where 2 is strictly bigger than 1, we can conclude that the function you described is in fact a vector valued function.

Right?

No, because we made the assumption that our function codomain is a plane of real numbers, which they are not. A function in the imaginary plane has a codomain of Z^1, which means that the function is in fact a scalar valued function (but NOT real valued function).

Eventually it all depends on whether or not you tell your function to be real-valued or not: you could simply take Cartesian space and say that the y-axis has no unit while your x-axis has the unit "i", the imaginary number. Basically now we see that simply said, complex numbers can be expressed as 2-tuples of real numbers, given that one of those 2-tuple numbers has a unit "i".

Thus it is ambivalent to say that your function is vector valued or scalar valued.

It is ambivalent to say that it is both real-valued and vector valued, or both complex-valued and scalar valued.(3 votes)

- the position vectors of T=(5,2)and S=(1,-3)and P =(7,13). Find the values of the scalars of a and b such that aT+bS=P(3 votes)
- Bascally you can set it up like a system of equations (though as you go through linear algebra you will be getting systems and turning them into vectors.)

5a + 1b = 7

2a - 3b = 13

I will solve for s in the first equation

b = 7 - 5a

2a - 3b = 13

Then plug in s int he second one

b = 7 - 5a

2a - 3(7 - 5a) = 13 = 2a - 21 + 15a = 17a -21

Then solve for a in the second

b = 7 - 5a

a = 2

Then back substitute

b = 7 - 5(2) = -3

a = 2

And that should do it.

If you have learned reduced row echelon form you can turn the vectors into a 2 by 3 matrix and put it into rref(3 votes)

- Why was f(x1, x2, x3) in R^3 while (x1, 2x2, 3x3) is in R^2?

By the way, I didn't know how to make some of the numbers subscripts so I just put regular numbers. Eg. x1, x2, x3.

Thank you! :)(3 votes)- The reason is the way the list was constructed. This confused me at first as well. The first list has three commas (x1,x2,x3) and the second list has two commas (x+2x2 , 3x3) Hence by counting the commas we see that the first list is R^3, a three-tuple to be sure, and the second list is a two-tuple. The argument (x+2x2) means that for the first element in the list to the left, you perform the operation of adding the value to twice the value of the second value in the first list, and 3x3 just means three times the value in the third spot. Those map to the two positions in the column vector on the right ;)(4 votes)

- At0:36, Sal gives the example of apples and bananas, can we also consider the exchange rate between apples and bananas as a function! It's not exactly a question its more of a concept check!(2 votes)
- That would be a bit different. It could be represented as a function of this form: e:F^2->R. Where e is the exchange rate function, F is the set of fruits, and R is the reals in one dimension.(2 votes)

- What does he mean at6:02?(2 votes)
- A function that takes a 3D vector as input and outputs a 2D vector.(2 votes)

## Video transcript

In the last video we saw, a
little bit more formally than you might have been exposed to
the past, that a function is just a mapping of the members
of one set to another set. So if this is my first set, x. We call that the domain. And the set that we're mapping
to, y, in this case, that's called the codomain. And the function just maps each
of the specific entries of x to an entry in y. When I say map, it really just
creates an association. If we think of these in even
less abstract terms -- which, on some levels is more abstract
-- you could view x as a basket of bananas and
y as a basket of apples. And for every banana, you're
associating it with one of the apples. The mapping of going from each
of those bananas to each of those apples would
be a function. I don't know if that helps you
or not, but I just want to broaden your preconceived notion
of what a function is. I mean everything that you've
probably seen before probably took a form that looks
something like that. Where you said, oh, a function
is, you just give me some number and I'll give
you another number. Or I'll do something
to that number. While it can be much more
general than that. It's an association between any
member of one set and some other members of another set. Now, we know that vectors
are members of sets. Right? In particular, if we say that
some vector x is a member of some set -- let me just say it's
a member of rn, because that's what we deal with -- all
that means is that this is just a particular representation
of an n-tuple. Remember what rn was. rn we defined way back at the
beginning of the linear algebra playlist. We defined it
as the set of all n-tuples -- x1, x2, xn, where your x1's,
x2's, all the way to xn's are a member of
the real numbers. So your rn is most
definitely a set. This could be rn. And obviously the use of the
letter n is arbitrary. It could be rm, it
could be rs. n is just kind of a placeholder
for how many tuples we have. It
could be r5. It could be 5 tuples. And when we say that a vector
x is a member of rn, we're just saying that it's another
way of writing one of these n-tuples. And all of our vectors so far
are column vectors -- that's the only type that we've defined
so far -- and we say it's this ordered list where
each of the members are a member of r's. It's an ordered list of n --
it's an ordered list of n-components -- x1, x2, all the
way to xn -- where each of those guys, or each of those
x1's, x2's all the way to xn's, are a member of
the real numbers. That's, by definition, what we
mean when we say that x is a member of rn. So if x is a member of rn -- so
let me draw two sets right here -- let's say that this set
right here is rn and then let me just change, just to be
general, let me create another set right there and call that
set right there rm. Just a different number. It it could be the same as
n, it could be different. This is m-tuples,
that's n-tuples. We've defined that vectors
can be members of rn. So you could have some vector
here and then, if you associate with that vector in rn
-- if you associate it with some vector in are rm -- if you
associate it with, let's call that vector y, if you make
this association, that too is a function. And that might have already been
obvious to you and this would be a function that's
mapping from rn to rm. And actually, I just want
to make one little special note here. When I just drew the arrow like
this, this shows that I'm mapping between two sets. I'm taking elements of this set
and I'm associating with them with elements
of that set. Now, in the last video you
probably saw this. I wanted to do the side note
note because I realized it might've been confusing. I introduced you to another
way of writing a function like this. Where I said f could be defined
as a mapping for any given x to x squared. And I just want to make a
note on the notation. When I just have a regular arrow
I'm going between sets. When I have this little vertical
line at the base of the arrow, that's kind of
the function definition. It tells me for any x you give
me in the first set, in the second set I'm going to
associate this x with, in this case, x squared. Anyway, I just wanted to
make that side note. But the whole direction I was
going in is that vectors are valid elements of sets,
functions are just mappings between elements of sets,
so you could have functions of vectors. And I even touched on that a
little bit in the last video when I talked about
vector-valued functions. If your codomain is a subset of
rm, where m is greater than 1, then we say your function
is vector-valued. It's not just mapping into
the real numbers. It's mapping into some m-tuple
of real numbers. So if you mapped two-dimensional
space, you're dealing with a vector-valued
function. Now I've been all abstract and
whatnot, so let me actually deal with some vectors and it
might make everything a little bit more concrete. So let's say I define the
function f as f of x1, x2, and x3, is equal to x1 plus
2x2 and the second coordinate is just 3x3. And actually, I haven't formally
defined coordinates for you yet, but I think you
understand that just from your basic algebra training. So let's say that that's my
function definition based on the notation that we've
been introduced to. We could say that f is a mapping
from -- its domain is r3 -- and it maps from r3, or it
associates all values in r3 with some value in r2. This is a 2-tuple. Right? So this is an r2 This
is 3-tuple. Right? Or another way we could do this,
if we just wanted to write it in vector notation, I
could write that f -- if you pass f to some vector x1, x2,
x3, I could say this will be equal to the vector -- and
now it's going to have a two-component vector. It's going to be a vector in r2
where the first term is x1 plus 2x2 and the second
term is 3x3. So let's play around with
this a little bit. See what it does for us, what
it does to the vectors. So what is f of the
vector 1, 1, 1? Well, I get 1 plus 2 times 1
is, I get the vector 3, and then my second term is just 3
times this one, so I get the vector 3, 3. Fair enough, let me
do another one. Just to really experiment
with this mapping. If I take the f of the vector in
r3 2, 4, 1, what do I get? That equals 2 plus 2 times 4. That goes to the vector 10. 2 plus 2 times 4 and
then 3 times the third term right there. So the vector 10, 3. So how can we visualize this? Well, three-dimensional vectors
-- or vectors in r3 -- are not always the easiest to
visualize, but I think we can attempt to visualize
these two guys. So let's say that this is the
x1-axis, that's the x2-axis, that's the x3-axis. So this first vector right here,
this yellow one, 1, 1, 1, it will look like
this -- 1, 1, 1. And so if I were to go out here,
then go out here, then go up 1, the point would be
right there and if I were to draw it in standard position,
I'd start at the origin, and the vector looks something
like that. And then the second guy, 2, 4,
1, it would look like this. It would go 2 out here,
we'd go 4 this direction, 1, 2, 3, 4. And then we'd go 1 up. So it looks something
like this. 2, 4, 1. I think you get the idea. So I've drawn these two vectors
that are essentially in my domain. Our domain is r3. This is our r3 right here. And let's see what
our function maps these vectors to. So what's our codomain? Our codomain is r2, so this
is much easier to visualize for us. So we just have to draw
two axes like this. Let's call this x1 and
let's call this x2. And so what does f of 1, 1, 1 --
of this yellow vector -- it becomes 3, 3. So if I do it in yellow,
1, 2, 3, 1, 2, 3. So it gets me this one. If I draw it in standard
position the vector looks like this. So, literally, our function
went from mapped from this vector in r3 to this
vector in r2. That was what our
function did. Likewise, if we take the other
vector, we went from this 2, 4, 1 vector to sector 10, 3. So 1, 2, 3, 4, 5,
6, 7, 8, 9, 10. So it's going to look
something like this. And it's going to be 3 up,
so it's going to look something like this. So this vector right here, by
our function, f, got mapped -- let me do a different color
-- to this vector. This vector right here in r3 got
mapped to this vector in r2 by our function. Now this is just a switch
of terminology. When we talk about functions
of vectors the term that we tend to use is the word
transformation. But it really is the exact
same thing as a function. I don't want to confuse you,
because if you watch the differential equations playlist,
you saw the idea of a Laplace transformation, which
is really an operation that takes a function
as an argument. But in this case, and when
we're dealing into linear algebra world, a transformation
is really just a function operating on vectors
-- or the way we're going to use it -- it's just a
function operating on vectors. And so the general notation,
instead of writing a lowercase f like that, for a function,
people use an uppercase T to say it's a transformation. Although it doesn't have
to be an uppercase T. But that's the one that people
use the most. Just like this could be a g or an h,
but people always use a lowercase f. So the same way we could have
written this, we could have called this a transformation. And my sense of why, in the
linear algebra world, they use this, is because you kind of
imagine that this vector is being changed into
that vector. Or that this is vector is being transformed into that vector. I think that's why they call it
a transformation as opposed to a function. And it actually makes a lot
more sense when you start going into things like video
game programming. And a lot of what we're
embarking on with our transformations is key to
video game programming. But you're kind of transforming
one image into another image if you're viewing
at it from a different angle or whatever else
you might want to do. We'll talk a lot more about
that in the future. But I just wanted to introduce
you to this notation. So these statements, I could
have replaced all my f's with T's and I could have defined
some transformation. And I just want to make you
comfortable the notation. I could have defined it
similarly, a transformation from r3 to r2 and I could have
said that T of x1, x2, x3 is equal to the 2-tuple x1 plus 2
x1 comma 3x3 And I could have, just as similarly put a T up
here because I have defined it the same way. I could have said T of
my vector 1, 1, 1 is equal to 3, 3. Now, you might say, hey Sal, why
are you going through all this trouble of replacing
T's with f's? I'm just doing this so you
don't get confused. So that when you see in your
linear algebra book, when you see linear algebra problems,
when you see this big capital T and you're like, wow, I've
never seen that before and they're using this fancy word
called a transformation. This is completely identical to
your notion of a function. It is a function. In the next video I'm going
to talk about linear transformations. That's really just
linear functions. And I'll define that
a little bit more precisely in the next video. But hopefully by watching this
video you at least have a sense that you can apply
functions to vectors and, in the linear algebra world,
we tend to call those transformations. And hopefully this example
right here gives you, at least, a visual representation
of why it's called a transformation. We're transforming from
one vector to another.