Linear transformations as matrix vector products

WEBVTT
Kind: captions
Language: en

00:00:00.650 --> 00:00:04.620
Let's say I have an n-by-n
matrix that looks like this.

00:00:04.620 --> 00:00:07.870
So let me just see if I can
do it in general terms.

00:00:07.870 --> 00:00:11.010
In the first row and first
column, that entry has a 1,

00:00:11.010 --> 00:00:14.630
and then everything else, the
rest of the n minus 1 rows in

00:00:14.630 --> 00:00:16.465
that first column are all
going to be zeroes.

00:00:16.465 --> 00:00:20.990
So it's going to be zeroes all
the way down to the nth term.

00:00:20.990 --> 00:00:24.630
And then the second column,
we have a 0 in the first

00:00:24.630 --> 00:00:29.060
component, but then a 1 in
the second component.

00:00:29.060 --> 00:00:31.440
And then it goes zeroes
all the way down.

00:00:31.440 --> 00:00:34.460
And you keep doing this.

00:00:34.460 --> 00:00:36.635
In the third row, or let me say
third column, although it

00:00:36.635 --> 00:00:39.060
would've applied to the third
row as well, the 1 shows up in

00:00:39.060 --> 00:00:42.950
the third component, and then
it's zeroes all the way down.

00:00:42.950 --> 00:00:46.100
Essentially, you have the ones
filling up the diagonal of

00:00:46.100 --> 00:00:47.210
this matrix right here.

00:00:47.210 --> 00:00:50.860
So if you go all the way to
the nth column or the nth

00:00:50.860 --> 00:00:53.680
column vector, you have a bunch
of zeroes until you

00:00:53.680 --> 00:00:56.330
get-- you have n minus 1 zeroes,
and then the very last

00:00:56.330 --> 00:00:58.300
component, the nth component
there will be a 1.

00:00:58.300 --> 00:01:01.640
So you have essentially,
a matrix with

00:01:01.640 --> 00:01:03.580
ones down the diagonal.

00:01:03.580 --> 00:01:05.610
Now, this matrix has a bunch of
neat properties and we'll

00:01:05.610 --> 00:01:07.070
explore it more in the future.

00:01:07.070 --> 00:01:10.180
But I'm just exposing you to
this because it has one very

00:01:10.180 --> 00:01:13.410
neat property relative to
linear transformations.

00:01:13.410 --> 00:01:15.950
But I'm going to call this the
identity matrix and I'll call

00:01:15.950 --> 00:01:19.550
this I sub n, and I called that
sub n because it's an

00:01:19.550 --> 00:01:21.690
n-by-n identity matrix.

00:01:21.690 --> 00:01:26.690
I sub 2 would be equal to a
2-by-2 identity matrix, so it

00:01:26.690 --> 00:01:28.700
would look like that.

00:01:28.700 --> 00:01:36.340
And I sub 3 would look like
this: 1 0 0, 0 1 0, 0 0 1.

00:01:36.340 --> 00:01:37.690
I think you get the point.

00:01:37.690 --> 00:01:40.390
Now, the neat thing about this
identity matrix becomes

00:01:40.390 --> 00:01:44.650
evident when you multiply
it times any vector.

00:01:44.650 --> 00:01:48.660
We can multiply this guy times
the n-component vector, a

00:01:48.660 --> 00:01:49.910
member of Rn.

00:01:49.910 --> 00:01:51.430
So let's do that.

00:01:51.430 --> 00:01:55.720
So if we multiply this
matrix times-- let's

00:01:55.720 --> 00:01:56.840
call this vector x.

00:01:56.840 --> 00:02:02.460
This is x1, x2, all the way down
to xn, what is this going

00:02:02.460 --> 00:02:04.290
to be equal to?

00:02:04.290 --> 00:02:06.130
So this is vector
x right here.

00:02:06.130 --> 00:02:12.430
So if I multiply matrix I, my
identity matrix, I sub n, and

00:02:12.430 --> 00:02:17.410
I multiply it times my vector x,
where x is a member of Rn,

00:02:17.410 --> 00:02:20.840
has n components, what
am I going to get?

00:02:20.840 --> 00:02:25.035
Well, I'm going to get 1 times
x1 plus 0 times x2 plus 0

00:02:25.035 --> 00:02:26.940
times x3 plus 0 times
x4, all of that.

00:02:26.940 --> 00:02:28.730
So essentially, I'm going to
have-- you can kind of view it

00:02:28.730 --> 00:02:31.340
as this row dotted
with the vector.

00:02:31.340 --> 00:02:32.980
So the only nonzero term
is going to be

00:02:32.980 --> 00:02:34.200
the 1 times the x1.

00:02:34.200 --> 00:02:38.330
So it's going to be x1-- sorry,
let me do it like this.

00:02:38.330 --> 00:02:45.190
So you're going to get another
vector in Rn like that.

00:02:45.190 --> 00:02:48.350
And so the first term is that
row essentially being dotted

00:02:48.350 --> 00:02:51.440
with that column, and
so you just get x1.

00:02:51.440 --> 00:02:57.130
And then the next entry is going
to be this row, or you

00:02:57.130 --> 00:02:59.620
could view it as the transpose
of this row dotted with that

00:02:59.620 --> 00:03:04.090
column, so 0 times x1 plus
1 times x2 plus 0 times

00:03:04.090 --> 00:03:04.710
everything else.

00:03:04.710 --> 00:03:07.380
So the only nonzero term
is the 1 times x2, so

00:03:07.380 --> 00:03:08.680
you get an x2 there.

00:03:08.680 --> 00:03:10.660
And then you keep doing thatt,
and what are you going to get?

00:03:10.660 --> 00:03:13.470
You're going to get an x3
because the only nonzero term

00:03:13.470 --> 00:03:15.070
here is the third one and you're
going to go all the way

00:03:15.070 --> 00:03:17.370
down until you get an xn.

00:03:17.370 --> 00:03:18.520
But what is this
thing equal to?

00:03:18.520 --> 00:03:20.690
This is just equal to x.

00:03:20.690 --> 00:03:24.050
So the neat thing about this
identity matrix that we've

00:03:24.050 --> 00:03:26.780
created is that when you
multiply it times any vector,

00:03:26.780 --> 00:03:27.850
you got the vector again.

00:03:27.850 --> 00:03:31.910
The identity matrix times any
vector in Rn-- it's only

00:03:31.910 --> 00:03:37.130
defined for vectors in Rn-- is
equal to that vector again.

00:03:37.130 --> 00:03:42.810
And actually, the columns of
the identity matrix have a

00:03:42.810 --> 00:03:49.240
special-- I guess the set of
columns has a special name.

00:03:49.240 --> 00:03:55.610
So if we call this first column
e1 and this second

00:03:55.610 --> 00:04:05.050
column e2 and the third column
e3 and we go all the way to

00:04:05.050 --> 00:04:08.670
en, these vectors, these column
vectors here, the set

00:04:08.670 --> 00:04:15.410
of these-- so let's say e1, e2,
all the way to en-- this

00:04:15.410 --> 00:04:24.390
is called the standard
basis for Rn.

00:04:24.390 --> 00:04:25.410
So why is it called that?

00:04:25.410 --> 00:04:29.000
Well, the word basis is there,
so two things must be true.

00:04:29.000 --> 00:04:32.120
These things must span Rn and
they must be linearly

00:04:32.120 --> 00:04:32.940
independent.

00:04:32.940 --> 00:04:35.060
It's pretty obvious from
inspection they're linearly

00:04:35.060 --> 00:04:35.530
independent.

00:04:35.530 --> 00:04:38.340
If this guy has a 1 here and
no one else has a 1 there,

00:04:38.340 --> 00:04:40.400
there's no way you can construct
that 1 with some

00:04:40.400 --> 00:04:41.600
combination of the
rest of the guys.

00:04:41.600 --> 00:04:44.060
And you can make that same
argument for each of the ones

00:04:44.060 --> 00:04:44.805
in each of the components.

00:04:44.805 --> 00:04:47.220
So it's clearly linearly
independent.

00:04:47.220 --> 00:04:50.620
And then to see that you can
span, that you can construct

00:04:50.620 --> 00:04:55.420
any vector with a linear
combination of these guys, you

00:04:55.420 --> 00:04:57.650
just really have to-- you know,
whatever vector you want

00:04:57.650 --> 00:05:00.900
to construct, if you want
to construct x1-- let

00:05:00.900 --> 00:05:01.460
me put it this way.

00:05:01.460 --> 00:05:04.380
If you want to construct
this vector-- let me

00:05:04.380 --> 00:05:04.980
write it this way.

00:05:04.980 --> 00:05:06.480
Let me pick a different one.

00:05:06.480 --> 00:05:11.560
Let's say you want to construct
the vector a1, a2,

00:05:11.560 --> 00:05:13.880
a3 all the way down to an.

00:05:13.880 --> 00:05:15.610
So this is some member
of Rn, you want to

00:05:15.610 --> 00:05:17.060
construct this vector.

00:05:17.060 --> 00:05:20.060
Well, the linear combination
that would get you this is

00:05:20.060 --> 00:05:28.370
literally a1 times e1 plus a2
times e2 plus all the way to

00:05:28.370 --> 00:05:29.620
an times en.

00:05:32.240 --> 00:05:37.140
This scalar times this first
column vector will essentially

00:05:37.140 --> 00:05:39.200
just get you-- what will
this look like?

00:05:39.200 --> 00:05:41.510
This will look like
a1 and then you'd

00:05:41.510 --> 00:05:42.850
have a bunch of zeroes.

00:05:42.850 --> 00:05:48.060
You'd have n minus 1 zeroes plus
0 and you'd have an a2

00:05:48.060 --> 00:05:49.690
and then you'd have
a bunch of zeroes.

00:05:49.690 --> 00:05:53.320
And then you'd keep doing that,
and then you would have

00:05:53.320 --> 00:05:55.370
a bunch of zeroes, and then
you would have an an.

00:05:55.370 --> 00:05:58.370
Obviously, by our definition
of vector addition, you add

00:05:58.370 --> 00:06:00.880
all these things up, you get
this guy right here.

00:06:00.880 --> 00:06:04.430
And it's kind of obvious,
because this right here is the

00:06:04.430 --> 00:06:08.880
same thing as our identity
matrix times a1.

00:06:08.880 --> 00:06:10.930
I just wanted to expose
you to that idea.

00:06:10.930 --> 00:06:14.670
Now, let's apply what we already
know about linear

00:06:14.670 --> 00:06:17.450
transformations to what we've
just learned about this

00:06:17.450 --> 00:06:19.090
identity matrix.

00:06:19.090 --> 00:06:20.980
I just told you that
I can represent

00:06:20.980 --> 00:06:23.210
any vector like this.

00:06:23.210 --> 00:06:25.180
Let me rewrite it in
maybe terms of x.

00:06:25.180 --> 00:06:32.940
I can write any vector x as a
linear combination of the

00:06:32.940 --> 00:06:36.210
standard basis, which are really
just the columns of the

00:06:36.210 --> 00:06:37.310
identity matrix.

00:06:37.310 --> 00:06:43.060
I can write that as x1 times e1
plus x2 times e2, all the

00:06:43.060 --> 00:06:45.430
way to xn times en.

00:06:45.430 --> 00:06:49.430
And remember, each of these
column vectors right here,

00:06:49.430 --> 00:06:54.820
like for e1, is just 1 in the
first entry and then all the

00:06:54.820 --> 00:06:57.020
rest are zeroes. e2 is a 1
in the second entry and

00:06:57.020 --> 00:06:59.410
everything else is 0.

00:06:59.410 --> 00:07:03.050
e5 is a 1 in the fifth entry
and everything else is 0.

00:07:03.050 --> 00:07:05.270
And this I just showed you, and
this is a bit obvious from

00:07:05.270 --> 00:07:06.290
this right here.

00:07:06.290 --> 00:07:09.520
Now, we know that by definition,
a linear

00:07:09.520 --> 00:07:20.680
transformation of x-- let
me put it this way.

00:07:20.680 --> 00:07:25.350
A linear transformation of x,
of our vector x, is the same

