Main content

## Functions and linear transformations

Current time:0:00Total duration:14:19

# Vector transformations

## 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.