00:07:25.350 --> 00:07:27.440
thing as taking the linear
transformation of this whole

00:07:27.440 --> 00:07:29.550
thing-- let me do it in another
color-- is equal to

00:07:29.550 --> 00:07:38.050
the linear transformation of--
actually, instead of using L,

00:07:38.050 --> 00:07:38.740
let me use T.

00:07:38.740 --> 00:07:42.290
I used L by accident because
I was thinking linear.

00:07:42.290 --> 00:07:45.930
But if I were take the linear
transformation of x, because

00:07:45.930 --> 00:07:48.540
that's the notation we're used
to, that's the same thing as

00:07:48.540 --> 00:07:50.830
taking a linear transformation
of this thing.

00:07:50.830 --> 00:07:51.840
They're equivalent.

00:07:51.840 --> 00:07:58.510
So x1 times e1 plus x2 times
e2, all the way to

00:07:58.510 --> 00:08:01.800
plus xn times en.

00:08:01.800 --> 00:08:03.340
It's equivalent statements.

00:08:03.340 --> 00:08:06.750
Now, from the definition of
linear transformations, we

00:08:06.750 --> 00:08:09.330
know that this is the same
thing, that the transformation

00:08:09.330 --> 00:08:12.230
of the sum is equal to the sum
of the transformation.

00:08:12.230 --> 00:08:18.800
So this is equal to the
transformation of x1 e1 plus

00:08:18.800 --> 00:08:22.850
the transformation of x2 e2
where this is just any linear

00:08:22.850 --> 00:08:23.510
transformation.

00:08:23.510 --> 00:08:24.670
Let me make that very clear.

00:08:24.670 --> 00:08:26.660
This is any linear
transformation.

00:08:30.860 --> 00:08:33.230
By definition, linear
transformations have to

00:08:33.230 --> 00:08:34.850
satisfy these properties.

00:08:34.850 --> 00:08:39.289
So the transformation times
x2 e2, all the way to this

00:08:39.289 --> 00:08:43.940
transformation times this last
entry, the scalar xn times my

00:08:43.940 --> 00:08:47.320
standard basis vector en.

00:08:47.320 --> 00:08:49.190
And we know from the other
property of linear

00:08:49.190 --> 00:08:53.220
transformations that the
transformation of a vector

00:08:53.220 --> 00:08:58.690
multiplied by the scalar is the
same thing as the scalar

00:08:58.690 --> 00:09:04.390
multiplied by the transformation
of the vector.

00:09:04.390 --> 00:09:05.950
That's just from our definition
of linear

00:09:05.950 --> 00:09:06.630
transformations.

00:09:06.630 --> 00:09:12.580
Plus x2 two times the
transformation of e2 plus all

00:09:12.580 --> 00:09:19.560
the way to xn times the
transformation of en.

00:09:19.560 --> 00:09:20.730
Now, what is this?

00:09:20.730 --> 00:09:23.860
I could rewrite this, so
everything I've done so far,

00:09:23.860 --> 00:09:28.280
so the transformation of x is
equal to that, which just

00:09:28.280 --> 00:09:31.170
using our properties of linear
transformations, all linear

00:09:31.170 --> 00:09:33.780
transformations, this has
to be true for them.

00:09:33.780 --> 00:09:36.410
I get to this and this
is equivalent.

00:09:36.410 --> 00:09:40.600
This is equal to-- if we view
each of these as a column

00:09:40.600 --> 00:09:45.350
vector, this is equal to what?

00:09:45.350 --> 00:09:49.140
This is equal to the matrix
where this is the first

00:09:49.140 --> 00:09:53.300
column, T e1.

00:09:53.300 --> 00:09:56.960
And then the second
column is T e2.

00:09:56.960 --> 00:10:03.970
And then we go all the way to
T en times-- let me put it

00:10:03.970 --> 00:10:07.640
this way-- x1, x2, all
the way to xn.

00:10:07.640 --> 00:10:10.090
We've seen this multiple,
multiple times.

00:10:10.090 --> 00:10:13.290
Now what's really, really,
really neat about this is I

00:10:13.290 --> 00:10:16.270
just started with an arbitrary
transformation.

00:10:16.270 --> 00:10:19.520
And I just showed that
an arbitrary linear

00:10:19.520 --> 00:10:23.350
transformation of x can be
rewritten as a product of a

00:10:23.350 --> 00:10:27.460
matrix where I'm taking that
same linear transformation of

00:10:27.460 --> 00:10:31.320
each of our standard basis
vectors, and I can construct

00:10:31.320 --> 00:10:34.480
that matrix, and multiplying
that matrix times my x vector

00:10:34.480 --> 00:10:36.770
is the same thing as this
transformation.

00:10:36.770 --> 00:10:42.000
So this is essentially showing
you that all transformations--

00:10:42.000 --> 00:10:42.940
let me be careful.

00:10:42.940 --> 00:10:53.500
All linear transformations can
be a matrix vector product.

00:10:53.500 --> 00:10:55.540
Not only did I show you that
you can do it, but it's

00:10:55.540 --> 00:10:57.430
actually a fairly
straightforward thing to do.

00:10:57.430 --> 00:11:01.340
This is actually a pretty
simple operation to do.

00:11:01.340 --> 00:11:04.960
Let me show you an example.

00:11:04.960 --> 00:11:06.700
I don't know, I think
this is super neat.

00:11:06.700 --> 00:11:08.810
Let's say that I just-- I'm
just going to make up some

00:11:08.810 --> 00:11:09.610
transformation.

00:11:09.610 --> 00:11:11.650
Let's say I have a
transformation and it's a

00:11:11.650 --> 00:11:14.720
mapping between-- let's make
it extra interesting--

00:11:14.720 --> 00:11:18.580
between R2 and R3.

00:11:18.580 --> 00:11:22.090
And let's say my transformation,
let's say that

00:11:22.090 --> 00:11:30.030
T of x1 x2 is equal to-- let's
say the first entry is x1 plus

00:11:30.030 --> 00:11:37.620
3x2, the second entry is 5x2
minus x1, and let's say the

00:11:37.620 --> 00:11:43.390
third entry is 4x1 plus x2.

00:11:43.390 --> 00:11:44.190
This is a mapping.

00:11:44.190 --> 00:11:45.150
I could have written
it like this.

00:11:45.150 --> 00:11:52.620
I could write T of any vector
in R2, x1, x2, is equal to--

00:11:52.620 --> 00:11:54.560
and maybe this is just
redundant, but I

00:11:54.560 --> 00:11:55.500
think you get the idea.

00:11:55.500 --> 00:12:02.520
I like this notation better. x1
plus 3x2, 5x2 minus x1, and

00:12:02.520 --> 00:12:05.080
then 4x1 plus x2.

00:12:05.080 --> 00:12:07.650
This statement and this
statement I just wrote are

00:12:07.650 --> 00:12:07.830
equivalent.

00:12:07.830 --> 00:12:10.060
And I like to visualize this
a little bit more.

00:12:10.060 --> 00:12:12.030
Now, I just told you that
I can represent this

00:12:12.030 --> 00:12:15.330
transformation as a matrix
vector product.

00:12:15.330 --> 00:12:16.360
How do I do it?

00:12:16.360 --> 00:12:20.530
Well, what I do is I take the
transformation of this guy.

00:12:20.530 --> 00:12:25.260
My domain right here is R2, and
I produce a vector that's

00:12:25.260 --> 00:12:26.610
going to be in Rn.

00:12:26.610 --> 00:12:28.330
So what I do is, let's see.

00:12:28.330 --> 00:12:33.320
So I'm concerned with
multiplying things times

00:12:33.320 --> 00:12:34.840
vectors in R2.

00:12:34.840 --> 00:12:37.940
So what we're going to do is
we're going to start with the

00:12:37.940 --> 00:12:42.350
identity matrix, identity 2
because that's my domain and

00:12:42.350 --> 00:12:47.300
it just looks like
this: 1, 0, 0, 1.

00:12:47.300 --> 00:12:48.770
I'm just going to
start with that.

00:12:48.770 --> 00:12:51.940
And all I do is I apply my
transformation to each of the

00:12:51.940 --> 00:12:54.340
columns, each of my
standard bases.

00:12:54.340 --> 00:12:56.095
These are the standard
bases for R2.

00:13:00.150 --> 00:13:01.960
I showed you that they're bases,
how do I know that

00:13:01.960 --> 00:13:03.110
they're standard?

00:13:03.110 --> 00:13:05.080
Why are they called the
standard bases?

00:13:05.080 --> 00:13:07.560
And I haven't covered this in a
lot of detail right yet, but

00:13:07.560 --> 00:13:11.210
you could take the dot product
of any of these guys with any

00:13:11.210 --> 00:13:12.620
of the other guys, and you'll
see that they're all

00:13:12.620 --> 00:13:13.660
orthogonal to each other.

00:13:13.660 --> 00:13:15.510
The dot product of any one of
these columns with the other

00:13:15.510 --> 00:13:18.000
is always zero, so that's
a nice clue.

00:13:18.000 --> 00:13:21.230
And they all have length of 1,
so that's a nice reason why

00:13:21.230 --> 00:13:22.530
they're called the
standard bases.

00:13:22.530 --> 00:13:26.240
But anyway, back to our attempt
to represent this

00:13:26.240 --> 00:13:29.190
transformation as a matrix
vector product.

00:13:29.190 --> 00:13:34.000
So we say look, our domain is in
R2, so let's start with I2,

00:13:34.000 --> 00:13:38.450
or we could call it our 2-by-2
identity matrix.

00:13:38.450 --> 00:13:41.280
And let's apply the
transformation to each of its

00:13:41.280 --> 00:13:43.850
column vectors where each of
its column vectors are a

00:13:43.850 --> 00:13:45.750
vector in the standard
basis for R2.

00:13:50.630 --> 00:13:54.900
So I'm going to write
it like this.

00:13:54.900 --> 00:13:58.790
The first column is T of this
column, and then the second

00:13:58.790 --> 00:14:05.910
column is going to
be T of 0, 1.

00:14:05.910 --> 00:14:09.860
And I know I'm getting messier
with my handwriting.

00:14:09.860 --> 00:14:15.160
What is T of the vector 1, 0?

00:14:15.160 --> 00:14:16.670
Well, we just go here.

00:14:16.670 --> 00:14:18.690
We construct another vector.

00:14:18.690 --> 00:14:22.540
So we get 1 plus
3 times 0 is 1.

00:14:22.540 --> 00:14:27.930
Then we get 5 times 0 minus
1, so that's minus 1.

00:14:27.930 --> 00:14:29.740
x2 is zero in this case.

00:14:29.740 --> 00:14:35.820
And then we get 4 times 1 plus
0, so that's just 4.

00:14:35.820 --> 00:14:37.850
So that's T of 1, 0.

00:14:37.850 --> 00:14:46.500
And then what is T of 0, 1?

00:14:46.500 --> 00:14:53.410
T of 0, 1 is equal to-- so we
have 0 plus 3 times 1 is 3.

00:14:53.410 --> 00:14:59.260
Then we have 0 minus
1 is minus 1.

00:14:59.260 --> 00:15:00.930
Let me make sure I did
this one right.

00:15:00.930 --> 00:15:01.540
What was this?

00:15:01.540 --> 00:15:03.860
This was 5 times 1 minus 1.

00:15:06.400 --> 00:15:10.750
Yeah, 5 times 0 minus
x1, which is 1.

00:15:10.750 --> 00:15:15.280
Now, this case, it's 5 times--
oh, I have to be careful.

00:15:15.280 --> 00:15:16.960
This is 5 times x2.

00:15:16.960 --> 00:15:17.510
x2 is 1.

00:15:17.510 --> 00:15:22.970
So 5 times 1 minus
0, so it's 5.

00:15:22.970 --> 00:15:28.490
And then I have 4 times
0 plus x2, plus 1.

00:15:28.490 --> 00:15:31.820
And I just showed you if I
replace each of these standard

00:15:31.820 --> 00:15:33.910
basis vectors with the
transformation of

00:15:33.910 --> 00:15:35.550
them, what do I get?

00:15:35.550 --> 00:15:37.860
I get this vector right here.

00:15:37.860 --> 00:15:39.410
So I already figured
out what they are.

00:15:42.690 --> 00:15:45.280
If I take this guy and evaluate
it, it's the vector

00:15:45.280 --> 00:15:48.250
1, minus 1, 4.

00:15:48.250 --> 00:15:54.620
And then this guy is the
vector 3, 5, and 1.

00:15:54.620 --> 00:15:57.410
So what we just did and this
is-- I don't know.

00:15:57.410 --> 00:15:59.790
For some reason, I find this
to be pretty amazing.

00:15:59.790 --> 00:16:03.800
We can now rewrite this
transformation here as the

00:16:03.800 --> 00:16:05.720
product of any vector.

00:16:05.720 --> 00:16:09.770
So if we define this to be equal
to a, or we could write

00:16:09.770 --> 00:16:10.290
it this way.

00:16:10.290 --> 00:16:12.210
We can now write our
transformation.

00:16:12.210 --> 00:16:17.950
Our transformation of x1, x2
can now be rewritten as the

00:16:17.950 --> 00:16:20.430
product of this vector.

00:16:20.430 --> 00:16:22.070
I'll write it in green.

00:16:22.070 --> 00:16:31.720
The vector 1, 3, minus 1, 5, 4,
1 times our input vector,

00:16:31.720 --> 00:16:36.200
x1, x2, which is super cool
because now we just have to do

00:16:36.200 --> 00:16:37.660
a matrix multiplication.

00:16:37.660 --> 00:16:39.770
Instead of this, and if we have
some processor that does

00:16:39.770 --> 00:16:42.920
this super fast, we
can then use that.

00:16:42.920 --> 00:16:46.050
I don't know, I think this is
especially elegant, because

00:16:46.050 --> 00:16:49.310
what happens here is we applied
the transformations to

00:16:49.310 --> 00:16:52.090
each of the columns of a 2-by-2
matrix, and we got a

00:16:52.090 --> 00:16:55.620
3-by-2 matrix.

00:16:55.620 --> 00:16:58.380
And we know what happens when
you multiply a 3-by-2 matrix

00:16:58.380 --> 00:17:00.550
times a vector that's in R2.

00:17:00.550 --> 00:17:05.420
Or you can almost view this
as a 2-by-1 matrix.

00:17:05.420 --> 00:17:09.579
You're going to get a vector
that is in R3.

00:17:09.579 --> 00:17:11.790
Because you're going to have
these guys times that guy's

00:17:11.790 --> 00:17:12.609
going to be the first term.

00:17:12.609 --> 00:17:13.846
These guys times these
guys are going to

00:17:13.846 --> 00:17:14.800
be the second term.

00:17:14.800 --> 00:17:16.230
These guys times those
guys are going to

00:17:16.230 --> 00:17:17.569
be the third term.

00:17:17.569 --> 00:17:22.040
So by kind of creating this
3-by-2 matrix, we have

00:17:22.040 --> 00:17:25.510
actually created a mapping
from R2 to R3.

00:17:25.510 --> 00:17:28.470
Anyway, for some reason I find
this to be especially neat.

00:17:28.470 --> 00:17:31.470
Hopefully, at least you find
this somewhat instructive.


Matrix vector products as linear transformations

WEBVTT
Kind: captions
Language: en

00:00:00.720 --> 00:00:04.350
I think you're pretty familiar
with the idea of matrix vector

00:00:04.350 --> 00:00:07.860
products and what I want to do
in this video is show you that

00:00:07.860 --> 00:00:12.440
taking a product of a vector
with a matrix is equivalent to

00:00:12.440 --> 00:00:13.490
a transformation.

00:00:13.490 --> 00:00:16.020
It's actually a linear
transformation.

00:00:16.020 --> 00:00:20.630
Let's say we have some matrix A
and let's say that its terms

00:00:20.630 --> 00:00:26.870
are, or its columns are v1--
column vector is v2,

00:00:26.870 --> 00:00:29.130
all the way to vn.

00:00:29.130 --> 00:00:31.490
So this guy has n columns.

00:00:31.490 --> 00:00:32.780
Let's say it has m rows.

00:00:32.780 --> 00:00:36.260
So it's an m by n matrix.

00:00:36.260 --> 00:00:38.126
And let's say I define
some transformation.

00:00:42.500 --> 00:00:51.380
Let's say my transformation
goes from Rn to Rm.

00:00:51.380 --> 00:00:52.300
This is the domain.

00:00:52.300 --> 00:00:56.650
I can take any vector in Rn
and it will map it to some

00:00:56.650 --> 00:00:57.730
factor in Rm.

00:00:57.730 --> 00:00:59.650
And I define my transformation.

00:00:59.650 --> 00:01:06.990
So T of x where this is some
vector in Rn, is equal to A--

00:01:06.990 --> 00:01:09.050
this is this A.

00:01:09.050 --> 00:01:11.040
Let me write it in this
color right here.

00:01:11.040 --> 00:01:12.120
And it should be bolded.

00:01:12.120 --> 00:01:14.590
I kind of get careless sometimes
with the bolding.

00:01:14.590 --> 00:01:18.370
But big bold A times
the vector x.

00:01:18.370 --> 00:01:22.150
So the first thing you might,
Sal, this transformation looks

00:01:22.150 --> 00:01:25.510
very odd relative to how we've
been defining transformations

00:01:25.510 --> 00:01:26.830
or functions so far.

00:01:26.830 --> 00:01:29.770
So the first thing we have to
just feel comfortable with is

00:01:29.770 --> 00:01:31.680
the idea that this is
a transformation.

00:01:31.680 --> 00:01:32.430
So what are we doing?

00:01:32.430 --> 00:01:35.530
We're taking something
from Rn and then

00:01:35.530 --> 00:01:36.780
what does A x produce?

00:01:41.430 --> 00:01:45.220
If we write A x like this, if
this is x where it's x1, x2.

00:01:45.220 --> 00:01:49.220
It's going to have n terms
because it's in Rn.

00:01:49.220 --> 00:01:56.760
This can be rewritten as x1
times v1 plus x2 times v2, all

00:01:56.760 --> 00:02:00.690
the way to xn times vn.

00:02:00.690 --> 00:02:04.280
So it's going to be a sum of a
bunch of these column vectors.

00:02:04.280 --> 00:02:09.100
And each of these columns
vectors, v1, v2, all the way

00:02:09.100 --> 00:02:12.670
to vn, what set are
they members of?

00:02:12.670 --> 00:02:16.280
This is an m by n matrix, so
they're going to have m-- the

00:02:16.280 --> 00:02:18.620
matrix has m rows, or
each of these column

00:02:18.620 --> 00:02:20.720
vectors will have m entries.

00:02:20.720 --> 00:02:23.430
So all of these guys
are members of Rm.

00:02:23.430 --> 00:02:25.870
So if I just take a linear
combination of all of these

00:02:25.870 --> 00:02:30.310
guys, I'm going to get
another member of Rm.

00:02:30.310 --> 00:02:33.440
So this guy right here is going
to be a member of Rm,

00:02:33.440 --> 00:02:34.540
another vector.

00:02:34.540 --> 00:02:39.590
So clearly, by multiplying my
vector x times a, I'm mapping,

00:02:39.590 --> 00:02:46.840
I'm creating a mapping from Rn--
and let me pick another

00:02:46.840 --> 00:02:50.780
color-- to Rm.

00:02:50.780 --> 00:02:53.640
And I'm saying it in very
general terms. Maybe n is 3,

00:02:53.640 --> 00:02:54.810
maybe m is 5.

00:02:54.810 --> 00:02:55.300
Who knows?

00:02:55.300 --> 00:02:58.225
But I'm saying it in very
general terms. And so if this

00:02:58.225 --> 00:03:03.340
is a particular instance, a
particular member of set Rn,

00:03:03.340 --> 00:03:06.800
so it's that vector, our
transformation or our function

00:03:06.800 --> 00:03:09.910
is going to map it to
this guy right here.

00:03:09.910 --> 00:03:12.290
And this guy will be a
member of Rm and we

00:03:12.290 --> 00:03:14.570
could call him a x.

00:03:14.570 --> 00:03:16.660
Or maybe if we said a x equaled
b we could call him

00:03:16.660 --> 00:03:18.150
the vector b-- whatever.

00:03:18.150 --> 00:03:20.460
But this is our transformation
mapping.

00:03:20.460 --> 00:03:27.540
So this does fit our kind of
definition or our terminology

00:03:27.540 --> 00:03:30.480
for a function or a
transformation as a mapping

00:03:30.480 --> 00:03:31.760
from one set to another.

00:03:31.760 --> 00:03:34.490
But it still might not be
satisfying because everything

00:03:34.490 --> 00:03:36.900
we saw before looked
kind of like this.

00:03:36.900 --> 00:03:39.690
If we had a transformation
I would write it like the

00:03:39.690 --> 00:03:45.040
transformation of-- I would
write, you know, x1 and x2 and

00:03:45.040 --> 00:03:47.100
xn is equal to.

00:03:50.670 --> 00:03:54.450
I'd write m terms
here in commas.

00:03:54.450 --> 00:03:55.740
How does this relate to that?

00:03:55.740 --> 00:03:58.480
And to do that I'll do
a specific example.

00:03:58.480 --> 00:04:03.680
So let's say that I had
the matrix-- let me

00:04:03.680 --> 00:04:04.690
to a different letter.

00:04:04.690 --> 00:04:08.270
Let's say I have my matrix
B and it is a

00:04:08.270 --> 00:04:09.290
fairly simple matrix.

00:04:09.290 --> 00:04:13.780
It's a 2, minus 1, 3 and 4.

00:04:13.780 --> 00:04:16.211
And I define some
transformation.

00:04:16.211 --> 00:04:20.959
So I define some transformation
T.

00:04:20.959 --> 00:04:26.540
And it goes from R2 to R2.

00:04:26.540 --> 00:04:28.080
And I define T.

00:04:28.080 --> 00:04:34.270
T of some vector x is equal
to this matrix, B

00:04:34.270 --> 00:04:36.260
times that vector x.

00:04:36.260 --> 00:04:37.830
Now what would that equal?

00:04:37.830 --> 00:04:40.850
Well the matrix is
right there.

00:04:40.850 --> 00:04:42.310
Let me write it in purple.

00:04:42.310 --> 00:04:48.570
2, minus 1, 3, and 4 times x.

00:04:48.570 --> 00:04:51.130
x1, x2.

00:04:51.130 --> 00:04:53.390
And so what does this equal?

00:04:53.390 --> 00:04:55.310
Well this equals
another vector.

00:04:55.310 --> 00:04:58.600
It equals a vector in the
co-domain R2 where the first

00:04:58.600 --> 00:05:00.290
term is 2 times x1.

00:05:00.290 --> 00:05:02.770
I'm just doing the definition
of matrix vector

00:05:02.770 --> 00:05:03.310
multiplication.

00:05:03.310 --> 00:05:10.840
2 times x1 plus minus 1
times x2, or minus x2.

00:05:10.840 --> 00:05:13.660
That's that row times
our vector.

00:05:13.660 --> 00:05:15.570
And then the second row
times that factor.

00:05:15.570 --> 00:05:17.910
We get 3 times x1.

00:05:20.530 --> 00:05:22.210
Plus 4 times x2.

00:05:24.980 --> 00:05:27.520
So this is what we might
be more familiar with.

00:05:27.520 --> 00:05:29.530
I could rewrite this
transformation.

00:05:29.530 --> 00:05:36.130
I could rewrite this
transformation as T of x1 x2

00:05:36.130 --> 00:05:42.780
is equal to 2x1 minus x2 comma--
let me scroll over a

00:05:42.780 --> 00:05:48.490
little bit, comma
3x1 plus 4x2.

00:05:48.490 --> 00:05:51.100
So hopefully you're satisfied
that a matrix multiplication,

00:05:51.100 --> 00:05:54.770
it isn't some new, exotic
form of transformation.

00:05:54.770 --> 00:05:58.010
That they really are
just another way.

00:05:58.010 --> 00:06:02.590
This statement right here is
just another way of writing

00:06:02.590 --> 00:06:06.480
this exact transformation
right here.

00:06:06.480 --> 00:06:08.490
Now, the next question you might
ask and I already told

00:06:08.490 --> 00:06:11.400
you the answer to this at the
beginning of the video is, is

00:06:11.400 --> 00:06:15.510
multiplication by a matrix
always going to be a linear

00:06:15.510 --> 00:06:16.800
transformation?

00:06:16.800 --> 00:06:18.730
Now what are the two constraints
for being a linear

00:06:18.730 --> 00:06:20.390
transformation?

00:06:20.390 --> 00:06:25.000
We know that the transformation
of two vectors,

00:06:25.000 --> 00:06:29.290
a plus b, the sum of two vectors
should be equal to the

00:06:29.290 --> 00:06:30.826
sum of their transformations.

00:06:30.826 --> 00:06:34.770
The transformation of a plus
the transformation of b.

00:06:34.770 --> 00:06:38.135
And then the other requirement
is that the transformation of

00:06:38.135 --> 00:06:42.180
a scaled version of a vector
should be equal to a scaled

00:06:42.180 --> 00:06:43.670
version of the transformation.

00:06:43.670 --> 00:06:47.500
These are our two requirements
for being a linear

00:06:47.500 --> 00:06:48.390
transformation.

00:06:48.390 --> 00:06:51.300
So let's see if matrix
multiplication applies there.

00:06:51.300 --> 00:06:53.210
And I've touched on this in the
past and I've even told

00:06:53.210 --> 00:06:56.130
you that you should prove it.

00:06:56.130 --> 00:06:58.000
I've already assumed you know
it, but I'll prove it to you

00:06:58.000 --> 00:06:59.630
here because I'm tired of
telling you that you

00:06:59.630 --> 00:07:00.120
should prove it.

00:07:00.120 --> 00:07:01.500
I should do it at least once.

00:07:01.500 --> 00:07:03.090
So let's see, matrix
multiplication.

00:07:03.090 --> 00:07:11.220
If I multiply a matrix A times
some vector x, we know that--

00:07:11.220 --> 00:07:12.780
let me write it this way.

00:07:12.780 --> 00:07:14.120
We know that this is equivalent

00:07:14.120 --> 00:07:16.270
to-- I said our matrix.

00:07:16.270 --> 00:07:18.540
Let's say this is an
m by n matrix.

00:07:18.540 --> 00:07:20.000
We can write any matrix
as just a

00:07:20.000 --> 00:07:21.240
series of column vectors.

00:07:21.240 --> 00:07:23.760
So this guy could have
n column vectors.

00:07:23.760 --> 00:07:30.700
So let's say it's v1, v2, all
the way to vn column vectors.

00:07:30.700 --> 00:07:33.050
And each of these guys are going
to have m components.

00:07:33.050 --> 00:07:37.880
Times x1, x2, all the
way down to xn.

00:07:37.880 --> 00:07:40.740
And we've seen this multiple,
multiple times before.

00:07:40.740 --> 00:07:43.790
This, by the definition of
matrix vector multiplication

00:07:43.790 --> 00:07:47.820
is equal to x1 times v1.

00:07:47.820 --> 00:07:49.080
That times that.

00:07:49.080 --> 00:07:54.270
This scalar times that vector
plus x2 times v2, all the way

00:07:54.270 --> 00:07:57.270
to plus xn times vn.

00:07:57.270 --> 00:08:01.650
This was by definition of a
matrix vector multiplication.

00:08:01.650 --> 00:08:03.630
And of course, this is going
to-- and I did this at the top

00:08:03.630 --> 00:08:04.160
of the video.

00:08:04.160 --> 00:08:07.540
This is going to have right
here, this vector is going to

00:08:07.540 --> 00:08:09.310
be a member of Rm.

00:08:09.310 --> 00:08:11.920
It's going to have
m components.

00:08:11.920 --> 00:08:19.520
So what happens if I take some
matrix A, some m by n matrix

00:08:19.520 --> 00:08:30.450
A, and I multiply it times the
sum of two vectors a plus b?

00:08:30.450 --> 00:08:33.100
So I could rewrite this as
this thing right here.

00:08:33.100 --> 00:08:34.880
So my matrix A times.

00:08:34.880 --> 00:08:38.309
The sum of a plus b, the first
term will just be a1 plus b1.

00:08:38.309 --> 00:08:45.460
Second term is a2 plus b2, all
the way down to a n plus bn.

00:08:45.460 --> 00:08:46.720
This is the same
thing as this.

00:08:46.720 --> 00:08:48.290
I'm not saying a of a plus b.

00:08:48.290 --> 00:08:50.260
I'm saying a times.

00:08:50.260 --> 00:08:51.920
Maybe I should put a
dot right there.

00:08:51.920 --> 00:08:54.760
I'm multiplying the matrix.

00:08:54.760 --> 00:08:56.000
I want to be careful
with my notation.

00:08:56.000 --> 00:08:58.110
This is the matrix vector
multiplication.

00:08:58.110 --> 00:09:00.940
It's not some type of new
matrix dot product.

00:09:00.940 --> 00:09:02.450
But this is the same
thing as this

00:09:02.450 --> 00:09:03.660
multiplication right here.

00:09:03.660 --> 00:09:06.060
And based on what I just told
you up here, which we've seen

00:09:06.060 --> 00:09:11.780
multiple, multiple times, this
is the same thing as a1 plus

00:09:11.780 --> 00:09:15.960
b1 times the first column
in a, which is that

00:09:15.960 --> 00:09:16.890
vector right there.

00:09:16.890 --> 00:09:18.560
This a is the same as this a.

00:09:18.560 --> 00:09:20.130
So times v1.

00:09:20.130 --> 00:09:28.820
Plus a2 plus b2 times v2,
all the way to plus an

00:09:28.820 --> 00:09:31.180
plus bn times vn.

00:09:33.770 --> 00:09:35.840
Each xi term here is just
being replaced by

00:09:35.840 --> 00:09:37.850
an ai plus bi term.

00:09:37.850 --> 00:09:41.910
So each x1 here is replaced
by an a1 plus b1 here.

00:09:41.910 --> 00:09:44.090
This is equivalent to this.

00:09:44.090 --> 00:09:51.440
And then from the fact that we
know that well vector products

00:09:51.440 --> 00:09:54.700
times scalars exhibit the
distributive property, we can

00:09:54.700 --> 00:10:00.290
say that this is equal
to a1 times v1.

00:10:00.290 --> 00:10:02.710
Let me actually write all of
the a1 terms. Let me write

00:10:02.710 --> 00:10:10.230
this. a1 times v1 plus b1 times
v1 plus a2 times v2 plus

00:10:10.230 --> 00:10:15.460
b2 times v2, all the way
to plus a n times vn

00:10:15.460 --> 00:10:19.170
plus bn times vn.

00:10:19.170 --> 00:10:21.910
And then if we just re-associate
this, if we just

00:10:21.910 --> 00:10:25.890
group all of the a's together,
all of the a terms together,

00:10:25.890 --> 00:10:29.440
we get a1 plus a-- sorry.

00:10:29.440 --> 00:10:35.870
a1 plus-- let me write it this
way. a1 times v1 plus a2 times

00:10:35.870 --> 00:10:40.870
v2 plus, all the way,
a n times vn.

00:10:40.870 --> 00:10:43.640
I just grabbed all
the a terms.

00:10:43.640 --> 00:10:47.550
We get that plus all the b
terms. All the b terms I'll do

00:10:47.550 --> 00:10:48.500
in this color.

00:10:48.500 --> 00:10:50.310
All the b terms are like that.

00:10:50.310 --> 00:10:57.850
So plus b1 times v1 plus b2
times v2, all the way to plus

00:10:57.850 --> 00:10:59.560
bn times vn.

00:10:59.560 --> 00:11:01.640
That's that guy right there.

00:11:01.640 --> 00:11:03.340
Is equivalent to this statement
up here; I just

00:11:03.340 --> 00:11:05.240
regrouped everything, which is
of course, equivalent to that

00:11:05.240 --> 00:11:06.780
statement over there.

00:11:06.780 --> 00:11:08.770
But what's this equal to?

00:11:08.770 --> 00:11:15.210
This is equal to my vector--
these columns are remember,

00:11:15.210 --> 00:11:17.160
the column for the
matrix capital A.

00:11:17.160 --> 00:11:22.780
So this is equal to the matrix
capital A times a1, a2, all

00:11:22.780 --> 00:11:26.650
the way down to a n, which
was our vector a.

00:11:26.650 --> 00:11:28.020
And what's this equal to?

00:11:28.020 --> 00:11:30.700
This is equal to plus
these v1's.

00:11:30.700 --> 00:11:32.720
These are the columns for the a,
so it's equal to the matrix

00:11:32.720 --> 00:11:36.440
A times my vector b.

00:11:36.440 --> 00:11:41.140
b1, b2, all the way
down to bn.

00:11:41.140 --> 00:11:45.140
This is my vector b.

00:11:45.140 --> 00:11:48.260
We just showed you that if I add
my two vectors, a and b,

00:11:48.260 --> 00:11:50.970
and then multiply it by the
matrix, it's completely

00:11:50.970 --> 00:11:54.620
equivalent to multiplying each
of the vectors times the

00:11:54.620 --> 00:11:56.850
matrix first and then
adding them up.

00:11:56.850 --> 00:12:01.620
So we've satisfied-- and this
is for an m by n matrix.

00:12:01.620 --> 00:12:08.470
So we've now satisfied this
first condition right there.

00:12:08.470 --> 00:12:09.980
And then what about the
second condition?

00:12:09.980 --> 00:12:13.080
And this one's even more
straightforward to understand.

00:12:13.080 --> 00:12:18.420
c times a1, so let me
write it this way.

00:12:18.420 --> 00:12:21.200
The vector a times-- sorry.

00:12:21.200 --> 00:12:25.260
The matrix capital A times the
vector lowercase a-- let me do

00:12:25.260 --> 00:12:27.495
it this way because
I want-- times the

00:12:27.495 --> 00:12:29.650
vector c lowercase a.

00:12:29.650 --> 00:12:32.940
So I'm multiplying my vector
times the scalar first. Is

00:12:32.940 --> 00:12:36.530
equal to-- I can write
my big matrix A.

00:12:36.530 --> 00:12:38.210
I've already labeled
its columns.

00:12:38.210 --> 00:12:42.800
It's v1, v2, all
the way to vn.

00:12:42.800 --> 00:12:44.780
That's my matrix a.

00:12:44.780 --> 00:12:47.510
And then, what does
ca look like?

00:12:47.510 --> 00:12:49.680
ca, you just multiply its
scalar times each of

00:12:49.680 --> 00:12:50.530
the terms of a.

00:12:50.530 --> 00:12:56.940
So it's ca1, ca2, all the
way down to c a n.

00:12:56.940 --> 00:12:58.270
And what does this equal?

00:12:58.270 --> 00:13:01.020
We know this, we've seen this
show multiple times before

00:13:01.020 --> 00:13:02.230
right there.

00:13:02.230 --> 00:13:06.670
So it just equals-- I'll write
a little bit lower.

00:13:06.670 --> 00:13:13.000
That equals c a1 times this
column vector, times v1.

00:13:13.000 --> 00:13:22.010
Plus c a2 times v2 times this
guy, all the way to

00:13:22.010 --> 00:13:26.570
plus c a n times vn.

00:13:31.490 --> 00:13:34.460
And if you just factor this
c out, once again, scalar

00:13:34.460 --> 00:13:37.230
multiplication times vectors
exhibits the

00:13:37.230 --> 00:13:38.530
distributive property.

00:13:38.530 --> 00:13:40.420
I believe I've done a video
on that, but it's

00:13:40.420 --> 00:13:41.700
very easy to prove.

00:13:41.700 --> 00:13:44.960
So this will be equal to c
times-- I'll just stay in one

00:13:44.960 --> 00:13:51.210
color right now-- a1 v1
plus a2 v2 plus all

00:13:51.210 --> 00:13:54.600
the way to a n vn.

00:13:54.600 --> 00:13:56.400
And what is this
thing equal to?

00:13:56.400 --> 00:14:03.770
Well that's just our matrix A
times our vector-- or our

00:14:03.770 --> 00:14:05.040
matrix uppercase A.

00:14:05.040 --> 00:14:06.970
Maybe I'm overloading
the letter A.

00:14:06.970 --> 00:14:10.470
My matrix uppercase A times
my vector lowercase a.

00:14:14.750 --> 00:14:18.210
Where the lowercase a is just
this thing right here, a1, a2

00:14:18.210 --> 00:14:18.700
and so forth.

00:14:18.700 --> 00:14:20.320
This thing up here was the
same thing as that.

00:14:20.320 --> 00:14:23.680
So I just showed you that if I
take my matrix and multiply it

00:14:23.680 --> 00:14:27.020
times some vector that was
multiplied by a scalar first,

00:14:27.020 --> 00:14:30.190
that's equivalent to first
multiplying the matrix times a

00:14:30.190 --> 00:14:33.310
vector and then multiplying
by the scalar.

00:14:33.310 --> 00:14:39.020
So we've shown you that matrix
times vector products or

00:14:39.020 --> 00:14:41.880
matrix vector products satisfied
this condition of

00:14:41.880 --> 00:14:45.320
linear transformations
and this condition.

00:14:45.320 --> 00:14:49.680
So the big takeaway right here
is matrix multiplication.

00:14:49.680 --> 00:14:51.580
And this is a important
takeaway.

00:14:54.620 --> 00:15:03.570
Matrix multiplication or matrix
products with vectors

00:15:03.570 --> 00:15:08.475
is always a linear
transformation.

00:15:11.200 --> 00:15:12.540
And this is a bit
of a side note.

00:15:12.540 --> 00:15:14.710
In the next video I'm going to
show you that any linear

00:15:14.710 --> 00:15:17.460
transformation-- this is
incredibly powerful-- can be

00:15:17.460 --> 00:15:22.260
represented by a matrix
product or by-- any

00:15:22.260 --> 00:15:25.410
transformation on any vector can
be equivalently, I guess,

00:15:25.410 --> 00:15:28.600
written as a product of that
vector with a matrix.

00:15:28.600 --> 00:15:31.640
Has huge repercussions and you
know, just as a side note,

00:15:31.640 --> 00:15:34.770
kind of tying this back
to your everyday life.

00:15:34.770 --> 00:15:38.410
You have your Xbox, your Sony
Playstation and you know, you

00:15:38.410 --> 00:15:41.950
have these 3D graphic programs
where you're running around

00:15:41.950 --> 00:15:43.000
and shooting at things.

00:15:43.000 --> 00:15:46.980
And the way that the software
renders those programs where

00:15:46.980 --> 00:15:49.160
you can see things from every
different angle, you have a

00:15:49.160 --> 00:15:53.100
cube then if you kind of move
this way a little bit, the

00:15:53.100 --> 00:15:56.070
cube will look more like this
and it gets rotated, and you

00:15:56.070 --> 00:15:57.780
move up and down, these are all

00:15:57.780 --> 00:15:59.010
transformations of matrices.

00:15:59.010 --> 00:16:01.540
And we'll do this
in more detail.

00:16:01.540 --> 00:16:05.830
These are all transformations of
vectors or the positions of

00:16:05.830 --> 00:16:07.690
vectors and I'll do that
in a lot more detail.

00:16:07.690 --> 00:16:10.390
And all of that is really just
matrix multiplication.

00:16:10.390 --> 00:16:13.130
So all of these things that
you're doing in your fancy 3D

00:16:13.130 --> 00:16:15.890
games on your Xbox or your
Playstation, they're all just

00:16:15.890 --> 00:16:16.800
matrix multiplications.

00:16:16.800 --> 00:16:18.840
And I'm going to prove that
to you in the next video.

00:16:18.840 --> 00:16:20.960
And so when you have these
graphics cards or these

00:16:20.960 --> 00:16:25.420
graphics engines, all they are--
you know, we're jumping

00:16:25.420 --> 00:16:26.630
away from the theoretical.

00:16:26.630 --> 00:16:32.650
But all these graphics
processors are, are hard wired

00:16:32.650 --> 00:16:34.270
matrix multipliers.

00:16:34.270 --> 00:16:37.970
If I have just a generalized,
some type of CPU, I have to in

00:16:37.970 --> 00:16:40.230
software write how to
multiply matrices.

00:16:40.230 --> 00:16:44.370
But if I'm making an Xbox or
something and 99% of what I'm

00:16:44.370 --> 00:16:48.150
doing is just rotating these
abstract objects and

00:16:48.150 --> 00:16:51.550
displaying them in transformed
ways, I should have a

00:16:51.550 --> 00:16:55.590
dedicated piece of hardware, a
chip, that all it does-- it's

00:16:55.590 --> 00:16:58.620
hard wired into it-- is
multiplying matrices.

00:16:58.620 --> 00:17:01.750
And that's what those graphics
processors or graphics engines

00:17:01.750 --> 00:17:03.380
really are.


Linear transformations

WEBVTT
Kind: captions
Language: en

00:00:00.240 --> 00:00:02.570
You now know what a
transformation is, so let's

00:00:02.570 --> 00:00:10.120
introduce a special kind of
transformation called a linear

00:00:10.120 --> 00:00:12.450
transformation.

00:00:12.450 --> 00:00:15.940
It only makes sense that we have
something called a linear

00:00:15.940 --> 00:00:18.400
transformation because we're
studying linear algebra.

00:00:18.400 --> 00:00:20.530
We already had linear
combinations so we might as

00:00:20.530 --> 00:00:22.370
well have a linear
transformation.

00:00:22.370 --> 00:00:25.110
And a linear transformation,
by definition, is a

00:00:25.110 --> 00:00:28.730
transformation-- which we
know is just a function.

00:00:28.730 --> 00:00:35.260
We could say it's from the set
rn to rm -- It might be

00:00:35.260 --> 00:00:37.080
obvious in the next video why
I'm being a little bit

00:00:37.080 --> 00:00:38.930
particular about that, although
they are just

00:00:38.930 --> 00:00:42.540
arbitrary letters -- where
the following two

00:00:42.540 --> 00:00:43.800
things have to be true.

00:00:43.800 --> 00:00:50.490
So something is a linear
transformation if and only if

00:00:50.490 --> 00:00:52.870
the following thing is true.

00:00:52.870 --> 00:00:57.140
Let's say that we have
two vectors.

00:00:57.140 --> 00:01:00.990
Say vector a and let's
say vector b, are

00:01:00.990 --> 00:01:03.780
both members of rn.

00:01:03.780 --> 00:01:05.820
So they're both in our domain.

00:01:05.820 --> 00:01:09.660
So then this is a linear
transformation if and only if

00:01:09.660 --> 00:01:14.070
I take the transformation of
the sum of our two vectors.

00:01:14.070 --> 00:01:18.080
If I add them up first, that's
equivalent to taking the

00:01:18.080 --> 00:01:24.900
transformation of each of the
vectors and then summing them.

00:01:24.900 --> 00:01:28.100
That's my first condition
for this to be a linear

00:01:28.100 --> 00:01:28.840
transformation.

00:01:28.840 --> 00:01:32.280
And the second one is, if I take
the transformation of any

00:01:32.280 --> 00:01:35.420
scaled up version of a vector
-- so let me just multiply

00:01:35.420 --> 00:01:40.550
vector a times some scalar
or some real number c .

00:01:40.550 --> 00:01:42.490
If this is a linear
transformation then this

00:01:42.490 --> 00:01:48.500
should be equal to c times
the transformation of a.

00:01:48.500 --> 00:01:50.080
That seems pretty
straightforward.

00:01:50.080 --> 00:01:52.940
Let's see if we can apply these
rules to figure out if

00:01:52.940 --> 00:01:56.100
some actual transformations
are linear or not.

00:01:56.100 --> 00:01:58.790
So let me define a
transformation.

00:01:58.790 --> 00:02:01.800
Let's say that I have the
transformation T.

00:02:01.800 --> 00:02:10.199
Part of my definition I'm going
to tell you, it maps

00:02:10.199 --> 00:02:12.500
from r2 to r2.

00:02:15.710 --> 00:02:18.060
So if you give it a
2-tuple, right?

00:02:18.060 --> 00:02:19.270
Its domain is 2-tuple.

00:02:19.270 --> 00:02:25.230
So you give it an x1 and an x2
let's say it maps to, so this

00:02:25.230 --> 00:02:36.260
will be equal to, or it's
associated with x1 plus x2.

00:02:36.260 --> 00:02:39.490
And then let's just say it's 3
times x1 is the second tuple.

00:02:39.490 --> 00:02:41.330
Or we could have written this
more in vector form.

00:02:41.330 --> 00:02:42.950
This is kind of our
tuple form.

00:02:42.950 --> 00:02:44.710
We could have written it -- and
it's good to see all the

00:02:44.710 --> 00:02:47.500
different notations that you
might encounter -- you could

00:02:47.500 --> 00:02:52.390
write it a transformation of
some vector x, where the

00:02:52.390 --> 00:02:56.970
vector looks like
this, x1, x2.

00:02:56.970 --> 00:02:58.610
Let me put a bracket there.

00:02:58.610 --> 00:03:05.230
It equals some new vector,
x1 plus x2.

00:03:05.230 --> 00:03:06.930
And then the second component
of the new

00:03:06.930 --> 00:03:09.160
vector would be 3x1.

00:03:09.160 --> 00:03:11.880
That's a completely legitimate
way to express our

00:03:11.880 --> 00:03:12.450
transformation.

00:03:12.450 --> 00:03:15.490
And a third way, which I never
see, but to me it kind of

00:03:15.490 --> 00:03:17.760
captures the essence of what
a transformation is.

00:03:17.760 --> 00:03:20.200
It's just a mapping or
it's just a function.

00:03:20.200 --> 00:03:24.640
We could say that the
transformation is a mapping

00:03:24.640 --> 00:03:32.470
from any vector in r2 that looks
like this: x1, x2, to--

00:03:32.470 --> 00:03:36.620
and I'll do this notation-- a
vector that looks like this.

00:03:36.620 --> 00:03:40.710
x1 plus x2 and then 3x1.

00:03:40.710 --> 00:03:42.770
All of these statements
are equivalent.

00:03:42.770 --> 00:03:45.870
But our whole point of writing
this is to figure out whether

00:03:45.870 --> 00:03:49.420
T is linearly independent.

00:03:49.420 --> 00:03:50.590
Sorry, not linearly
independent.

00:03:50.590 --> 00:03:52.250
Whether it's a linear
transformation.

00:03:52.250 --> 00:03:54.240
I was so obsessed with linear
independence for so many

00:03:54.240 --> 00:03:57.260
videos, it's hard to get it out
of my brain in this one.

00:03:57.260 --> 00:04:00.560
Whether it's a linear
transformation.

00:04:00.560 --> 00:04:02.530
So let's test our
two conditions.

00:04:02.530 --> 00:04:04.070
I have them up here.

00:04:04.070 --> 00:04:08.230
So let's take T of, let's say
I have two vectors a and b.

00:04:08.230 --> 00:04:09.660
They're members of r2.

00:04:09.660 --> 00:04:10.530
So let me write it.

00:04:10.530 --> 00:04:23.570
A is equal to a1, a2, and
b is equal to b1, b2.

00:04:23.570 --> 00:04:24.795
Sorry that's not a vector.

00:04:24.795 --> 00:04:26.630
I have to make sure that
those are scalars.

00:04:26.630 --> 00:04:28.100
These are the components
of a vector.

00:04:28.100 --> 00:04:30.060
And b2.

00:04:30.060 --> 00:04:33.670
So what is a1 plus b?

00:04:33.670 --> 00:04:37.110
Sorry, what is vector
a plus vector b?

00:04:37.110 --> 00:04:38.970
Brain's malfunctioning.

00:04:38.970 --> 00:04:39.590
All right.

00:04:39.590 --> 00:04:40.750
Well, you just add up
their components.

00:04:40.750 --> 00:04:43.010
This is the definition
of vector addition.

00:04:43.010 --> 00:04:45.290
So it's a1 plus b1.

00:04:45.290 --> 00:04:46.270
Add up the first components.

00:04:46.270 --> 00:04:48.800
And the second components is
just the sum of each of the

00:04:48.800 --> 00:04:52.220
vector's second compnents.
a2 plus b2.

00:04:52.220 --> 00:04:53.340
Nothing new here.

00:04:53.340 --> 00:04:55.990
But what is the transformation
of this vector?

00:04:55.990 --> 00:05:04.280
So the transformation of vector
a plus vector b, we

00:05:04.280 --> 00:05:05.640
could write it like this.

00:05:05.640 --> 00:05:08.740
That would be the same thing as
the transformation of this

00:05:08.740 --> 00:05:16.520
vector, which is just a1
plus b1 and a2 plus b2.

00:05:16.520 --> 00:05:20.670
Which we know it equals
a vector.

00:05:20.670 --> 00:05:22.820
It equals this vector.

00:05:22.820 --> 00:05:25.490
Or what we do is for the first
component here, we add up the

00:05:25.490 --> 00:05:26.930
two components on this side.

00:05:26.930 --> 00:05:29.150
So the first component here
is going to be these

00:05:29.150 --> 00:05:30.220
two guys added up.

00:05:30.220 --> 00:05:36.630
So it's a1 plus a2
plus b1 plus b2.

00:05:36.630 --> 00:05:40.280
And then the second component
by our transformation or

00:05:40.280 --> 00:05:44.410
function definition is just 3
times the first component in

00:05:44.410 --> 00:05:45.810
our domain, I guess
you could say.

00:05:45.810 --> 00:05:47.000
So it's 3 times the first one.

00:05:47.000 --> 00:05:49.130
So it's going to be 3 times
this first guy.

00:05:49.130 --> 00:05:54.270
So it's 3a1 plus 3b1.

00:05:54.270 --> 00:05:55.320
Fair enough.

00:05:55.320 --> 00:05:59.810
Now what is the transformation
individually of a and b?

00:05:59.810 --> 00:06:06.710
So the transformation of a is
equal to the transformation of

00:06:06.710 --> 00:06:10.340
a -- let me write it this
way -- is equal to the

00:06:10.340 --> 00:06:14.500
transformation of a1
a2 in brackets.

00:06:14.500 --> 00:06:17.020
That's another way of
writing vector a.

00:06:17.020 --> 00:06:18.200
And what is that equal to?

00:06:18.200 --> 00:06:21.770
That's our definition of our
transformation right up here,

00:06:21.770 --> 00:06:28.040
so this is going to be equal to
the vector a1 plus a2 and

00:06:28.040 --> 00:06:29.655
then 3 times a1.

00:06:29.655 --> 00:06:31.290
It just comes straight out
of the definition.

00:06:31.290 --> 00:06:34.450
I essentially just replaced
an x with a's.

00:06:34.450 --> 00:06:39.410
By the same argument, what
is the transformation

00:06:39.410 --> 00:06:41.650
of our vector b?

00:06:41.650 --> 00:06:43.520
Well, it's just going to be the
same thing with the a's

00:06:43.520 --> 00:06:44.370
replaced by the b's.

00:06:44.370 --> 00:06:47.880
So the transformation of our
vector b is going to be -- b

00:06:47.880 --> 00:06:53.050
is just b1 b2 -- so it's
going to be b1 plus b2.

00:06:53.050 --> 00:06:55.550
And then the second component in
the transformation will be

00:06:55.550 --> 00:06:58.300
3 times b1.

00:06:58.300 --> 00:07:04.090
Now, what is the transformation
of vector a

00:07:04.090 --> 00:07:07.390
plus the transformation
of vector b?

00:07:07.390 --> 00:07:09.795
Well, it's this vector
plus that vector.

00:07:09.795 --> 00:07:11.200
And what is that equal to?

00:07:11.200 --> 00:07:13.790
Well, this is just pure vector
addition so we just add up

00:07:13.790 --> 00:07:14.910
their components.

00:07:14.910 --> 00:07:21.300
So it's a1 plus a2
plus b1 plus b2.

00:07:21.300 --> 00:07:23.010
That's just that component
plus that component.

00:07:23.010 --> 00:07:26.040
The second component is 3a1 and
we're going to add it to

00:07:26.040 --> 00:07:26.950
that second component.

00:07:26.950 --> 00:07:31.810
So it's 3a1 plus 3b1.

00:07:31.810 --> 00:07:34.790
Now, we just showed you that if
I take the transformations

00:07:34.790 --> 00:07:36.940
separately of each of the
vectors and then add them up,

00:07:36.940 --> 00:07:40.530
I get the exact same thing as
if I took the vectors and

00:07:40.530 --> 00:07:44.210
added them up first and then
took the transformation.

00:07:44.210 --> 00:07:47.130
So we've met our
first criteria.

00:07:47.130 --> 00:07:49.990
That the transformation of the
sum of the vectors is the same

00:07:49.990 --> 00:07:51.900
thing as the sum of the
transformations.

00:07:51.900 --> 00:07:56.120
Now let's see if this works
with a random scalar.

00:07:56.120 --> 00:07:56.700
So we know what the

00:07:56.700 --> 00:08:00.180
transformation of a looks like.

00:08:00.180 --> 00:08:01.970
What does ca look like,
first of all?

00:08:01.970 --> 00:08:04.340
I guess that's a good
place to start.

00:08:04.340 --> 00:08:09.810
c times our vector a is going
to be equal to c times a1.

00:08:09.810 --> 00:08:11.740
And then c times a2.

00:08:11.740 --> 00:08:13.280
That's our definition of scalar

00:08:13.280 --> 00:08:15.530
multiplication time's a vector.

00:08:15.530 --> 00:08:19.740
So what's our transformation --
let me go to a new color.

00:08:19.740 --> 00:08:22.890
What is our -- let me do a color
I haven't used in a long

00:08:22.890 --> 00:08:23.980
time, white.

00:08:23.980 --> 00:08:28.530
What is our transformation
of ca going to be?

00:08:28.530 --> 00:08:37.179
Well, that's the same thing as
our transformation of ca1, ca2

00:08:37.179 --> 00:08:40.649
which is equal to a new vector,
where the first term

00:08:40.649 --> 00:08:44.720
-- let's go to our definition
-- is you sum the first and

00:08:44.720 --> 00:08:45.470
second components.

00:08:45.470 --> 00:08:48.550
And then the second term is 3
times the first component.

00:08:48.550 --> 00:08:49.820
So our first term
you sum them.

00:08:49.820 --> 00:08:53.470
So it's going to be
ca1 plus ca2.

00:08:53.470 --> 00:08:55.770
And then our second term
is 3 times our first

00:08:55.770 --> 00:08:57.020
term, so it's 3ca1.

00:09:00.810 --> 00:09:02.190
Now, what is this equal to?

00:09:02.190 --> 00:09:02.890
This is the same thing.

00:09:02.890 --> 00:09:05.350
We can view it as factoring
out the c.

00:09:05.350 --> 00:09:10.640
This the same thing as c times
the vector a1 plus a2.

00:09:10.640 --> 00:09:14.460
And then the second
component is 3a1.

00:09:14.460 --> 00:09:16.120
But this thing right here,
we already saw.

00:09:16.120 --> 00:09:20.460
This is the same thing as
the transformation of a.

00:09:20.460 --> 00:09:23.530
So just like that, you see that
the transformation of c

00:09:23.530 --> 00:09:27.510
times our vector a, for any
vector a in r2 -- anything in

00:09:27.510 --> 00:09:31.340
r2 can be represented this way
-- is the same thing as c

00:09:31.340 --> 00:09:33.290
times the transformation of a.

00:09:33.290 --> 00:09:38.010
So we've met our second
condition, that when you when

00:09:38.010 --> 00:09:40.030
you -- well I just stated it, so
I don't have to restate it.

00:09:40.030 --> 00:09:46.560
So we meet both conditions,
which tells us that this is a

00:09:46.560 --> 00:09:50.170
linear transformation.

00:09:50.170 --> 00:09:53.390
And you might be thinking,
OK, Sal, fair enough.

00:09:53.390 --> 00:09:55.480
How do I know that all
transformations aren't linear

00:09:55.480 --> 00:09:56.240
transformations?

00:09:56.240 --> 00:09:58.760
Show me something
that won't work.

00:09:58.760 --> 00:10:00.940
And here I'll do a very
simple example.

00:10:00.940 --> 00:10:02.190
Let me define my
transformation.

00:10:10.270 --> 00:10:15.040
Well, I'll do it from r2
to r2 just to kind

00:10:15.040 --> 00:10:15.970
of compare the two.

00:10:15.970 --> 00:10:19.150
I could have done it from r to r
if wanted a simpler example.

00:10:19.150 --> 00:10:21.120
But I'm going to define
my transformation.

00:10:21.120 --> 00:10:28.690
Let's say, my transformation
of the vector x1, x2.

00:10:28.690 --> 00:10:36.710
Let's say it is equal to
x1 squared and then

00:10:36.710 --> 00:10:38.890
0, just like that.

00:10:38.890 --> 00:10:42.770
Let me see if this is a
linear transformation.

00:10:42.770 --> 00:10:46.510
So the first question
is, what's my

00:10:46.510 --> 00:10:48.330
transformation of a vector a?

00:10:48.330 --> 00:10:53.530
So my transformation of a vector
a-- where a is just the

00:10:53.530 --> 00:10:56.770
same a that I did before--
it would look like this.

00:10:56.770 --> 00:11:00.970
It would look like a1 squared
and then a 0.

00:11:00.970 --> 00:11:05.330
Now, what would be my
transformation if I

00:11:05.330 --> 00:11:08.380
took c times a?

00:11:08.380 --> 00:11:14.540
Well, this is the same thing as
c times a1 and c times a2.

00:11:14.540 --> 00:11:18.920
And by our transformation
definition -- sorry, the

00:11:18.920 --> 00:11:22.700
transformation of c times this
thing right here, because I'm

00:11:22.700 --> 00:11:24.380
taking the transformation
on both sides.

00:11:24.380 --> 00:11:27.100
And by our transformation
definition this will just be

00:11:27.100 --> 00:11:30.290
equal to a new vector that
would be in our codomain,

00:11:30.290 --> 00:11:32.390
where the first term is
just the first term

00:11:32.390 --> 00:11:33.770
of our input squared.

00:11:33.770 --> 00:11:37.940
So it's ca1 squared.

00:11:37.940 --> 00:11:40.020
And the second term is 0.

00:11:40.020 --> 00:11:41.080
What is this equal to?

00:11:41.080 --> 00:11:43.090
Let me switch colors.

00:11:43.090 --> 00:11:48.130
This is equal to c squared
a1 squared and

00:11:48.130 --> 00:11:50.880
this is equal to 0.

00:11:50.880 --> 00:11:57.720
Now, if we can assume that c
does not equal 0, this would

00:11:57.720 --> 00:12:00.280
be equal to what?

00:12:00.280 --> 00:12:01.310
Actually, it doesn't
even matter.

00:12:01.310 --> 00:12:03.150
We don't even have to make
that assumption.

00:12:03.150 --> 00:12:04.780
So this is the same thing.

00:12:04.780 --> 00:12:12.130
This is equal to c squared times
the vector a1 squared 0.

00:12:12.130 --> 00:12:13.460
Which is equal to what?

00:12:13.460 --> 00:12:16.750
This expression right here
is a transformation of a.

00:12:16.750 --> 00:12:21.880
So this is equal to c squared
times the transformation of a.

00:12:21.880 --> 00:12:23.130
Let me do it in the
same color.

00:12:25.610 --> 00:12:27.810
So what I've just showed
you is, if I take the

00:12:27.810 --> 00:12:32.000
transformation of a vector being
multiplied by a scalar

00:12:32.000 --> 00:12:35.590
quantity first, that that's
equal to -- for this T, for

00:12:35.590 --> 00:12:39.690
this transformation that I've
defined right here -- c

00:12:39.690 --> 00:12:42.650
squared times the transformation
of a.

00:12:42.650 --> 00:12:48.220
And clearly this statement right
here, or this choice of

00:12:48.220 --> 00:12:54.510
transformation, conflicts with
this requirement for a linear

00:12:54.510 --> 00:12:55.510
transformation.

00:12:55.510 --> 00:12:57.540
If I have a c here I should
see a c here.

00:12:57.540 --> 00:13:00.160
But in our case, I have
a c here and I

00:13:00.160 --> 00:13:01.840
have a c squared here.

00:13:01.840 --> 00:13:04.370
So clearly this negates
that statement.

00:13:04.370 --> 00:13:14.550
So this is not a linear
transformation.

00:13:14.550 --> 00:13:16.660
And just to get a gut feel
if you're just looking at

00:13:16.660 --> 00:13:18.710
something, whether it's going to
be a linear transformation

00:13:18.710 --> 00:13:21.910
or not, if the transformation
just involves linear

00:13:21.910 --> 00:13:24.890
combinations of the different
components of the inputs,

00:13:24.890 --> 00:13:27.200
you're probably dealing with
a linear transformation.

00:13:27.200 --> 00:13:29.910
If you start seeing things where
the components start

00:13:29.910 --> 00:13:33.130
getting multiplied by each
other or you start seeing

00:13:33.130 --> 00:13:35.870
squares or exponents, you're
probably not dealing with a

00:13:35.870 --> 00:13:36.950
linear transformation.

00:13:36.950 --> 00:13:38.800
And then there's some functions
that might be in a

00:13:38.800 --> 00:13:41.010
bit of a grey area, but it
tends to be just linear

00:13:41.010 --> 00:13:44.500
combinations are going to lead
to a linear transformation.

00:13:44.500 --> 00:13:46.340
But hopefully that gives you
a good sense of things.

00:13:46.340 --> 00:13:49.060
And this leads up to what I
think is one of the neatest

00:13:49.060 --> 00:13:51.680
outcomes, in the next video.


Vector transformations

WEBVTT
Kind: captions
Language: en

00:00:00.470 --> 00:00:03.270
In the last video we saw, a
little bit more formally than

00:00:03.270 --> 00:00:05.990
you might have been exposed to
the past, that a function is

00:00:05.990 --> 00:00:12.250
just a mapping of the members
of one set to another set.

00:00:12.250 --> 00:00:15.050
So if this is my first set, x.

00:00:15.050 --> 00:00:16.580
We call that the domain.

00:00:16.580 --> 00:00:20.850
And the set that we're mapping
to, y, in this case, that's

00:00:20.850 --> 00:00:22.260
called the codomain.

00:00:22.260 --> 00:00:25.290
And the function just maps each
of the specific entries

00:00:25.290 --> 00:00:28.230
of x to an entry in y.

00:00:28.230 --> 00:00:31.030
When I say map, it really just
creates an association.

00:00:31.030 --> 00:00:34.580
If we think of these in even
less abstract terms -- which,

00:00:34.580 --> 00:00:36.395
on some levels is more abstract
-- you could view x

00:00:36.395 --> 00:00:40.150
as a basket of bananas and
y as a basket of apples.

00:00:40.150 --> 00:00:42.330
And for every banana, you're
associating it

00:00:42.330 --> 00:00:44.030
with one of the apples.

00:00:47.130 --> 00:00:50.130
The mapping of going from each
of those bananas to each of

00:00:50.130 --> 00:00:51.490
those apples would
be a function.

00:00:51.490 --> 00:00:54.520
I don't know if that helps you
or not, but I just want to

00:00:54.520 --> 00:00:59.810
broaden your preconceived notion
of what a function is.

00:00:59.810 --> 00:01:02.280
I mean everything that you've
probably seen before probably

00:01:02.280 --> 00:01:05.720
took a form that looks
something like that.

00:01:05.720 --> 00:01:07.810
Where you said, oh, a function
is, you just give me some

00:01:07.810 --> 00:01:09.600
number and I'll give
you another number.

00:01:09.600 --> 00:01:11.580
Or I'll do something
to that number.

00:01:11.580 --> 00:01:13.230
While it can be much more
general than that.

00:01:13.230 --> 00:01:15.980
It's an association between any
member of one set and some

00:01:15.980 --> 00:01:17.890
other members of another set.

00:01:17.890 --> 00:01:21.190
Now, we know that vectors
are members of sets.

00:01:21.190 --> 00:01:23.210
Right?

00:01:23.210 --> 00:01:28.970
In particular, if we say that
some vector x is a member of

00:01:28.970 --> 00:01:32.440
some set -- let me just say it's
a member of rn, because

00:01:32.440 --> 00:01:36.390
that's what we deal with -- all
that means is that this is

00:01:36.390 --> 00:01:39.220
just a particular representation
of an n-tuple.

00:01:39.220 --> 00:01:41.680
Remember what rn was.

00:01:41.680 --> 00:01:46.150
rn we defined way back at the
beginning of the linear

00:01:46.150 --> 00:01:50.482
algebra playlist. We defined it
as the set of all n-tuples

00:01:50.482 --> 00:02:03.370
-- x1, x2, xn, where your x1's,
x2's, all the way to

00:02:03.370 --> 00:02:06.600
xn's are a member of
the real numbers.

00:02:06.600 --> 00:02:08.880
So your rn is most
definitely a set.

00:02:08.880 --> 00:02:10.120
This could be rn.

00:02:10.120 --> 00:02:12.550
And obviously the use of the
letter n is arbitrary.

00:02:12.550 --> 00:02:14.510
It could be rm, it
could be rs.

00:02:14.510 --> 00:02:17.200
n is just kind of a placeholder
for how many

00:02:17.200 --> 00:02:18.990
tuples we have. It
could be r5.

00:02:18.990 --> 00:02:20.790
It could be 5 tuples.

00:02:20.790 --> 00:02:24.990
And when we say that a vector
x is a member of rn, we're

00:02:24.990 --> 00:02:28.370
just saying that it's another
way of writing

00:02:28.370 --> 00:02:29.680
one of these n-tuples.

00:02:29.680 --> 00:02:33.440
And all of our vectors so far
are column vectors -- that's

00:02:33.440 --> 00:02:35.830
the only type that we've defined
so far -- and we say

00:02:35.830 --> 00:02:37.820
it's this ordered list where
each of the members are a

00:02:37.820 --> 00:02:38.505
member of r's.

00:02:38.505 --> 00:02:41.770
It's an ordered list of n --
it's an ordered list of

00:02:41.770 --> 00:02:47.540
n-components -- x1, x2, all the
way to xn -- where each of

00:02:47.540 --> 00:02:51.440
those guys, or each of those
x1's, x2's all the way to

00:02:51.440 --> 00:02:56.130
xn's, are a member of
the real numbers.

00:02:56.130 --> 00:02:59.890
That's, by definition, what we
mean when we say that x is a

00:02:59.890 --> 00:03:01.480
member of rn.

00:03:01.480 --> 00:03:06.840
So if x is a member of rn -- so
let me draw two sets right

00:03:06.840 --> 00:03:12.590
here -- let's say that this set
right here is rn and then

00:03:12.590 --> 00:03:15.890
let me just change, just to be
general, let me create another

00:03:15.890 --> 00:03:21.120
set right there and call that
set right there rm.

00:03:21.120 --> 00:03:22.250
Just a different number.

00:03:22.250 --> 00:03:25.200
It it could be the same as
n, it could be different.

00:03:25.200 --> 00:03:26.900
This is m-tuples,
that's n-tuples.

00:03:29.520 --> 00:03:32.540
We've defined that vectors
can be members of rn.

00:03:32.540 --> 00:03:37.930
So you could have some vector
here and then, if you

00:03:37.930 --> 00:03:41.430
associate with that vector in rn
-- if you associate it with

00:03:41.430 --> 00:03:47.790
some vector in are rm -- if you
associate it with, let's

00:03:47.790 --> 00:03:52.550
call that vector y, if you make
this association, that

00:03:52.550 --> 00:03:54.120
too is a function.

00:03:54.120 --> 00:03:56.480
And that might have already been
obvious to you and this

00:03:56.480 --> 00:04:04.885
would be a function that's
mapping from rn to rm.

00:04:04.885 --> 00:04:06.430
And actually, I just want
to make one little

00:04:06.430 --> 00:04:07.080
special note here.

00:04:07.080 --> 00:04:09.080
When I just drew the arrow like
this, this shows that I'm

00:04:09.080 --> 00:04:11.280
mapping between two sets.

00:04:11.280 --> 00:04:14.300
I'm taking elements of this set
and I'm associating with

00:04:14.300 --> 00:04:16.060
them with elements
of that set.

00:04:16.060 --> 00:04:17.690
Now, in the last video you
probably saw this.

00:04:17.690 --> 00:04:19.550
I wanted to do the side note
note because I realized it

00:04:19.550 --> 00:04:20.910
might've been confusing.

00:04:20.910 --> 00:04:22.330
I introduced you to another
way of writing a

00:04:22.330 --> 00:04:23.615
function like this.

00:04:23.615 --> 00:04:28.330
Where I said f could be defined
as a mapping for any

00:04:28.330 --> 00:04:31.480
given x to x squared.

00:04:31.480 --> 00:04:33.960
And I just want to make a
note on the notation.

00:04:33.960 --> 00:04:36.860
When I just have a regular arrow
I'm going between sets.

00:04:36.860 --> 00:04:42.100
When I have this little vertical
line at the base of

00:04:42.100 --> 00:04:44.860
the arrow, that's kind of
the function definition.

00:04:44.860 --> 00:04:49.060
It tells me for any x you give
me in the first set, in the

00:04:49.060 --> 00:04:52.560
second set I'm going to
associate this x with, in this

00:04:52.560 --> 00:04:53.530
case, x squared.

00:04:53.530 --> 00:04:55.210
Anyway, I just wanted to
make that side note.

00:04:55.210 --> 00:04:58.580
But the whole direction I was
going in is that vectors are

00:04:58.580 --> 00:05:02.220
valid elements of sets,
functions are just mappings

00:05:02.220 --> 00:05:04.300
between elements of sets,
so you could have

00:05:04.300 --> 00:05:05.540
functions of vectors.

00:05:05.540 --> 00:05:08.000
And I even touched on that a
little bit in the last video

00:05:08.000 --> 00:05:10.160
when I talked about
vector-valued functions.

00:05:10.160 --> 00:05:25.080
If your codomain is a subset of
rm, where m is greater than

00:05:25.080 --> 00:05:28.600
1, then we say your function
is vector-valued.

00:05:28.600 --> 00:05:30.910
It's not just mapping into
the real numbers.

00:05:30.910 --> 00:05:37.080
It's mapping into some m-tuple
of real numbers.

00:05:37.080 --> 00:05:39.670
So if you mapped two-dimensional
space, you're

00:05:39.670 --> 00:05:41.325
dealing with a vector-valued
function.

00:05:41.325 --> 00:05:44.140
Now I've been all abstract and
whatnot, so let me actually

00:05:44.140 --> 00:05:47.290
deal with some vectors and it
might make everything a little

00:05:47.290 --> 00:05:49.540
bit more concrete.

00:05:49.540 --> 00:06:00.620
So let's say I define the
function f as f of x1, x2, and

00:06:00.620 --> 00:06:13.440
x3, is equal to x1 plus
2x2 and the second

00:06:13.440 --> 00:06:15.740
coordinate is just 3x3.

00:06:15.740 --> 00:06:17.480
And actually, I haven't formally
defined coordinates

00:06:17.480 --> 00:06:19.440
for you yet, but I think you
understand that just from your

00:06:19.440 --> 00:06:22.080
basic algebra training.

00:06:22.080 --> 00:06:25.060
So let's say that that's my
function definition based on

00:06:25.060 --> 00:06:27.000
the notation that we've
been introduced to.

00:06:27.000 --> 00:06:31.660
We could say that f is a mapping
from -- its domain is

00:06:31.660 --> 00:06:37.470
r3 -- and it maps from r3, or it
associates all values in r3

00:06:37.470 --> 00:06:40.960
with some value in r2.

00:06:40.960 --> 00:06:42.210
This is a 2-tuple.

00:06:46.420 --> 00:06:46.760
Right?

00:06:46.760 --> 00:06:49.040
So this is an r2 This
is 3-tuple.

00:06:52.310 --> 00:06:52.730
Right?

00:06:52.730 --> 00:06:54.750
Or another way we could do this,
if we just wanted to

00:06:54.750 --> 00:07:02.170
write it in vector notation, I
could write that f -- if you

00:07:02.170 --> 00:07:10.610
pass f to some vector x1, x2,
x3, I could say this will be

00:07:10.610 --> 00:07:13.550
equal to the vector -- and
now it's going to have a

00:07:13.550 --> 00:07:14.640
two-component vector.

00:07:14.640 --> 00:07:19.050
It's going to be a vector in r2
where the first term is x1

00:07:19.050 --> 00:07:24.320
plus 2x2 and the second
term is 3x3.

00:07:24.320 --> 00:07:25.810
So let's play around with
this a little bit.

00:07:25.810 --> 00:07:29.010
See what it does for us, what
it does to the vectors.

00:07:29.010 --> 00:07:39.280
So what is f of the
vector 1, 1, 1?

00:07:39.280 --> 00:07:46.890
Well, I get 1 plus 2 times 1
is, I get the vector 3, and

00:07:46.890 --> 00:07:49.860
then my second term is just 3
times this one, so I get the

00:07:49.860 --> 00:07:52.690
vector 3, 3.

00:07:52.690 --> 00:07:54.040
Fair enough, let me
do another one.

00:07:54.040 --> 00:07:58.850
Just to really experiment
with this mapping.

00:07:58.850 --> 00:08:09.490
If I take the f of the vector in
r3 2, 4, 1, what do I get?

00:08:09.490 --> 00:08:13.330
That equals 2 plus 2 times 4.

00:08:13.330 --> 00:08:15.840
That goes to the vector 10.

00:08:15.840 --> 00:08:20.570
2 plus 2 times 4 and
then 3 times the

00:08:20.570 --> 00:08:21.720
third term right there.

00:08:21.720 --> 00:08:24.670
So the vector 10, 3.

00:08:24.670 --> 00:08:28.630
So how can we visualize this?

00:08:28.630 --> 00:08:31.220
Well, three-dimensional vectors
-- or vectors in r3 --

00:08:31.220 --> 00:08:34.240
are not always the easiest to
visualize, but I think we can

00:08:34.240 --> 00:08:36.784
attempt to visualize
these two guys.

00:08:45.090 --> 00:08:50.030
So let's say that this is the
x1-axis, that's the x2-axis,

00:08:50.030 --> 00:08:52.160
that's the x3-axis.

00:08:52.160 --> 00:08:54.650
So this first vector right here,
this yellow one, 1, 1,

00:08:54.650 --> 00:09:00.090
1, it will look like
this -- 1, 1, 1.

00:09:00.090 --> 00:09:02.210
And so if I were to go out here,
then go out here, then

00:09:02.210 --> 00:09:05.170
go up 1, the point would be
right there and if I were to

00:09:05.170 --> 00:09:07.790
draw it in standard position,
I'd start at the origin, and

00:09:07.790 --> 00:09:09.940
the vector looks something
like that.

00:09:09.940 --> 00:09:14.250
And then the second guy, 2, 4,
1, it would look like this.

00:09:14.250 --> 00:09:17.630
It would go 2 out here,
we'd go 4 this

00:09:17.630 --> 00:09:20.790
direction, 1, 2, 3, 4.

00:09:20.790 --> 00:09:22.070
And then we'd go 1 up.

00:09:22.070 --> 00:09:25.350
So it looks something
like this.

00:09:25.350 --> 00:09:26.330
2, 4, 1.

00:09:26.330 --> 00:09:28.970
I think you get the idea.

00:09:28.970 --> 00:09:32.680
So I've drawn these two vectors
that are essentially

00:09:32.680 --> 00:09:33.970
in my domain.

00:09:33.970 --> 00:09:36.380
Our domain is r3.

00:09:36.380 --> 00:09:38.370
This is our r3 right here.

00:09:38.370 --> 00:09:40.350
And let's see what
our function maps

00:09:40.350 --> 00:09:41.980
these vectors to.

00:09:41.980 --> 00:09:44.510
So what's our codomain?

00:09:44.510 --> 00:09:47.110
Our codomain is r2, so this
is much easier to

00:09:47.110 --> 00:09:48.880
visualize for us.

00:09:48.880 --> 00:09:55.320
So we just have to draw
two axes like this.

00:09:55.320 --> 00:09:59.420
Let's call this x1 and
let's call this x2.

00:09:59.420 --> 00:10:03.650
And so what does f of 1, 1, 1 --
of this yellow vector -- it

00:10:03.650 --> 00:10:05.540
becomes 3, 3.

00:10:05.540 --> 00:10:12.010
So if I do it in yellow,
1, 2, 3, 1, 2, 3.

00:10:12.010 --> 00:10:13.360
So it gets me this one.

00:10:13.360 --> 00:10:15.370
If I draw it in standard
position the

00:10:15.370 --> 00:10:17.070
vector looks like this.

00:10:17.070 --> 00:10:21.110
So, literally, our function
went from mapped from this

00:10:21.110 --> 00:10:26.250
vector in r3 to this
vector in r2.

00:10:26.250 --> 00:10:29.560
That was what our
function did.

00:10:29.560 --> 00:10:32.870
Likewise, if we take the other
vector, we went from this 2,

00:10:32.870 --> 00:10:34.860
4, 1 vector to sector 10, 3.

00:10:34.860 --> 00:10:38.970
So 1, 2, 3, 4, 5,
6, 7, 8, 9, 10.

00:10:38.970 --> 00:10:40.410
So it's going to look
something like this.

00:10:40.410 --> 00:10:43.180
And it's going to be 3 up,
so it's going to look

00:10:43.180 --> 00:10:45.480
something like this.

00:10:45.480 --> 00:10:50.000
So this vector right here, by
our function, f, got mapped --

00:10:50.000 --> 00:10:54.610
let me do a different color
-- to this vector.

00:10:54.610 --> 00:10:57.700
This vector right here in r3 got
mapped to this vector in

00:10:57.700 --> 00:11:00.620
r2 by our function.

00:11:00.620 --> 00:11:04.230
Now this is just a switch
of terminology.

00:11:04.230 --> 00:11:08.060
When we talk about functions
of vectors the term that we

00:11:08.060 --> 00:11:09.700
tend to use is the word
transformation.

00:11:15.000 --> 00:11:17.600
But it really is the exact
same thing as a function.

00:11:17.600 --> 00:11:19.340
I don't want to confuse you,
because if you watch the

00:11:19.340 --> 00:11:22.990
differential equations playlist,
you saw the idea of

00:11:22.990 --> 00:11:26.440
a Laplace transformation, which
is really an operation

00:11:26.440 --> 00:11:28.500
that takes a function
as an argument.

00:11:28.500 --> 00:11:30.550
But in this case, and when
we're dealing into linear

00:11:30.550 --> 00:11:34.270
algebra world, a transformation
is really just

00:11:34.270 --> 00:11:37.180
a function operating on vectors
-- or the way we're

00:11:37.180 --> 00:11:39.330
going to use it -- it's just a
function operating on vectors.

00:11:46.080 --> 00:11:48.640
And so the general notation,
instead of writing a lowercase

00:11:48.640 --> 00:11:53.670
f like that, for a function,
people use an uppercase T to

00:11:53.670 --> 00:11:54.850
say it's a transformation.

00:11:54.850 --> 00:11:56.330
Although it doesn't have
to be an uppercase T.

00:11:56.330 --> 00:11:58.210
But that's the one that people
use the most. Just like this

00:11:58.210 --> 00:12:00.160
could be a g or an h,
but people always

00:12:00.160 --> 00:12:01.300
use a lowercase f.

00:12:01.300 --> 00:12:03.920
So the same way we could have
written this, we could have

00:12:03.920 --> 00:12:07.260
called this a transformation.

00:12:07.260 --> 00:12:11.210
And my sense of why, in the
linear algebra world, they use

00:12:11.210 --> 00:12:15.150
this, is because you kind of
imagine that this vector is

00:12:15.150 --> 00:12:17.100
being changed into
that vector.

00:12:17.100 --> 00:12:18.370
Or that this is vector is being

00:12:18.370 --> 00:12:20.610
transformed into that vector.

00:12:20.610 --> 00:12:23.210
I think that's why they call it
a transformation as opposed

00:12:23.210 --> 00:12:23.760
to a function.

00:12:23.760 --> 00:12:25.340
And it actually makes a lot
more sense when you start

00:12:25.340 --> 00:12:27.870
going into things like video
game programming.

00:12:27.870 --> 00:12:29.630
And a lot of what we're
embarking on with our

00:12:29.630 --> 00:12:33.360
transformations is key to
video game programming.

00:12:33.360 --> 00:12:35.860
But you're kind of transforming
one image into

00:12:35.860 --> 00:12:38.030
another image if you're viewing
at it from a different

00:12:38.030 --> 00:12:41.030
angle or whatever else
you might want to do.

00:12:41.030 --> 00:12:42.850
We'll talk a lot more about
that in the future.

00:12:42.850 --> 00:12:44.320
But I just wanted to introduce
you to this notation.

00:12:44.320 --> 00:12:51.570
So these statements, I could
have replaced all my f's with

00:12:51.570 --> 00:12:54.010
T's and I could have defined
some transformation.

00:12:54.010 --> 00:12:56.030
And I just want to make you
comfortable the notation.

00:12:56.030 --> 00:12:58.200
I could have defined it
similarly, a transformation

00:12:58.200 --> 00:13:11.510
from r3 to r2 and I could have
said that T of x1, x2, x3 is

00:13:11.510 --> 00:13:21.460
equal to the 2-tuple x1 plus 2
x1 comma 3x3 And I could have,

00:13:21.460 --> 00:13:24.250
just as similarly put a T up
here because I have defined it

00:13:24.250 --> 00:13:25.150
the same way.

00:13:25.150 --> 00:13:29.990
I could have said T of
my vector 1, 1, 1

00:13:29.990 --> 00:13:32.210
is equal to 3, 3.

00:13:32.210 --> 00:13:33.960
Now, you might say, hey Sal, why
are you going through all

00:13:33.960 --> 00:13:36.050
this trouble of replacing
T's with f's?

00:13:36.050 --> 00:13:37.800
I'm just doing this so you
don't get confused.

00:13:37.800 --> 00:13:41.300
So that when you see in your
linear algebra book, when you

00:13:41.300 --> 00:13:43.300
see linear algebra problems,
when you see this big capital

00:13:43.300 --> 00:13:44.940
T and you're like, wow, I've
never seen that before and

00:13:44.940 --> 00:13:48.180
they're using this fancy word
called a transformation.

00:13:48.180 --> 00:13:50.890
This is completely identical to
your notion of a function.

00:13:50.890 --> 00:13:52.540
It is a function.

00:13:52.540 --> 00:13:54.130
In the next video I'm going
to talk about linear

00:13:54.130 --> 00:13:55.230
transformations.

00:13:55.230 --> 00:13:57.190
That's really just
linear functions.

00:13:57.190 --> 00:13:58.820
And I'll define that
a little bit more

00:13:58.820 --> 00:14:00.450
precisely in the next video.

00:14:00.450 --> 00:14:03.390
But hopefully by watching this
video you at least have a

00:14:03.390 --> 00:14:06.945
sense that you can apply
functions to vectors and, in

00:14:06.945 --> 00:14:09.360
the linear algebra world,
we tend to call those

00:14:09.360 --> 00:14:10.270
transformations.

00:14:10.270 --> 00:14:12.670
And hopefully this example
right here gives you, at

00:14:12.670 --> 00:14:15.080
least, a visual representation
of why it's called a

00:14:15.080 --> 00:14:15.760
transformation.

00:14:15.760 --> 00:14:19.250
We're transforming from
one vector to another.