Rotation in R3 around the x-axis

WEBVTT
Kind: captions
Language: en

00:00:00.390 --> 00:00:04.810
In the last video we defined a
transformation that rotated

00:00:04.810 --> 00:00:09.160
any vector in R2 and just gave
us another rotated version of

00:00:09.160 --> 00:00:11.200
that vector in R2.

00:00:11.200 --> 00:00:13.420
In this video, I'm essentially
going to extend this, so I'm

00:00:13.420 --> 00:00:14.750
going to do it in R3.

00:00:14.750 --> 00:00:17.895
So I'm going to define a
rotation transformation.

00:00:21.550 --> 00:00:23.220
I'll still call it theta.

00:00:23.220 --> 00:00:28.360
There's going to be a mapping
this time from R3 to R3.

00:00:28.360 --> 00:00:30.820
As you can imagine, the idea
of a rotation in an angle

00:00:30.820 --> 00:00:32.940
becomes a little bit more
complicated when we're dealing

00:00:32.940 --> 00:00:33.970
in three dimensions.

00:00:33.970 --> 00:00:38.205
So in this case we're going to
rotate around the x-axis, let

00:00:38.205 --> 00:00:48.160
me call it-- so this is going
to rotate around the x-axis.

00:00:48.160 --> 00:00:51.290
And what we do in this video,
you can then just generalize

00:00:51.290 --> 00:00:52.530
that to other axes.

00:00:52.530 --> 00:00:54.950
And if you want to rotate around
the x-axis, and then

00:00:54.950 --> 00:00:59.360
the y-axis, and then the z-axis
by different angles,

00:00:59.360 --> 00:01:00.160
you can just apply the

00:01:00.160 --> 00:01:01.580
transformations one after another.

00:01:01.580 --> 00:01:04.040
And we're going to cover that
in a lot more detail in a

00:01:04.040 --> 00:01:04.989
future video.

00:01:04.989 --> 00:01:07.210
But this should kind of give you
the tools to show you that

00:01:07.210 --> 00:01:10.820
this idea that we learned in the
previous video is actually

00:01:10.820 --> 00:01:13.170
generalizeable to multiple
dimensions, and especially

00:01:13.170 --> 00:01:14.340
three dimensions.

00:01:14.340 --> 00:01:18.060
So let me just be clear, what
we're going to be doing here.

00:01:18.060 --> 00:01:19.910
Let me draw some axes.

00:01:19.910 --> 00:01:22.150
That's my x-axis.

00:01:22.150 --> 00:01:24.550
That is my y-axis.

00:01:24.550 --> 00:01:28.730
And this is my z-axis.

00:01:28.730 --> 00:01:30.660
Of course, this is R3.

00:01:30.660 --> 00:01:32.970
But any vector here in R3
I will be rotating it

00:01:32.970 --> 00:01:35.380
counterclockwise around
the x-axis.

00:01:35.380 --> 00:01:37.850
We'll be rotating like that.

00:01:37.850 --> 00:01:41.520
So if I had a vector-- I'm
just drawing it in the zy

00:01:41.520 --> 00:01:44.220
plane because it's a little bit
easier to visualize-- but

00:01:44.220 --> 00:01:47.430
if I have a vector sitting here
in the zy plane, it will

00:01:47.430 --> 00:01:48.760
still stay in the zy plane.

00:01:48.760 --> 00:01:53.260
But it'll be rotated
counterclockwise by an angle

00:01:53.260 --> 00:01:54.980
of theta, just like that.

00:01:54.980 --> 00:01:57.490
Now, a little harder to
visualize is a vector that

00:01:57.490 --> 00:01:58.970
doesn't just sit in
the zy plane.

00:01:58.970 --> 00:02:01.510
If we have some vector that
has some x-component that

00:02:01.510 --> 00:02:04.720
comes out like that, then some
y-component and some

00:02:04.720 --> 00:02:07.020
z-component, it looks
like that.

00:02:07.020 --> 00:02:10.650
Then when you rotate it, its
z and its y-components will

00:02:10.650 --> 00:02:13.330
change, but its x-component
will stay the same.

00:02:13.330 --> 00:02:17.020
So then it might look
something like this.

00:02:17.020 --> 00:02:19.070
Let me see if I can
give it justice.

00:02:19.070 --> 00:02:22.030
So then the vector when I rotate
it around might look

00:02:22.030 --> 00:02:23.050
something like that.

00:02:23.050 --> 00:02:25.850
Anyway, I don't know if I'm
giving it proper justice but

00:02:25.850 --> 00:02:28.100
this was rotated around
the x-axis.

00:02:28.100 --> 00:02:29.920
I think you understand
what that means.

00:02:29.920 --> 00:02:32.340
But just based on the last
video, we want to build a

00:02:32.340 --> 00:02:35.190
transformation.

00:02:35.190 --> 00:02:38.300
Let me call this rotation
3 theta.

00:02:38.300 --> 00:02:41.260
Or let me call it 3 rotation
theta now that

00:02:41.260 --> 00:02:42.970
we're dealing in R3.

00:02:42.970 --> 00:02:45.600
And what we want to do is we
want to find some matrix, so I

00:02:45.600 --> 00:02:52.280
can write my 3 rotation sub
theta transformation of x as

00:02:52.280 --> 00:02:55.650
being some matrix A times
the vector x.

00:02:55.650 --> 00:03:00.060
Since this is a transformation
from R3 to R3 this is of

00:03:00.060 --> 00:03:04.010
course going to be
a 3 by 3 matrix.

00:03:04.010 --> 00:03:06.970
Now in the last video we learned
that to figure this

00:03:06.970 --> 00:03:09.580
out, you just have to apply the
transformation essentially

00:03:09.580 --> 00:03:11.180
to the identity matrix.

00:03:11.180 --> 00:03:14.950
So what we do is we start off
with the identity matrix in

00:03:14.950 --> 00:03:17.330
R3, which is just going
to be a 3 by 3.

00:03:21.040 --> 00:03:28.330
It's going to have 1, 1,
1, 0, 0, 0, 0, 0, 0.

00:03:28.330 --> 00:03:32.090
Each of these columns are the
basis vectors for R3.

00:03:32.090 --> 00:03:36.610
That's e1, e2, e3-- I'm writing
it probably too small

00:03:36.610 --> 00:03:38.290
for you to see-- but each
of these are the

00:03:38.290 --> 00:03:40.260
basis vectors for R3.

00:03:40.260 --> 00:03:42.730
And what we need to do is just
apply the transformation to

00:03:42.730 --> 00:03:46.220
each of these basis
vectors in R3.

00:03:46.220 --> 00:03:49.500
So our matrix A will
look like this.

00:03:49.500 --> 00:03:53.220
Our matrix A is going to
be a 3 by 3 matrix.

00:03:53.220 --> 00:03:55.290
Where the first column
is going to be our

00:03:55.290 --> 00:04:01.910
transformation, 3 rotation sub
theta, applied to that column

00:04:01.910 --> 00:04:05.770
vector right there, 1, 0, 0.

00:04:05.770 --> 00:04:09.050
And then I'm going to apply it
to this middle column vector

00:04:09.050 --> 00:04:11.790
right here.

00:04:11.790 --> 00:04:12.860
You get the idea, I don't
want to write

00:04:12.860 --> 00:04:14.030
that whole thing again.

00:04:14.030 --> 00:04:20.000
I'm going to apply 3 rotation
sub theta to 0, 1, 0.

00:04:20.000 --> 00:04:23.135
And then I'm going to apply
it-- I'll do it here-- 3

00:04:23.135 --> 00:04:26.400
rotation sub theta.

00:04:26.400 --> 00:04:28.130
I'm going to apply it
to this last column

00:04:28.130 --> 00:04:30.020
vector, so 0, 0, 1.

00:04:30.020 --> 00:04:31.790
We've seen this multiple
times.

00:04:31.790 --> 00:04:32.930
So let's apply it.

00:04:32.930 --> 00:04:37.300
Let's rotate each of these
basis vectors for R3.

00:04:37.300 --> 00:04:40.650
Let's rotate them around
the x-axis.

00:04:40.650 --> 00:04:44.730
So the first guy, if I were
to draw an R3, what

00:04:44.730 --> 00:04:45.690
would he look like?

00:04:45.690 --> 00:04:49.150
He only has directionality
in the x direction right?

00:04:49.150 --> 00:04:53.670
If we call this the x-dimension,
if the first

00:04:53.670 --> 00:04:57.210
entry corresponds to our
x-dimension, the second entry

00:04:57.210 --> 00:04:58.880
corresponds to our
y-dimension.

00:04:58.880 --> 00:05:00.720
And the third entry
corresponds to our

00:05:00.720 --> 00:05:03.360
z-dimension.

00:05:03.360 --> 00:05:05.930
This vector would just be a unit
vector that just comes

00:05:05.930 --> 00:05:07.710
out like that, right?

00:05:07.710 --> 00:05:12.650
So if I'm going to rotate this
vector around the x-axis,

00:05:12.650 --> 00:05:14.040
what's going to happen to it?

00:05:14.040 --> 00:05:16.320
Well, nothing.

00:05:16.320 --> 00:05:17.610
It is the x-axis.

00:05:17.610 --> 00:05:19.480
So when you rotate it, it's not
changing its direction or

00:05:19.480 --> 00:05:21.000
its magnitude or anything.

00:05:21.000 --> 00:05:25.650
So this vector right here
is just going to be the

00:05:25.650 --> 00:05:27.320
vector 1, 0, 0.

00:05:27.320 --> 00:05:29.420
Nothing happens when
you rotate it.

00:05:29.420 --> 00:05:32.040
Now these are a little
bit more interesting.

00:05:32.040 --> 00:05:35.940
To do these, let me just
draw my zy-axis.

00:05:35.940 --> 00:05:37.840
Let me just draw my Z.

00:05:37.840 --> 00:05:43.800
So that's my z-axis and this
is my y-axis right here.

00:05:43.800 --> 00:05:48.240
Now this basis vector just goes
in the y direction by 1.

00:05:48.240 --> 00:05:52.690
So this basis vector just
looks like that.

00:05:52.690 --> 00:05:55.520
And it has a length of 1.

00:05:55.520 --> 00:05:58.255
And then when you rotate it
around the x-axis, when I draw

00:05:58.255 --> 00:06:00.260
it like this, you could imagine
the x-axis is just

00:06:00.260 --> 00:06:02.490
popping out of your
computer screens.

00:06:02.490 --> 00:06:05.455
So I could draw it like this is
like the tip of the arrow

00:06:05.455 --> 00:06:06.320
just popping out.

00:06:06.320 --> 00:06:07.980
Instead of drawing it at an
angle like this, I'm drawing

00:06:07.980 --> 00:06:09.660
it straight out of the
computer screen.

00:06:09.660 --> 00:06:13.180
So if you were to rotate this
vector right here, this blue

00:06:13.180 --> 00:06:17.800
vector right here, by
an angle of theta,

00:06:17.800 --> 00:06:21.130
it'll look like this.

00:06:21.130 --> 00:06:22.760
And we've done this in
the previous video.

00:06:22.760 --> 00:06:24.350
What are its new coordinates?

00:06:24.350 --> 00:06:25.890
First of all, will
its x-coordinate

00:06:25.890 --> 00:06:27.160
have changed it all?

00:06:27.160 --> 00:06:30.270
It's x-coordinate was 0 before,
because it doesn't

00:06:30.270 --> 00:06:32.730
break out into the
x-dimension.

00:06:32.730 --> 00:06:34.920
It just stays along
the zy plane.

00:06:34.920 --> 00:06:36.240
It was 0 before.

00:06:36.240 --> 00:06:38.590
When you rotate it, it's
still on a zy plane.

00:06:38.590 --> 00:06:41.870
So its x direction, or
its x-component,

00:06:41.870 --> 00:06:43.270
won't change at all.

00:06:43.270 --> 00:06:46.960
So the x direction is
still going to be 0.

00:06:46.960 --> 00:06:49.530
And then what's its
new y direction?

00:06:49.530 --> 00:06:52.590
Well, here we do exactly what
we did in the last video.

00:06:52.590 --> 00:06:56.830
We figure out this is going to
be its new-- I guess I don't

00:06:56.830 --> 00:06:59.330
want to draw a vector there
necessarily-- but this length

00:06:59.330 --> 00:07:03.600
right here is going to be
its new y-component.

00:07:03.600 --> 00:07:06.430
And this length right here
is going to be its new

00:07:06.430 --> 00:07:08.200
z-component.

00:07:08.200 --> 00:07:11.440
So what's its new y-component?

00:07:11.440 --> 00:07:14.270
We did this in the last video
so I won't go into as much

00:07:14.270 --> 00:07:18.320
detail, but what is
cosine of theta?

00:07:18.320 --> 00:07:20.750
The length of this vector
is 1, right?

00:07:20.750 --> 00:07:23.060
These are the standard
basis vectors.

00:07:23.060 --> 00:07:25.490
And one of the things that makes
them a nice standard

00:07:25.490 --> 00:07:27.500
basis vector is that their
lengths are 1.

00:07:27.500 --> 00:07:33.480
So we know that the cosine of
this angle is equal to the

00:07:33.480 --> 00:07:35.870
adjacent side over
the hypotenuse.

00:07:35.870 --> 00:07:38.140
The adjacent side is
this right here.

00:07:38.140 --> 00:07:39.310
And what is the hypotenuse?

00:07:39.310 --> 00:07:41.000
It's equal to 1.

00:07:41.000 --> 00:07:44.350
So this adjacent side, which we
said is going to be our new

00:07:44.350 --> 00:07:47.820
second component, our second
entry, is going to be equal to

00:07:47.820 --> 00:07:49.500
cosine of theta, right?

00:07:49.500 --> 00:07:50.630
That's A.

00:07:50.630 --> 00:07:51.780
You can just ignore the 1's.

00:07:51.780 --> 00:07:55.180
This going to be equal
to cosine of theta.

00:07:55.180 --> 00:07:59.020
And what's going to be
its new z-component?

00:07:59.020 --> 00:08:06.760
Well, sine of theta is equal
to the opposite side, this

00:08:06.760 --> 00:08:08.200
side over 1.

00:08:08.200 --> 00:08:09.790
So it just equals its
opposite side.

00:08:09.790 --> 00:08:11.950
And the length of that
opposite side is this

00:08:11.950 --> 00:08:16.190
vector's, once it's rotated,
is its new z-component.

00:08:16.190 --> 00:08:19.560
So you've got a sine
theta right there.

00:08:19.560 --> 00:08:21.680
Now we just have to do
everything in the z direction.

00:08:21.680 --> 00:08:25.340
So this z basis vector right
there, what does it look like

00:08:25.340 --> 00:08:26.760
on this graph?

00:08:26.760 --> 00:08:28.850
Let me just actually redraw it
just to make things a little

00:08:28.850 --> 00:08:30.400
bit cleaner.

00:08:30.400 --> 00:08:35.650
So that's my z-axis and
this is my y-axis.

00:08:35.650 --> 00:08:40.600
And my z-basis vector e3,
it starts off looking

00:08:40.600 --> 00:08:41.850
something like that.

00:08:44.530 --> 00:08:46.960
It just goes only in
the z direction.

00:08:46.960 --> 00:08:48.530
So first of all, let's
just rotate it

00:08:48.530 --> 00:08:49.510
by an angle of theta.

00:08:49.510 --> 00:08:52.310
So I'm going to rotate
it like that.

00:08:52.310 --> 00:08:54.900
That's an angle of theta.

00:08:54.900 --> 00:08:57.430
Its former x entry was 0.

00:08:57.430 --> 00:09:00.410
It did not break out in the
x direction at all.

00:09:00.410 --> 00:09:03.800
And of course we're still just
in the zy plane so it won't be

00:09:03.800 --> 00:09:05.960
moving out in the x direction.

00:09:05.960 --> 00:09:08.650
So it's still going
to be a 0 up here.

00:09:08.650 --> 00:09:11.480
Now what about its
new y-component?

00:09:11.480 --> 00:09:15.960
Its new y-coordinate, I guess we
can call it, is going to be

00:09:15.960 --> 00:09:18.290
this length, or it's going to be
this coordinate right here.

00:09:18.290 --> 00:09:19.710
And how can we figure
that out?

00:09:19.710 --> 00:09:22.490
Well, that length is the same
thing as that length.

00:09:22.490 --> 00:09:25.740
And if we call this the opposite
side of the angle, we

00:09:25.740 --> 00:09:31.400
know that the sine of theta is
equal to this opposite side

00:09:31.400 --> 00:09:33.830
over the length of this vector,
which is just 1.

00:09:33.830 --> 00:09:35.790
So it's just equal to
the opposite side.

00:09:35.790 --> 00:09:37.970
So the opposite side is equal
to sine of theta.

00:09:37.970 --> 00:09:41.246
But our new coordinate is to
the left of the z-axis, so

00:09:41.246 --> 00:09:42.500
this is going to be a
negative version.

00:09:42.500 --> 00:09:43.695
We did this in the last video.

00:09:43.695 --> 00:09:45.780
So it's just going to be a
negative sine of theta.

00:09:48.340 --> 00:09:50.630
This point right here,
that coordinate.

00:09:50.630 --> 00:09:54.690
So it's minus sine of theta.

00:09:54.690 --> 00:09:58.140
And then finally, what's its new
z-coordinate going to be?

00:09:58.140 --> 00:10:00.310
That's going to be this
length right here.

00:10:00.310 --> 00:10:02.850
And we know that this length,
if we call that adjacent, we

00:10:02.850 --> 00:10:07.040
know that the cosine of
our theta is equal to

00:10:07.040 --> 00:10:09.610
this divided by 1.

00:10:09.610 --> 00:10:13.290
So it's equal to that adjacent
side, so just put a cosine of

00:10:13.290 --> 00:10:14.990
theta right there.

00:10:14.990 --> 00:10:16.970
And we get our transformation
matrix.

00:10:16.970 --> 00:10:18.410
We're done.

00:10:18.410 --> 00:10:20.680
Our transformation
matrix A is this.

00:10:20.680 --> 00:10:24.070
So we can now say our new
transformation that

00:10:24.070 --> 00:10:26.810
this video is about.

00:10:26.810 --> 00:10:30.810
I call it a 3 because it's
a rotation in R3.

00:10:30.810 --> 00:10:33.560
Maybe I should call it 3 sub X
because it's a rotation around

00:10:33.560 --> 00:10:36.870
the x-axis, but I think
you get the idea.

00:10:36.870 --> 00:10:40.850
It is equal to this matrix right
up here-- maybe I could

00:10:40.850 --> 00:10:42.230
rewrite it.

00:10:42.230 --> 00:10:44.420
Let me do it this way.

00:10:44.420 --> 00:10:48.090
Let me delete all of this so
I don't have to rewrite.

00:10:48.090 --> 00:10:54.250
So my transformation that this
videos is about, 3 rotation

00:10:54.250 --> 00:10:57.500
theta of x, that transformation
is equal to

00:10:57.500 --> 00:11:02.870
this matrix times whatever
vector x I have in R3.

00:11:02.870 --> 00:11:05.030
And you might say, hey, Sal,
that looks exactly like what

00:11:05.030 --> 00:11:06.220
you did in the second.

00:11:06.220 --> 00:11:09.580
If you remember the last video
when we defined our rotation

00:11:09.580 --> 00:11:13.260
in R2, we had a transformation
matrix that looked very

00:11:13.260 --> 00:11:14.400
similar to this.

00:11:14.400 --> 00:11:16.610
And that makes sense because
we're essentially just

00:11:16.610 --> 00:11:18.010
rotating things

00:11:18.010 --> 00:11:20.500
counterclockwise in the zy plane.

00:11:20.500 --> 00:11:22.530
Now you might say, hey, Sal,
why is this even useful?

00:11:22.530 --> 00:11:26.100
You extended it to three
dimensions or to R3, I saw

00:11:26.100 --> 00:11:26.820
what you did in R2.

00:11:26.820 --> 00:11:27.620
Why is this useful?

00:11:27.620 --> 00:11:29.610
It's kind of a limited case
where you're just rotating

00:11:29.610 --> 00:11:30.460
around the x-axis.

00:11:30.460 --> 00:11:31.420
And I did it for two reasons.

00:11:31.420 --> 00:11:34.860
One to show you that you
can generalize to R3.

00:11:34.860 --> 00:11:37.860
But the other thing is, if you
think about it, a lot of the

00:11:37.860 --> 00:11:41.260
rotations that you might want
to do in R3 can be described

00:11:41.260 --> 00:11:44.340
by a rotation around the x-axis
first-- which we did in

00:11:44.340 --> 00:11:48.080
this video-- then by rotation
around the y-axis and then

00:11:48.080 --> 00:11:51.860
maybe some rotation
around the z-axis.

00:11:51.860 --> 00:11:57.340
This is just a special case
where we're dealing with

00:11:57.340 --> 00:11:58.820
rotation around the x-axis.

00:11:58.820 --> 00:12:01.620
But you could do the exact
same process to define

00:12:01.620 --> 00:12:04.560
transformation matrices for
rotations around the y-axis or

00:12:04.560 --> 00:12:07.410
the z-axis, and then you can
apply them one after another.

00:12:07.410 --> 00:12:09.460
And we'll talk a lot about that
in the future when we

00:12:09.460 --> 00:12:10.780
start applying one

00:12:10.780 --> 00:12:12.010
transformation after the other.

00:12:12.010 --> 00:12:14.170
But anyway, hopefully you found
this slightly useful.

00:12:14.170 --> 00:12:16.660
It's a slight extension
of what we did in R2.


Linear transformation examples: Rotations in R2

WEBVTT
Kind: captions
Language: en

00:00:00.440 --> 00:00:04.160
Let's see if we can create a
linear transformation that is

00:00:04.160 --> 00:00:08.740
a rotation transformation
through some angle theta.

00:00:08.740 --> 00:00:13.500
And what it does is, it takes
any vector in R2 and it maps

00:00:13.500 --> 00:00:17.120
it to a rotated version
of that vector.

00:00:17.120 --> 00:00:28.420
Or another way of saying it, is
that the rotation of some

00:00:28.420 --> 00:00:38.870
vector x is going to be equal
to a counterclockwise theta

00:00:38.870 --> 00:00:45.850
degree rotation of x.

00:00:45.850 --> 00:00:49.170
So this is what we want to
construct using our new linear

00:00:49.170 --> 00:00:50.420
transformation tools.

00:00:50.420 --> 00:00:53.050
And just to make sure that we
can actually even do this, we

00:00:53.050 --> 00:00:55.250
need to make sure there's an
actual linear transformation.

00:00:55.250 --> 00:00:56.810
I'll just do that visually.

00:00:56.810 --> 00:00:58.310
I actually don't even
have a mathematical

00:00:58.310 --> 00:00:59.240
definition for this yet.

00:00:59.240 --> 00:01:01.190
This is about as good
as I've given you.

00:01:01.190 --> 00:01:05.250
So let me just draw some really
fast axes right here--

00:01:05.250 --> 00:01:08.530
I have to draw them a little
bit neater than that-- so

00:01:08.530 --> 00:01:10.210
that's my vertical axes.

00:01:10.210 --> 00:01:12.310
That's my horizontal axes.

00:01:12.310 --> 00:01:14.840
I could call this one
the x1 and I'll

00:01:14.840 --> 00:01:16.260
call this the x2-axis.

00:01:16.260 --> 00:01:18.530
In the last video I called
them the x and the y.

00:01:18.530 --> 00:01:20.290
This is the first component
of our vectors.

00:01:20.290 --> 00:01:23.230
This is our second component
in our vectors, and so if I

00:01:23.230 --> 00:01:31.080
have some vector x like
that, we know that a

00:01:31.080 --> 00:01:34.160
counterclockwise rotation of
this will look like this.

00:01:34.160 --> 00:01:36.560
I'll do the rotations in blue.

00:01:36.560 --> 00:01:40.390
It will look like this,
where this angle

00:01:40.390 --> 00:01:42.130
right here is theta.

00:01:42.130 --> 00:01:44.960
So this right here is
the rotation for an

00:01:44.960 --> 00:01:46.640
angle of theta of x.

00:01:46.640 --> 00:01:48.910
That's what this vector
right here is.

00:01:48.910 --> 00:01:50.990
So what do we have to do to
make sure that this is a

00:01:50.990 --> 00:01:51.850
linear combination?

00:01:51.850 --> 00:01:53.800
We have to show two things.

00:01:53.800 --> 00:01:57.100
We have to show that the
transformation, so the

00:01:57.100 --> 00:02:02.060
rotation through theta of the
sum of two vectors-- it's

00:02:02.060 --> 00:02:06.380
equivalent to the sum of each of
their individual rotations.

00:02:06.380 --> 00:02:10.600
The rotation of the vector
x plus the rotation

00:02:10.600 --> 00:02:12.620
of the vector y.

00:02:12.620 --> 00:02:14.140
And I'll just show that
to you visually.

00:02:14.140 --> 00:02:15.700
This is the vector x.

00:02:15.700 --> 00:02:20.420
Let's say that the vector y
looks something like-- let me

00:02:20.420 --> 00:02:23.395
draw the original vectors
in yellow.

00:02:23.395 --> 00:02:25.680
So let's say the vector
y looks like that.

00:02:25.680 --> 00:02:27.180
So that's y.

00:02:27.180 --> 00:02:28.650
So what's x plus y?

00:02:28.650 --> 00:02:29.890
So let's put heads to tails.

00:02:29.890 --> 00:02:35.320
If we just shift y up here,
that's also vector y, not

00:02:35.320 --> 00:02:39.600
drawn in standard position, but
x plus y would then look

00:02:39.600 --> 00:02:40.850
pretty close to this.

00:02:43.410 --> 00:02:45.650
Let me draw it a little
bit neater. x plus y

00:02:45.650 --> 00:02:47.340
would look like that.

00:02:47.340 --> 00:02:51.550
That would be the
vector x plus y.

00:02:51.550 --> 00:02:53.220
And what would its rotation
look like

00:02:53.220 --> 00:02:55.530
through an angle of theta?

00:02:55.530 --> 00:02:57.940
What's rotation if you just
rotate this guy through an

00:02:57.940 --> 00:02:58.940
angle of theta?

00:02:58.940 --> 00:03:00.100
I'm just approximating--
it would look

00:03:00.100 --> 00:03:01.350
something like this.

00:03:04.960 --> 00:03:07.790
This right here would be the
rotation through an

00:03:07.790 --> 00:03:11.580
angle of theta of x plus y.

00:03:11.580 --> 00:03:13.900
Now let's see if that's the same
thing as if we rotate x

00:03:13.900 --> 00:03:16.110
and rotate y and then
add them together.

00:03:16.110 --> 00:03:18.735
So what's y if we rotate it
through an angle of theta?

00:03:18.735 --> 00:03:22.530
If we rotate y through an angle
of theta, it's going to

00:03:22.530 --> 00:03:28.070
look something like-- this
is all approximation.

00:03:28.070 --> 00:03:29.970
I should be doing it with a
ruler and a protractor.

00:03:29.970 --> 00:03:38.350
Maybe it looks something like
this-- the rotation of y

00:03:38.350 --> 00:03:40.310
through an angle of
theta right there.

00:03:40.310 --> 00:03:41.830
That's the same theta
that I've been

00:03:41.830 --> 00:03:42.745
doing the whole time.

00:03:42.745 --> 00:03:45.560
Let me make it in a color that
you can actually see.

00:03:45.560 --> 00:03:47.215
So that's that vector
right there.

00:03:47.215 --> 00:03:49.120
The rotation of x
was right there.

00:03:49.120 --> 00:03:53.030
So if we add the rotation of x
plus the rotation of y-- I'm

00:03:53.030 --> 00:03:55.180
kind of fudging it a little bit,
but I think you get the

00:03:55.180 --> 00:03:59.600
idea-- so this is the rotation
of x plus the rotation of y.

00:04:02.700 --> 00:04:05.870
You actually get the rotation
of x plus y.

00:04:05.870 --> 00:04:07.490
So at least visually it

00:04:07.490 --> 00:04:09.760
satisfied that first condition.

00:04:09.760 --> 00:04:13.560
Now the second condition that we
need for this to be a valid

00:04:13.560 --> 00:04:17.980
linear transformation, is that
the rotation through an angle

00:04:17.980 --> 00:04:22.150
of theta of a scaled up version
of a vector should be

00:04:22.150 --> 00:04:25.085
equal to a scaled up version
of the rotated vector.

00:04:27.950 --> 00:04:31.210
And I'll just do another visual
example here, so that's

00:04:31.210 --> 00:04:32.880
just my vertical axis.

00:04:32.880 --> 00:04:36.630
That's my horizontal axis,
and let me say that this

00:04:36.630 --> 00:04:40.346
is my vector x.

00:04:40.346 --> 00:04:42.850
Now let's draw a scaled
up version of it.

00:04:42.850 --> 00:04:47.030
So a scaled up version of x
may be just like x, but it

00:04:47.030 --> 00:04:48.750
gets scaled up a little
bit, so it goes

00:04:48.750 --> 00:04:53.390
all the way out here.

00:04:53.390 --> 00:04:58.110
So this is my c times x and now
I'm going to rotate that

00:04:58.110 --> 00:04:59.580
through an angle of theta.

00:04:59.580 --> 00:05:02.720
So if we rotate that through an
angle of theta, you'll get

00:05:02.720 --> 00:05:05.930
a vector that looks something
like this.

00:05:05.930 --> 00:05:07.470
Rotating it counterclockwise.

00:05:07.470 --> 00:05:12.760
So this vector right here is
the rotation by an angle of

00:05:12.760 --> 00:05:15.870
theta counterclockwise
of c, x.

00:05:15.870 --> 00:05:18.020
That's what this
is right there.

00:05:18.020 --> 00:05:21.620
Now what happens if we take
the rotation of x first?

00:05:21.620 --> 00:05:25.840
So if we just rotate x first,
we're going to get this vector

00:05:25.840 --> 00:05:26.560
right here.

00:05:26.560 --> 00:05:30.310
So this right here is just a
rotation for an angle of theta

00:05:30.310 --> 00:05:32.510
of x and then we scale it up.

00:05:32.510 --> 00:05:34.460
What we see it's the same thing
of this scaled up to

00:05:34.460 --> 00:05:36.920
that when you multiplied by c,
than this thing is going to

00:05:36.920 --> 00:05:39.480
scale up to that when you
multiply it by c.

00:05:39.480 --> 00:05:42.740
So at least visually,
I've shown you

00:05:42.740 --> 00:05:44.150
that this is satisfied.

00:05:44.150 --> 00:05:47.260
So rotation definitely is a
linear transformation, at

00:05:47.260 --> 00:05:48.990
least the way I've shown you.

00:05:48.990 --> 00:05:52.070
Now let's actually construct
a mathematical

00:05:52.070 --> 00:05:53.200
definition for it.

00:05:53.200 --> 00:05:56.730
Let's actually construct a
matrix that will perform the

00:05:56.730 --> 00:05:57.540
transformation.

00:05:57.540 --> 00:06:06.120
So I'm saying that my rotation
transformation from R2 to R2

00:06:06.120 --> 00:06:11.270
of some vector x can be defined
as some 2 by 2 matrix.

00:06:11.270 --> 00:06:16.250
And it's 2 by 2 because it's a
mapping from R2 to R2 times

00:06:16.250 --> 00:06:18.320
any vector x.

00:06:18.320 --> 00:06:20.320
And I'm saying I can do this
because I've at least shown

00:06:20.320 --> 00:06:23.360
you visually that it is indeed
a linear transformation.

00:06:23.360 --> 00:06:25.430
And how do I find A?

00:06:25.430 --> 00:06:31.320
Well, I start with-- since this
where's mapping from R2--

00:06:31.320 --> 00:06:35.060
I start with the identity
matrix in R2

00:06:35.060 --> 00:06:37.710
which is 1, 0, 0, 1.

00:06:37.710 --> 00:06:41.990
Its columns are the basis
vectors for R2, right?

00:06:41.990 --> 00:06:46.720
We refer to this one as e1 and
this column vector as e2.

00:06:46.720 --> 00:06:49.100
And to figure out A, we
essentially just perform the

00:06:49.100 --> 00:06:52.750
transformation on each
of these columns.

00:06:52.750 --> 00:06:54.480
So let me write that.

00:06:54.480 --> 00:07:00.200
So A-- our matrix A-- is going
to be-- the first column of it

00:07:00.200 --> 00:07:04.460
is going to be a rotation
transformation performed on

00:07:04.460 --> 00:07:07.410
the vector 1, 0.

00:07:07.410 --> 00:07:11.210
And our second column is going
to be the rotation

00:07:11.210 --> 00:07:14.020
transformation-- there's a
little theta here that I'm

00:07:14.020 --> 00:07:19.460
forgetting to write-- times the
second column vector-- or

00:07:19.460 --> 00:07:22.730
the transformation of
that one, 0, 1.

00:07:22.730 --> 00:07:25.010
This is what our A is
going to look like.

00:07:25.010 --> 00:07:27.250
So how do we figure out
what these are?

00:07:27.250 --> 00:07:29.200
I'm trying to get to some
numbers and this doesn't get

00:07:29.200 --> 00:07:31.860
me there, so let's
try to do that.

00:07:31.860 --> 00:07:36.010
Let me draw some
more axes here.

00:07:36.010 --> 00:07:39.500
Let me pick a different color,
I'll do it in grey.

00:07:39.500 --> 00:07:41.820
So that is my vertical axes.

00:07:41.820 --> 00:07:44.940
That is my horizontal axes.

00:07:44.940 --> 00:07:48.560
I could call this the x1-axis
and this is the x2-axis.

00:07:48.560 --> 00:07:52.250
Now this basis vector e1,
what does it look like?

00:07:52.250 --> 00:07:57.190
Well, it's 1 in the horizontal
x1 is 1 and x2 is 0.

00:07:57.190 --> 00:08:01.700
So this is 1 out here, e1
will look like that.

00:08:01.700 --> 00:08:04.210
Let me do it in a more
vibrant color.

00:08:04.210 --> 00:08:11.230
e1 will look like that
right there.

00:08:11.230 --> 00:08:14.370
Now let me write what e2 looks
like. e2 would look like--

00:08:14.370 --> 00:08:16.750
I'll do it in yellow--
e2 would look

00:08:16.750 --> 00:08:19.600
like this right here.

00:08:19.600 --> 00:08:22.810
e2-- that's that vector, 0, 1.

00:08:22.810 --> 00:08:25.980
This is 1 in our x2 direction.

00:08:25.980 --> 00:08:30.380
Now if I rotate e1 by an angle
theta, what will it look like?

00:08:30.380 --> 00:08:33.130
So if I rotate e1 in angle theta
-- I'll do it in this

00:08:33.130 --> 00:08:36.254
color right here-- it will still
have a length of 1, but

00:08:36.254 --> 00:08:38.669
it'll be rotated like
that and that angle

00:08:38.669 --> 00:08:40.470
right there is theta.

00:08:40.470 --> 00:08:47.000
So this right here is the
rotation of e1 by theta.

00:08:47.000 --> 00:08:49.520
These are all vectors,
of course.

00:08:49.520 --> 00:08:50.670
That's what that is.

00:08:50.670 --> 00:08:53.280
Now what are the coordinates
for this?

00:08:53.280 --> 00:08:58.160
Or how do we specify
this new vector?

00:08:58.160 --> 00:09:01.000
Well we can break out a little
bit of our trigonometry.

00:09:01.000 --> 00:09:04.680
Its new x1 coordinate-- we
could call it-- or its x1

00:09:04.680 --> 00:09:07.580
entry is going to be this
length right here.

00:09:11.390 --> 00:09:15.810
So if we draw a right triangle,
it is the side that

00:09:15.810 --> 00:09:17.550
is adjacent to theta.

00:09:17.550 --> 00:09:20.740
This side is a hypotenuse
which is length 1.

00:09:20.740 --> 00:09:22.210
So how do we figure
out this side?

00:09:22.210 --> 00:09:24.980
If we call this side
the adjacent side.

00:09:24.980 --> 00:09:27.480
The adjacent side over
the hypotenuse.

00:09:27.480 --> 00:09:29.940
Adjacent-- let me write
it over here.

00:09:29.940 --> 00:09:33.900
Adjacent over the hypotenuse
which is just 1, is equal to

00:09:33.900 --> 00:09:35.920
the cosine of theta.

00:09:35.920 --> 00:09:41.580
That comes from SOH-CAH-TOA
Let me write that.

00:09:41.580 --> 00:09:46.530
Cosine is adjacent over
hypoteneuse, and the adjacent

00:09:46.530 --> 00:09:51.480
side is going to be our new
x1 coordinate, right?

00:09:51.480 --> 00:09:53.970
Well, we can obviously ignore
that 1, a divided by 1 is

00:09:53.970 --> 00:09:55.680
equal to cosine theta, which
means that a is equal to

00:09:55.680 --> 00:09:59.340
cosine theta, which means that
this length of our rotated

00:09:59.340 --> 00:10:02.540
vector is equal to
cosine theta.

00:10:02.540 --> 00:10:05.870
Its horizontal component, or its
horizontal coordinate is

00:10:05.870 --> 00:10:08.930
equal to cosine of theta.

00:10:08.930 --> 00:10:15.540
Now, what's its vertical
component going to be?

00:10:15.540 --> 00:10:19.110
Its vertical component is going
to be this height right

00:10:19.110 --> 00:10:23.960
here, which is the same thing
as that height right there.

00:10:23.960 --> 00:10:26.910
Or we could say sine of theta--
and call this the

00:10:26.910 --> 00:10:30.400
opposite-- sine of theta is
equal to the opposite over 1.

00:10:30.400 --> 00:10:33.350
So this is going to be equal
to sine of theta, right?

00:10:33.350 --> 00:10:36.090
This over 1, which is just
this, is equal to sine of

00:10:36.090 --> 00:10:37.340
theta from SOH-KAH-TOA.

00:10:40.110 --> 00:10:43.070
So this vertical component is
equal to sine of theta.

00:10:43.070 --> 00:10:46.030
So the new rotated basis vector
could be written as

00:10:46.030 --> 00:10:49.815
cosine of theta for its x
component, or for its

00:10:49.815 --> 00:10:50.580
horizontal component.

00:10:50.580 --> 00:10:55.510
And sine of theta for its
vertical component.

00:10:55.510 --> 00:10:59.150
This is the new rotated
basis vector.

00:10:59.150 --> 00:11:00.990
Now what about e2?

00:11:00.990 --> 00:11:03.630
We could do something very
similar there. e2 is going to

00:11:03.630 --> 00:11:06.220
end up looking like this
when you rotate it

00:11:06.220 --> 00:11:08.880
by an angle of theta.

00:11:08.880 --> 00:11:10.140
It's going to look like that.

00:11:10.140 --> 00:11:12.190
That angle right
there is theta.

00:11:12.190 --> 00:11:19.040
We can create a little right
triangle right there.

00:11:19.040 --> 00:11:24.540
And so if we want to know its
x coordinate-- so now we're

00:11:24.540 --> 00:11:28.580
concerned with the rotation
through an angle of theta of

00:11:28.580 --> 00:11:32.420
e2, which is that right
there, of e2.

00:11:32.420 --> 00:11:35.410
This is e2 right there.

00:11:35.410 --> 00:11:36.890
This is going to be
equal to what?

00:11:36.890 --> 00:11:41.870
Its new x coordinate or its
first entry in this vector if

00:11:41.870 --> 00:11:44.125
we wanted to draw it in
standard position.

00:11:44.125 --> 00:11:46.670
Or the point that it is
specifying is going to be

00:11:46.670 --> 00:11:49.960
equal to this distance, which
is equal to this distance on

00:11:49.960 --> 00:11:50.970
this triangle.

00:11:50.970 --> 00:11:51.910
But the coordinate is
going to be the

00:11:51.910 --> 00:11:52.990
negative of this, right?

00:11:52.990 --> 00:11:55.060
If this is a distance of
2, this coordinate is

00:11:55.060 --> 00:11:56.370
going to be minus 2.

00:11:56.370 --> 00:11:57.030
So what's this?

00:11:57.030 --> 00:11:57.840
We have an angle.

00:11:57.840 --> 00:11:59.140
It's a right triangle.

00:11:59.140 --> 00:12:00.930
This is opposite to the angle.

00:12:00.930 --> 00:12:03.500
Opposite over 1, opposite
over hypotenuse is equal

00:12:03.500 --> 00:12:05.480
to cosine of theta.

00:12:05.480 --> 00:12:09.130
So this opposite side is equal
to the cosine of theta.

00:12:09.130 --> 00:12:12.040
So the x-coordinate
right here.

00:12:12.040 --> 00:12:15.270
Oh sorry, my trigonometry
is messing up.

00:12:15.270 --> 00:12:17.990
This is the opposite
side-- SOH-CAH-TOA.

00:12:17.990 --> 00:12:21.930
Sine is equal to opposite--
let me write it-- sine of

00:12:21.930 --> 00:12:25.910
theta is equal to opposite
over hypotenuse.

00:12:25.910 --> 00:12:29.360
So the sine of theta-- the sine
of this angle is equal to

00:12:29.360 --> 00:12:31.290
the opposite over
the hypotenuse.

00:12:31.290 --> 00:12:33.820
The hypotenuse is 1, has length
1 because these are the

00:12:33.820 --> 00:12:35.520
standard basis vectors.

00:12:35.520 --> 00:12:38.000
So this is equal to
the sine of theta.

00:12:38.000 --> 00:12:40.810
Now, this distance is equal to
the sine of theta that's going

00:12:40.810 --> 00:12:43.630
in the negative direction, so
it's going to be equal to the

00:12:43.630 --> 00:12:47.210
minus sine of theta.

00:12:47.210 --> 00:12:50.690
And then what it's new y
component going to be of this

00:12:50.690 --> 00:12:52.710
rotated version of e2?

00:12:52.710 --> 00:12:55.030
Well, we just look right here.

00:12:55.030 --> 00:12:56.530
We have our angle.

00:12:56.530 --> 00:12:58.570
This is adjacent to the angle.

00:12:58.570 --> 00:13:02.510
This adjacent side over the
hypotenuse-- adjacent over 1--

00:13:02.510 --> 00:13:05.270
which is just this is adjacent
right here is just going to be

00:13:05.270 --> 00:13:07.600
equal to cosine of theta.

00:13:07.600 --> 00:13:11.700
So its new y-coordinate going
to be cosine of theta.

00:13:11.700 --> 00:13:14.780
So when we apply the
transformation to each of our

00:13:14.780 --> 00:13:21.620
basis vectors, we get A is equal
to the transformation

00:13:21.620 --> 00:13:27.530
applied to e1 which is cosine
of theta and sine of theta.

00:13:27.530 --> 00:13:31.300
And the transformation applied
to e2, which is minus sine of

00:13:31.300 --> 00:13:34.820
theta times the cosine
of theta.

00:13:34.820 --> 00:13:37.010
So now this is a big result.

00:13:37.010 --> 00:13:39.850
We've now been able to
mathematically specify our

00:13:39.850 --> 00:13:42.750
rotation transformation
using a matrix.

00:13:42.750 --> 00:13:48.040
So we can now say that the
rotation transformation-- and

00:13:48.040 --> 00:13:52.560
it's a transformation from R2
to R2-- it's a function.

00:13:52.560 --> 00:13:56.610
We can say that the rotation
through an angle of theta of

00:13:56.610 --> 00:14:01.860
any vector x in our domain is
equal to the matrix cosine of

00:14:01.860 --> 00:14:07.320
theta, sine of theta, minus
sine of theta, cosine of

00:14:07.320 --> 00:14:13.960
theta, times your vector in your
domain, times x1 and x2.

00:14:13.960 --> 00:14:16.920
And you might be saying, oh Sal,
we did all this work and

00:14:16.920 --> 00:14:18.710
that's kind of neat, but
how do I apply this?

00:14:18.710 --> 00:14:21.200
I still have all these cosines
of thetas and sines of thetas

00:14:21.200 --> 00:14:22.320
there-- how I do it?

00:14:22.320 --> 00:14:24.730
Well, what you do is, you pick
an angle you want to rotate

00:14:24.730 --> 00:14:27.590
to, and just evaluate these, and
you'll just have a normal

00:14:27.590 --> 00:14:28.740
matrix with numbers in it.

00:14:28.740 --> 00:14:32.760
So let's say we wanted to rotate
through an angle of 45

00:14:32.760 --> 00:14:35.660
degrees some vector.

00:14:35.660 --> 00:14:38.290
Well, this is going to
be equal to what?

00:14:38.290 --> 00:14:41.510
We just apply, or we evaluate
each of these

00:14:41.510 --> 00:14:42.950
ratios at 45 degrees.

00:14:42.950 --> 00:14:47.310
A cosine of 45 degrees is the
square root of 2 over 2.

00:14:47.310 --> 00:14:50.870
Sine of 45 degrees is square
root of 2 over 2.

00:14:50.870 --> 00:14:52.540
Sine of 45 is the square
root of 2 over 2.

00:14:52.540 --> 00:14:54.530
We have a minus there--
so minus the square

00:14:54.530 --> 00:14:56.010
root of 2 over 2.

00:14:56.010 --> 00:15:02.960
And then cosine is just square
root of 2 over 2.

00:15:02.960 --> 00:15:05.220
So we multiply it times
our vector x.

00:15:05.220 --> 00:15:07.830
So this matrix, if we
multiply it times

00:15:07.830 --> 00:15:11.700
any vector x, literally.

00:15:11.700 --> 00:15:17.330
So if we have some coordinates
right here.

00:15:17.330 --> 00:15:22.260
And let's say that I were to
have a bunch of vectors that

00:15:22.260 --> 00:15:24.800
specify some square here.

00:15:24.800 --> 00:15:28.340
Let me see if I can
do it properly.

00:15:28.340 --> 00:15:30.300
Well, maybe it has some triangle
here--maybe that will

00:15:30.300 --> 00:15:32.620
be a little easier
for me to draw.

00:15:32.620 --> 00:15:34.410
I'll do a square.

00:15:34.410 --> 00:15:40.382
Let's say it has some square
here in my domain.

00:15:40.382 --> 00:15:43.580
So this is in R2.

00:15:43.580 --> 00:15:46.760
If I literally multiply this
times each of the basis

00:15:46.760 --> 00:15:49.880
vectors, or actually all of the
vectors that specify this

00:15:49.880 --> 00:15:54.790
set here, I will get, when I
transform it, I'll get a

00:15:54.790 --> 00:15:57.710
rotated version of this
by 45 degrees.

00:15:57.710 --> 00:16:00.380
Just to draw it, I'll actually
draw a little 45 degree angle

00:16:00.380 --> 00:16:01.570
right there.

00:16:01.570 --> 00:16:07.430
And then it will map it to this
image right there, which

00:16:07.430 --> 00:16:08.940
is a pretty neat result.

00:16:08.940 --> 00:16:12.670
And if you ever attempted to
write any computer game that

00:16:12.670 --> 00:16:16.480
involves marbles or pinballs
going around, this is a very

00:16:16.480 --> 00:16:19.220
useful thing to know-- how
you rotate things.

00:16:19.220 --> 00:16:21.360
In the future, we'll talk
about other types of

00:16:21.360 --> 00:16:22.010
transformations.

00:16:22.010 --> 00:16:24.780
But this is a super useful one
and this is super hard to do.

00:16:24.780 --> 00:16:26.780
And I remember the first time I
wrote a computer program to

00:16:26.780 --> 00:16:28.600
try to do this type of thing,
I just did it by hand.

00:16:28.600 --> 00:16:31.670
But when you have this tool at
your disposal, all you have to

00:16:31.670 --> 00:16:34.625
do is evaluate this matrix at
the angle you want to rotate

00:16:34.625 --> 00:16:38.420
it by, and then multiply it
times your position vectors.

00:16:38.420 --> 00:16:40.010
And so obviously you
have a bunch of

00:16:40.010 --> 00:16:40.930
position vectors here.

00:16:40.930 --> 00:16:44.780
But here you can just do it
times the vertices and then

00:16:44.780 --> 00:16:45.720
you can say OK.

00:16:45.720 --> 00:16:47.990
And everything else is just
connect the dots between them.

00:16:47.990 --> 00:16:50.550
And then you have your
rotated image.

00:16:50.550 --> 00:16:54.910
And just to be clear, these are
the points specified by a

00:16:54.910 --> 00:16:56.150
set of vectors and
I always want to

00:16:56.150 --> 00:16:57.060
make this clear, right?

00:16:57.060 --> 00:17:00.540
This point right here is
specified by some position

00:17:00.540 --> 00:17:01.620
vector that looks like that.

00:17:01.620 --> 00:17:06.819
When you apply the rotation on
45 degrees of that vector,

00:17:06.819 --> 00:17:09.319
this vector then looks
like this.

00:17:09.319 --> 00:17:12.650
And the vector that specified
this corner right here-- we'll

00:17:12.650 --> 00:17:16.119
do it in a different color--
that specified this corner

00:17:16.119 --> 00:17:18.880
right here, when you're rotated
by 45 degrees, then

00:17:18.880 --> 00:17:20.540
becomes this vector.

00:17:20.540 --> 00:17:24.140
And the vector that specified
that corner over there, that

00:17:24.140 --> 00:17:25.800
now becomes this vector.

00:17:25.800 --> 00:17:28.710
That's what actually being
mapped or actually being

00:17:28.710 --> 00:17:29.650
transformed.

00:17:29.650 --> 00:17:31.430
Anyway, hopefully you found
this pretty neat.

00:17:31.430 --> 00:17:35.500
I thought this was, at least for
me, the first really neat

00:17:35.500 --> 00:17:35.900
transformation.

00:17:35.900 --> 00:17:38.490
And you can already start
thinking about how to extend

00:17:38.490 --> 00:17:40.860
this into multiple dimensions
especially three dimensionals.

00:17:40.860 --> 00:17:43.420
If you ever try to actually do
it by hand, three dimension

00:17:43.420 --> 00:17:44.940
rotation becomes
very confusing.

00:17:44.940 --> 00:17:47.230
But in the next video we'll
actually figure out a way to

00:17:47.230 --> 00:17:49.550
do three dimensional rotations
around certain axes.


Linear transformation examples: Scaling and reflections

WEBVTT
Kind: captions
Language: en

00:00:00.530 --> 00:00:02.970
We've talked a lot about
linear transformations.

00:00:02.970 --> 00:00:05.070
What I want to do in this video,
and actually the next

00:00:05.070 --> 00:00:08.550
few videos, is to show you how
to essentially design linear

00:00:08.550 --> 00:00:11.230
transformations to do things
to vectors that you

00:00:11.230 --> 00:00:12.850
want them to do.

00:00:12.850 --> 00:00:15.140
So we already know that
if I have some linear

00:00:15.140 --> 00:00:23.780
transformation, T, and it's a
mapping from Rn to Rm, then we

00:00:23.780 --> 00:00:28.850
can represent T-- what T does
to any vector in x, or the

00:00:28.850 --> 00:00:33.350
mapping of T of x in Rn to Rm--
we could represent it as

00:00:33.350 --> 00:00:38.570
some matrix times the vector
x, where this would

00:00:38.570 --> 00:00:41.200
be an m by n matrix.

00:00:43.950 --> 00:00:46.710
And we know that we can always
construct this matrix, that

00:00:46.710 --> 00:00:50.830
any linear transformation
can be represented by

00:00:50.830 --> 00:00:51.840
a matrix this way.

00:00:51.840 --> 00:00:55.160
And we can represent it by
taking our identity matrix,

00:00:55.160 --> 00:01:02.570
you've seen that before, with
n rows and n columns, so it

00:01:02.570 --> 00:01:04.650
literally just looks
like this.

00:01:04.650 --> 00:01:07.970
So it's a 1, and then it has n
minus 1, 0's all the way down.

00:01:07.970 --> 00:01:10.600
Then it's a 0, 1, and
everything else is

00:01:10.600 --> 00:01:11.890
0's all the way down.

00:01:11.890 --> 00:01:14.110
And so essentially you just
have 1's down as diagonal.

00:01:14.110 --> 00:01:15.580
It's an n by n matrix.

00:01:15.580 --> 00:01:17.860
All of these are 0's,
just like that.

00:01:17.860 --> 00:01:22.700
You take your identity matrix
and you perform the

00:01:22.700 --> 00:01:24.550
transformation on each
of its columns.

00:01:27.500 --> 00:01:30.890
We call each of these columns
the standard basis Rn.

00:01:30.890 --> 00:01:34.180
So this is column e1,
this is column e2,

00:01:34.180 --> 00:01:35.890
and it has n columns.

00:01:35.890 --> 00:01:37.040
en.

00:01:37.040 --> 00:01:39.490
And each of these columns are
of course members of Rn

00:01:39.490 --> 00:01:43.650
because this is n rows
and n columns matrix.

00:01:43.650 --> 00:01:50.140
And we know that A, our matrix
A, can be represented as the

00:01:50.140 --> 00:01:53.040
transformation being operated
on each of these columns.

00:01:53.040 --> 00:01:58.670
So the transformation on e1, and
the transformation on e2,

00:01:58.670 --> 00:02:00.930
so forth and so on,
all the way to the

00:02:00.930 --> 00:02:03.880
transformation to en.

00:02:03.880 --> 00:02:07.290
And this is a really useful
thing to know because it's

00:02:07.290 --> 00:02:10.320
very easy to operate any
transformation on each of

00:02:10.320 --> 00:02:15.060
these basis vectors that only
have a 1 in its corresponding

00:02:15.060 --> 00:02:18.580
dimension, or with respect to
the corresponding variable,

00:02:18.580 --> 00:02:20.360
and everything else is 0.

00:02:20.360 --> 00:02:22.380
So all of this is review.

00:02:22.380 --> 00:02:25.430
Let's actually use this
information to construct some

00:02:25.430 --> 00:02:27.180
interesting transformations.

00:02:27.180 --> 00:02:32.740
So let's start with some
set in our Rn.

00:02:32.740 --> 00:02:34.880
And actually everything I'm
going to do is going to be in

00:02:34.880 --> 00:02:38.070
R2, but you can extend a lot
of this into just general

00:02:38.070 --> 00:02:39.130
dimensions.

00:02:39.130 --> 00:02:41.390
But we're dealing with
R2 right here.

00:02:41.390 --> 00:02:43.610
Obviously, it's only 2
dimensions right here.

00:02:43.610 --> 00:02:49.470
Let's say we have a triangle
formed by the points, let's

00:02:49.470 --> 00:02:51.480
say the first point
is right here.

00:02:51.480 --> 00:02:53.860
Let's say it's the point 3, 2.

00:02:56.890 --> 00:03:00.760
And then you have the point,
let's say that your next point

00:03:00.760 --> 00:03:03.960
in your triangle, is the point,
let's just make it the

00:03:03.960 --> 00:03:05.210
point minus 3, 2.

00:03:10.440 --> 00:03:12.170
I shouldn't have written
that as a fraction.

00:03:12.170 --> 00:03:13.510
I don't know why I did that.

00:03:13.510 --> 00:03:14.950
3, 2.

00:03:14.950 --> 00:03:16.430
Then you have the point
minus 3, 2.

00:03:19.050 --> 00:03:21.300
And that's this point
right here.

00:03:21.300 --> 00:03:23.710
Minus 3, 2.

00:03:23.710 --> 00:03:26.320
And then let's say, just for
fun, let's say you have the

00:03:26.320 --> 00:03:33.660
point, or the vector-- the
position vector, right?

00:03:33.660 --> 00:03:34.910
3, minus 2.

00:03:39.040 --> 00:03:41.470
Which is right here.

00:03:41.470 --> 00:03:44.170
Now each of these are position
vectors, and I can draw them.

00:03:44.170 --> 00:03:47.790
I could draw this 3, 2 as in
the standard position by

00:03:47.790 --> 00:03:48.820
drawing an arrow like that.

00:03:48.820 --> 00:03:50.500
I could do the minus 3,
2 in its standard

00:03:50.500 --> 00:03:51.760
position like that.

00:03:51.760 --> 00:03:53.960
And 3, minus 2 I could
draw like that.

00:03:53.960 --> 00:03:56.170
But more than the actual
position vectors, I'm more

00:03:56.170 --> 00:03:58.960
concerned with the positions
that they specify.

00:03:58.960 --> 00:04:03.150
And we know that if we take
the set of all of the

00:04:03.150 --> 00:04:05.640
positions or all of the position
vectors that specify

00:04:05.640 --> 00:04:08.050
the triangle that is essentially
formed by

00:04:08.050 --> 00:04:10.700
connecting these dots.

00:04:10.700 --> 00:04:17.660
The transformation of this set--
so we're going to apply

00:04:17.660 --> 00:04:20.850
some transformation of that--
is essentially, you can take

00:04:20.850 --> 00:04:23.310
the transformation of each of
these endpoints and then you

00:04:23.310 --> 00:04:25.080
connect the dots in
the same order.

00:04:25.080 --> 00:04:27.870
And we saw that several
videos ago.

00:04:27.870 --> 00:04:30.925
But let's actually design
a transformation here.

00:04:30.925 --> 00:04:33.770
So let's say we want to-- let's
just write down and

00:04:33.770 --> 00:04:37.180
words what we want to
do with whatever we

00:04:37.180 --> 00:04:38.430
start in our domain.

00:04:38.430 --> 00:04:43.100
Let's say we want to reflect
around the x-axis.

00:04:43.100 --> 00:04:49.390
Reflect around-- well
actually let's

00:04:49.390 --> 00:04:52.380
reflect around the y-axis.

00:04:52.380 --> 00:04:54.670
We essentially want
to flip it over.

00:04:54.670 --> 00:04:56.230
We want to flip it
over that way.

00:04:56.230 --> 00:04:58.690
So I'm kind of envisioning
something that'll look

00:04:58.690 --> 00:05:02.475
something like that when
we flip it over.

00:05:02.475 --> 00:05:04.740
So we're going to reflect
it around the y-axis.

00:05:04.740 --> 00:05:14.490
And let's say we want to stretch
in y direction by 2.

00:05:14.490 --> 00:05:19.730
In y direction times 2.

00:05:19.730 --> 00:05:21.080
So what I envision, we're
going to flip

00:05:21.080 --> 00:05:22.440
it over like this.

00:05:22.440 --> 00:05:23.670
What I just drew here.

00:05:23.670 --> 00:05:25.775
And then we want to stretch
it, so we're going

00:05:25.775 --> 00:05:26.710
to first flip it.

00:05:26.710 --> 00:05:28.020
That's kind of a step 1.

00:05:28.020 --> 00:05:29.930
And then step 2 is we're
going to stretch it.

00:05:29.930 --> 00:05:32.890
So instead of looking like this,
it'll be twice as tall,

00:05:32.890 --> 00:05:34.760
so it'll look like this.

00:05:34.760 --> 00:05:36.960
Without necessarily
stretching the x.

00:05:36.960 --> 00:05:38.570
So how can we do that?

00:05:38.570 --> 00:05:40.990
So the first idea of reflecting

00:05:40.990 --> 00:05:44.580
around the y axis, right?

00:05:44.580 --> 00:05:49.030
So what we want is, this point,
that was a minus 3 in

00:05:49.030 --> 00:05:52.370
the x-coordinate right there, we
want this point to have its

00:05:52.370 --> 00:05:53.720
same y-coordinate.

00:05:53.720 --> 00:05:55.910
We want it to still
have a 2 there.

00:05:55.910 --> 00:05:57.510
And I'm calling the second
coordinate here our

00:05:57.510 --> 00:05:58.100
y-coordinate.

00:05:58.100 --> 00:06:00.690
I could call that our x2
coordinate, but we're used to

00:06:00.690 --> 00:06:03.810
dealing with the y coordinate
when we graph things.

00:06:03.810 --> 00:06:06.280
So I'll just keep calling
it the y-coordinate.

00:06:06.280 --> 00:06:10.670
But we want is this negative
3 to turn to a positive 3.

00:06:10.670 --> 00:06:13.680
Because we want this point
to end up over here.

00:06:13.680 --> 00:06:16.300
And we want this positive 3
here to end up becoming a

00:06:16.300 --> 00:06:18.090
negative 3 over here.

00:06:18.090 --> 00:06:20.980
And we want this positive 3 for
the x-coordinate to end up

00:06:20.980 --> 00:06:22.770
as a negative 3 over there.

00:06:22.770 --> 00:06:24.480
So you can imagine all
we're doing is we're

00:06:24.480 --> 00:06:26.070
flipping the sign.

00:06:26.070 --> 00:06:30.160
This reflection around y, this
is just equivalent to flipping

00:06:30.160 --> 00:06:33.810
the sign, flipping the sign
of the x-coordinate.

00:06:33.810 --> 00:06:39.950
So this statement right here is
equivalent to minus 1 times

00:06:39.950 --> 00:06:41.110
the x-coordinate.

00:06:41.110 --> 00:06:45.050
So let's call that times x1.

00:06:45.050 --> 00:06:48.440
Because this is x1.

00:06:48.440 --> 00:06:50.480
And then stretching in
the y direction.

00:06:50.480 --> 00:06:52.190
So what does that mean?

00:06:52.190 --> 00:06:56.180
That means that whatever height
we have here-- so this

00:06:56.180 --> 00:06:58.735
next step here is whatever
height we have here-- I want

00:06:58.735 --> 00:07:00.240
it to be 2 times as much.

00:07:00.240 --> 00:07:04.030
So right here this coordinate
is 3, 2.

00:07:04.030 --> 00:07:06.210
If I didn't do this first
step first, I'd want

00:07:06.210 --> 00:07:07.450
to make it 3, 4.

00:07:07.450 --> 00:07:10.860
I want to make it 2 times
the y-coordinate.

00:07:10.860 --> 00:07:13.870
So the next thing I want to do
is I want to 2 times-- well I

00:07:13.870 --> 00:07:17.830
can either call it, let me just
call it the y-coordinate.

00:07:17.830 --> 00:07:19.720
It's a little bit different
convention that I've been

00:07:19.720 --> 00:07:22.540
using, but I'm just calling
these vectors-- instead of

00:07:22.540 --> 00:07:26.520
calling them x1, and x2, I'm
saying that my vectors in R2--

00:07:26.520 --> 00:07:29.950
the first term I'm calling the
x term, or the x entry, and

00:07:29.950 --> 00:07:32.010
the second term I'm calling
the y entry.

00:07:32.010 --> 00:07:33.980
But it's the same idea that
we've been doing before.

00:07:33.980 --> 00:07:36.460
I'm just switching to this
notation because we're used to

00:07:36.460 --> 00:07:40.260
thinking of this as the y-axis
access as opposed to the x1

00:07:40.260 --> 00:07:42.150
and x2 axis.

00:07:42.150 --> 00:07:44.910
So how do we construct
this transformation?

00:07:44.910 --> 00:07:49.000
I mean, I can write it down in
kind of transformation words.

00:07:49.000 --> 00:07:54.140
I could say-- I could define
my transformation as T

00:07:54.140 --> 00:07:56.220
of some vector x.

00:07:56.220 --> 00:07:58.380
Let me write it this way.

00:07:58.380 --> 00:08:05.690
T of some vector x, y is going
to be equal to-- I want to

00:08:05.690 --> 00:08:09.260
take minus 1 times the x, so
I'm going to minus the x.

00:08:09.260 --> 00:08:12.860
And I'm going to multiply
2 times the y.

00:08:12.860 --> 00:08:14.950
So that's how I could just write
it in transformation

00:08:14.950 --> 00:08:16.780
language, and that's pretty
straight forward.

00:08:16.780 --> 00:08:19.740
But how would I actually
construct a matrix for this?

00:08:19.740 --> 00:08:21.310
So what you do is, you
just take your--

00:08:21.310 --> 00:08:22.620
we're dealing in R2.

00:08:22.620 --> 00:08:27.450
So you start off with the
identity matrix in R2, which

00:08:27.450 --> 00:08:30.840
is just 1, 0, 0, 1.

00:08:30.840 --> 00:08:33.809
And you apply this
transformation to each of the

00:08:33.809 --> 00:08:35.596
columns of this identity
matrix.

00:08:40.020 --> 00:08:43.789
So if you apply the
transformation to this first

00:08:43.789 --> 00:08:45.700
column, what do you get?

00:08:45.700 --> 00:08:49.130
So what we're going to do is
to create a new matrix, A.

00:08:49.130 --> 00:08:53.030
And say that is equal to the
transformation of-- let me

00:08:53.030 --> 00:08:59.340
write it like this--
Transformation of 1, 0.

00:08:59.340 --> 00:09:00.710
That is going to be our new
column, we're just going to

00:09:00.710 --> 00:09:02.130
transform this column.

00:09:02.130 --> 00:09:06.720
And the second column is going
to be the transformation of

00:09:06.720 --> 00:09:07.340
that column.

00:09:07.340 --> 00:09:11.130
So it's a transformation
of 0, 1.

00:09:11.130 --> 00:09:12.570
Just like that.

00:09:12.570 --> 00:09:14.340
And so what are these
equal to?

00:09:14.340 --> 00:09:15.850
The transformation of 1, 0.

00:09:15.850 --> 00:09:20.830
So let me write it down
here in green.

00:09:20.830 --> 00:09:23.120
So A is equal to?

00:09:23.120 --> 00:09:26.150
What's the transformation
of 1, 0 where x is 1?

00:09:26.150 --> 00:09:28.060
Where we just take the minus
of the x term, so

00:09:28.060 --> 00:09:29.930
we get minus 1.

00:09:29.930 --> 00:09:32.100
And then 2 times the y term.

00:09:32.100 --> 00:09:34.830
So 2 times 0 is just 0.

00:09:34.830 --> 00:09:36.160
Now do the second term.

00:09:36.160 --> 00:09:38.920
The minus of the 0 term
is just minus 0.

00:09:38.920 --> 00:09:40.560
So that just stays 0.

00:09:40.560 --> 00:09:42.740
Then you multiply 2
times the y term.

00:09:42.740 --> 00:09:47.235
So 2 times y is going to be
equal to 2 times 1, so it's

00:09:47.235 --> 00:09:48.830
equal to 2.

00:09:48.830 --> 00:09:52.140
So now we can describe this
transformation-- so now we

00:09:52.140 --> 00:09:56.960
could say the transformation
of some vector, x, y.

00:09:56.960 --> 00:10:00.460
We can describe it as a
matrix-vector product.

00:10:00.460 --> 00:10:08.040
It is equal to minus 1, 0,
0, 2, times our vector.

00:10:08.040 --> 00:10:09.510
Times x, y.

00:10:09.510 --> 00:10:12.880
And let's apply it to verify
that it works.

00:10:12.880 --> 00:10:15.370
To verify that our
matrix works.

00:10:15.370 --> 00:10:18.470
So this first point, and I'll
try to do it color coded,

00:10:18.470 --> 00:10:20.490
let's do this first
point right here.

00:10:20.490 --> 00:10:23.370
This is minus 3, 2.

00:10:23.370 --> 00:10:25.910
So that's minus 3, 2.

00:10:25.910 --> 00:10:32.200
So what is minus 3, 2-- I'll
do it right over here.

00:10:32.200 --> 00:10:33.740
I could just look at that.

00:10:33.740 --> 00:10:44.080
So what minus 1, 0, 0,
2, times minus 3, 2?

00:10:44.080 --> 00:10:47.070
Well this is just a straight
up matrix-vector product.

00:10:47.070 --> 00:10:52.570
Minus 1 times minus 3 is
positive 3 plus 0 times 2.

00:10:52.570 --> 00:10:53.700
So plus 0.

00:10:53.700 --> 00:10:55.260
So this is 3.

00:10:55.260 --> 00:10:59.010
And then 0 times minus 3 is 0.

00:10:59.010 --> 00:11:00.230
Plus 2 times 2.

00:11:00.230 --> 00:11:02.510
This is 3, 4.

00:11:02.510 --> 00:11:07.410
So that point right there will
now become the point 3, 4.

00:11:07.410 --> 00:11:10.180
It now becomes that
point right there.

00:11:10.180 --> 00:11:14.690
Let's look at this point right
here, the point 3, 2.

00:11:14.690 --> 00:11:17.090
So let's take our transformation
matrix, minus

00:11:17.090 --> 00:11:23.220
1, 0, 0, 2, times 3, 2.

00:11:23.220 --> 00:11:29.010
This is equal to minus 1 times
3 is minus 3 plus 0 times 2.

00:11:29.010 --> 00:11:30.205
So it's just minus 3.

00:11:30.205 --> 00:11:32.940
And you have 0 times
3, which is 0.

00:11:32.940 --> 00:11:34.830
Plus 2 times 2, which is 4.

00:11:34.830 --> 00:11:37.440
0 plus-- so you got
that point.

00:11:37.440 --> 00:11:41.590
So this point, by our
transformation, T, becomes

00:11:41.590 --> 00:11:42.970
minus 3, 4.

00:11:42.970 --> 00:11:45.430
So minus 3, 4.

00:11:45.430 --> 00:11:47.530
And I kind of switch
in my terminology.

00:11:47.530 --> 00:11:50.460
I said, becomes, or you could
say it's mapped to if you want

00:11:50.460 --> 00:11:53.510
to use the language that I used
when I introduced the

00:11:53.510 --> 00:11:55.620
ideas of functions and
transformation.

00:11:55.620 --> 00:11:58.720
This point is mapped to
this point in R2.

00:11:58.720 --> 00:12:02.550
And then finally let's look at
this point right here, apply

00:12:02.550 --> 00:12:06.090
our transformation matrix
that we've engineered.

00:12:06.090 --> 00:12:12.590
Let's multiply minus 1, 0, 0,
2, times this point right

00:12:12.590 --> 00:12:14.730
here, which is 3, minus 2.

00:12:17.800 --> 00:12:22.960
Which is equal to minus
1 times 3 is minus 3.

00:12:22.960 --> 00:12:24.810
And then 0 times minus
2 is just 0.

00:12:24.810 --> 00:12:27.220
So this just becomes minus 3.

00:12:27.220 --> 00:12:29.300
And then 0 times 3 is 0.

00:12:29.300 --> 00:12:32.290
2 times minus 2 is minus 4.

00:12:32.290 --> 00:12:34.470
So minus 3, minus 4.

00:12:34.470 --> 00:12:39.320
So this point right here becomes
minus 3, minus 4.

00:12:39.320 --> 00:12:42.400
Becomes that point
right there.

00:12:42.400 --> 00:12:46.670
And we know that the set in R2
that connects these dots, by

00:12:46.670 --> 00:12:49.640
the same transformation, will
be mapped to the set in R3

00:12:49.640 --> 00:12:50.750
that connects these dots.

00:12:50.750 --> 00:12:52.480
We've seen that already.

00:12:52.480 --> 00:12:54.920
I think that was 3 videos ago.

00:12:54.920 --> 00:12:59.410
So the image of this set that
I've drawn here, this triangle

00:12:59.410 --> 00:13:03.360
is just a set of points
specified by a set of vectors.

00:13:03.360 --> 00:13:06.460
The image of that set of
position vectors specifies

00:13:06.460 --> 00:13:09.060
these points right here.

00:13:09.060 --> 00:13:14.480
Specifies the points that
I'm drawing right here.

00:13:14.480 --> 00:13:16.440
Let me see if I'm
doing it right.

00:13:16.440 --> 00:13:18.490
There you go, just like that.

00:13:18.490 --> 00:13:21.450
And low and behold, it has done
what we wanted to do.

00:13:21.450 --> 00:13:24.830
We flipped it over, so that we
got this side onto the other

00:13:24.830 --> 00:13:25.920
side, like that.

00:13:25.920 --> 00:13:27.490
And then we stretched it.

00:13:27.490 --> 00:13:29.060
And we stretched it in
the y direction.

00:13:29.060 --> 00:13:32.200
And we we see that it has
stretched by a factor of 2.

00:13:32.200 --> 00:13:34.340
We flipped it first, and
then we stretched it

00:13:34.340 --> 00:13:35.700
by factor of 2.

00:13:35.700 --> 00:13:39.940
And, in general, any of these
operations can be performed--

00:13:39.940 --> 00:13:42.040
I mean, you can always go
back to the basics.

00:13:42.040 --> 00:13:44.520
You can always say, look I can
write my transformation in

00:13:44.520 --> 00:13:46.340
this type of form, then
I can just apply

00:13:46.340 --> 00:13:49.590
that to my basis vectors.

00:13:49.590 --> 00:13:52.420
Or the columns in my
identity matrix.

00:13:52.420 --> 00:13:57.070
But a general theme is any of
these transformations that

00:13:57.070 --> 00:14:00.725
literally just scale in either
the x or y direction, and when

00:14:00.725 --> 00:14:03.640
I-- or, well, you could
say, scale.

00:14:03.640 --> 00:14:04.970
They can either shrink
or expand

00:14:04.970 --> 00:14:06.280
in the x or y direction.

00:14:06.280 --> 00:14:08.400
Or flip in the x or y direction,
creating a

00:14:08.400 --> 00:14:09.280
reflection.

00:14:09.280 --> 00:14:14.460
These are going to be
diagonal matrices.

00:14:14.460 --> 00:14:15.740
Diagonal matrices.

00:14:21.830 --> 00:14:23.430
And why are they diagonal
matrices?

00:14:23.430 --> 00:14:24.870
Because they only have non-zero

00:14:24.870 --> 00:14:27.395
terms along their diagonals.

00:14:27.395 --> 00:14:28.840
This is the 2 by 2 case.

00:14:28.840 --> 00:14:33.270
If I did a 3 by 3, it would be
0's everywhere, except along

00:14:33.270 --> 00:14:34.210
the diagonal.

00:14:34.210 --> 00:14:37.020
And it makes a lot of sense
because this first term is

00:14:37.020 --> 00:14:38.890
essentially what you're
doing to the x1 term.

00:14:38.890 --> 00:14:42.130
The second term is what you're
doing to the x2 term.

00:14:42.130 --> 00:14:43.900
Or the y term in our example.

00:14:43.900 --> 00:14:46.640
If I had multiple terms, if this
was a 3 by 3, that would

00:14:46.640 --> 00:14:48.680
be what I would do to
the third dimension.

00:14:48.680 --> 00:14:49.900
Then the next term would
be what I would

00:14:49.900 --> 00:14:51.020
do the fourth dimension.

00:14:51.020 --> 00:14:55.430
So you could expand this idea
to an arbitrary Rn.

00:14:55.430 --> 00:14:58.370
Anyway, the whole point of this
video is to introduce you

00:14:58.370 --> 00:15:01.550
to this idea of creating
custom transformations.

00:15:01.550 --> 00:15:03.150
And I think you're already
starting to realize that this

00:15:03.150 --> 00:15:06.540
could be very useful if you
want to do-- especially in

00:15:06.540 --> 00:15:08.610
computer programming-- if
you're going to do some

00:15:08.610 --> 00:15:12.330
graphics or create some type
of multi-dimensional games.


More on matrix addition and scalar multiplication

WEBVTT
Kind: captions
Language: en

00:00:00.540 --> 00:00:03.170
In the last video we started
off with two linear

00:00:03.170 --> 00:00:04.070
transformations.

00:00:04.070 --> 00:00:06.610
We had the linear transformation
s that was a

00:00:06.610 --> 00:00:10.970
mapping from Rn to Rm.

00:00:10.970 --> 00:00:14.290
And then we had the linear
transformation t, that was

00:00:14.290 --> 00:00:19.770
also a mapping from Rn to Rm.

00:00:19.770 --> 00:00:25.170
And we defined the idea of
the addition of these two

00:00:25.170 --> 00:00:26.010
transformations.

00:00:26.010 --> 00:00:32.090
So s plus t, this transformation
of x we defined

00:00:32.090 --> 00:00:42.560
as being equal to s of x,
this vector plus t of x.

00:00:42.560 --> 00:00:47.530
And of course, this input is
still from Rn, and then each

00:00:47.530 --> 00:00:49.130
of these are vectors in Rm.

00:00:49.130 --> 00:00:52.300
If we add two vectors in Rm to
each other, we get another

00:00:52.300 --> 00:00:55.610
vector in Rm because Rm
is a valid subspace.

00:00:55.610 --> 00:00:57.570
It's also closed
under addition.

00:00:57.570 --> 00:00:58.780
So this is still a mapping.

00:00:58.780 --> 00:01:07.600
So s plus t is still a mapping
from Rn to Rm.

00:01:07.600 --> 00:01:10.970
And we also said that every
linear transformation we've

00:01:10.970 --> 00:01:14.050
shown in a previous video, can
be represented as a matrix.

00:01:14.050 --> 00:01:17.640
We could say that s of
x is equal to some

00:01:17.640 --> 00:01:20.120
matrix a times x.

00:01:20.120 --> 00:01:24.590
And we could also say that
t of x is equal to some

00:01:24.590 --> 00:01:26.690
matrix b times x.

00:01:26.690 --> 00:01:30.270
And both of these would
be m by n matrices.

00:01:30.270 --> 00:01:33.800
And let me write that m
by n, both of these.

00:01:33.800 --> 00:01:38.085
Because these are both mappings
from Rn to Rm.

00:01:38.085 --> 00:01:41.680
And what we did is we made
a another definition.

00:01:41.680 --> 00:01:44.370
This was a definition right here
and then we made another

00:01:44.370 --> 00:01:45.820
definition.

00:01:45.820 --> 00:01:49.720
We defined the addition
of two matrices.

00:01:49.720 --> 00:01:54.950
We said any matrix a plus b,
they both have to have the

00:01:54.950 --> 00:01:56.200
same dimensions.

00:01:59.070 --> 00:02:02.160
So they're both m by
n in this case.

00:02:02.160 --> 00:02:09.110
And we defined this addition to
be a new matrix, where each

00:02:09.110 --> 00:02:11.920
column of this matrix is the
sum of the corresponding

00:02:11.920 --> 00:02:13.150
columns of these matrices.

00:02:13.150 --> 00:02:19.640
So this matrix's first column
will be the sum of a's first

00:02:19.640 --> 00:02:20.870
column and b's first column.

00:02:20.870 --> 00:02:26.200
So a1 plus b1, the second column
I'll do a little line

00:02:26.200 --> 00:02:30.000
here is, a2 plus b2.

00:02:30.000 --> 00:02:35.515
And it goes all the
way to An plus Bn.

00:02:38.170 --> 00:02:39.570
This was a definition.

00:02:39.570 --> 00:02:42.080
And the whole reason why we
made this definition, is

00:02:42.080 --> 00:02:45.350
because if you defined matrix
addition in this way, then

00:02:45.350 --> 00:02:52.410
this thing, when you replace it
with Ax plus Bx, you get to

00:02:52.410 --> 00:02:56.220
that this thing over here is
equal to the corresponding

00:02:56.220 --> 00:03:01.655
matrices by this definition,
a plus b times x.

00:03:04.200 --> 00:03:07.480
This was the motivation to get
to a nice expression, like

00:03:07.480 --> 00:03:11.020
this, for defining matrix
addition in this way.

00:03:11.020 --> 00:03:13.750
Now this all seems very
abstract, so let's actually

00:03:13.750 --> 00:03:17.680
add a matrix, or let's
add two matrices.

00:03:17.680 --> 00:03:20.760
So we'll start off with
a two-by-two case.

00:03:20.760 --> 00:03:26.450
So let's say I'm adding the
matrix 1, 3, minus 2, 4 to the

00:03:26.450 --> 00:03:29.290
matrix, remember they have to
have the same dimensions, to

00:03:29.290 --> 00:03:35.020
the matrix 2, 7, minus
3, minus 1.

00:03:35.020 --> 00:03:36.350
What do we get?

00:03:36.350 --> 00:03:38.440
Well by definition, you
just add up their

00:03:38.440 --> 00:03:39.640
corresponding columns.

00:03:39.640 --> 00:03:40.760
You add up the first column.

00:03:40.760 --> 00:03:42.480
When you add up the
corresponding columns, what

00:03:42.480 --> 00:03:45.320
happens when you add up two
columns, two vectors?

00:03:45.320 --> 00:03:47.830
Well, you just add up their
corresponding entries.

00:03:47.830 --> 00:03:49.800
So essentially, when you add
up to matrices, you're just

00:03:49.800 --> 00:03:51.650
adding up all of the
corresponding entries.

00:03:51.650 --> 00:03:53.970
I'll talk about it in this way,
just because that's how I

00:03:53.970 --> 00:03:56.620
defined it, but they're
all equivalent.

00:03:56.620 --> 00:03:59.370
The first thing, the first
column, in this matrix right

00:03:59.370 --> 00:04:02.050
here, is going to be this
column plus this column.

00:04:02.050 --> 00:04:06.440
So it's going to be 1 plus 2,
let me write it like this, and

00:04:06.440 --> 00:04:10.320
then minus 2, minus 3.

00:04:10.320 --> 00:04:15.380
And then the second column, that
one right there, is going

00:04:15.380 --> 00:04:22.160
to be 3 plus 7 and
then 4 minus 1.

00:04:22.160 --> 00:04:30.720
And so this will be equal
to 3, 10, minus 5, and

00:04:30.720 --> 00:04:32.760
3, just like that.

00:04:32.760 --> 00:04:34.940
And notice, even though the
definition is I'm adding up

00:04:34.940 --> 00:04:35.860
corresponding columns.

00:04:35.860 --> 00:04:37.660
Well, what in effect happened?

00:04:37.660 --> 00:04:40.370
Well, I'm just adding up the
corresponding entries.

00:04:40.370 --> 00:04:44.090
I added the 1 to the 2, the 3
to the 7, the minus 2 to the

00:04:44.090 --> 00:04:46.300
minus 3, the 4 to the minus 1.

00:04:46.300 --> 00:04:47.960
It's that straightforward.

00:04:47.960 --> 00:04:49.600
Nothing fancier than that.

00:04:49.600 --> 00:04:52.355
In fact, we could have rewritten
this definition.

00:04:55.140 --> 00:05:00.510
If we say that the vector or the
matrix a is equal to a11

00:05:00.510 --> 00:05:03.810
a12, all the way to a1n.

00:05:03.810 --> 00:05:09.120
And then if you go down this
is a21 all the way to a1n.

00:05:09.120 --> 00:05:12.910
And then you go all the
way down there to ann.

00:05:12.910 --> 00:05:13.980
We've seen that before.

00:05:13.980 --> 00:05:18.360
And then the matrix b, just
by the same argument or by

00:05:18.360 --> 00:05:21.910
similar definition, this is b11,
that entry is b11, that's

00:05:21.910 --> 00:05:25.040
b12, all the way to b1n.

00:05:25.040 --> 00:05:30.040
This is b21, second row, all the
way down to bn, sorry this

00:05:30.040 --> 00:05:34.540
is m, we have m rows,
so this is mn.

00:05:34.540 --> 00:05:41.440
So this right here is bm1, this
would be bm2, all the way

00:05:41.440 --> 00:05:46.530
down to this is bmn,
right there.

00:05:46.530 --> 00:05:50.420
Want to be very careful, these
are m by n matrices.

00:05:50.420 --> 00:05:55.150
So this row down here is the
mth row in both cases.

00:05:55.150 --> 00:05:58.390
But we could redefine our
matrix, or another way of

00:05:58.390 --> 00:06:02.060
stating this matrix addition
definition, is to say, if I'm

00:06:02.060 --> 00:06:07.270
going to add a plus b, I'm
just going to add up the

00:06:07.270 --> 00:06:08.400
corresponding entries.

00:06:08.400 --> 00:06:11.010
So this entry up here is going
to be-- do it in a different

00:06:11.010 --> 00:06:15.740
color --it's going to be a11
plus b11 this one's going to

00:06:15.740 --> 00:06:24.610
be a21 plus b21 all the way
down to am1 plus bm1.

00:06:24.610 --> 00:06:29.820
And then this is going to be,
of course, a12 plus b12 all

00:06:29.820 --> 00:06:34.620
the way to a1n-- let me scroll
over a little bit --all the

00:06:34.620 --> 00:06:38.990
way over to a1n plus b1n,
and then all the way

00:06:38.990 --> 00:06:43.510
down to amn plus bmn.

00:06:43.510 --> 00:06:44.940
These are equivalent
definitions.

00:06:44.940 --> 00:06:48.430
This takes a lot less space
to write in and I felt

00:06:48.430 --> 00:06:49.750
comfortable doing it because
we've already

00:06:49.750 --> 00:06:52.210
defined vector addition.

00:06:52.210 --> 00:06:54.730
But it essentially boils down
to you just add up all the

00:06:54.730 --> 00:06:55.990
corresponding entries.

00:06:55.990 --> 00:06:57.820
That's all matrix addition is.

00:06:57.820 --> 00:06:59.960
It's probably one of the
simplest things that you've

00:06:59.960 --> 00:07:03.650
seen in your recent mathematical
experience.

00:07:03.650 --> 00:07:05.860
Now, matrix scalar
multiplication,

00:07:05.860 --> 00:07:07.500
very similar idea.

00:07:07.500 --> 00:07:12.590
We defined scalar multiplication
times a

00:07:12.590 --> 00:07:19.090
transformation of x to be equal
to a scalar times the

00:07:19.090 --> 00:07:20.430
transformation of x.

00:07:20.430 --> 00:07:21.680
This was a definition.

00:07:24.040 --> 00:07:31.380
And we also defined scalar
times some matrix a to be

00:07:31.380 --> 00:07:33.300
equal to the scalar.

00:07:33.300 --> 00:07:37.450
A new matrix where each of its
columns are the scalar times

00:07:37.450 --> 00:07:38.820
the column vectors of a.

00:07:38.820 --> 00:07:44.320
So a1, and then the next column
is ca2, and then you go

00:07:44.320 --> 00:07:48.730
all the way to can.

00:07:48.730 --> 00:07:52.820
And the whole motivation for
this was, because this could

00:07:52.820 --> 00:08:00.025
be simplified to-- well t I've
said was equal to Bx, a times

00:08:00.025 --> 00:08:02.590
the transformation of x
--the transformation t

00:08:02.590 --> 00:08:05.350
of x was equal to.

00:08:05.350 --> 00:08:06.820
So we still have our c.

00:08:06.820 --> 00:08:10.040
So it's going to be c
times the matrix B,

00:08:10.040 --> 00:08:12.070
times the vector x.

00:08:12.070 --> 00:08:15.240
That's what the transformation
of x could be written as.

00:08:15.240 --> 00:08:24.690
And so this would be equal to by
just manipulating-- and we

00:08:24.690 --> 00:08:26.760
did this in the last video by
actually breaking this up in

00:08:26.760 --> 00:08:29.360
the column vectors multiplying
them by each of the components

00:08:29.360 --> 00:08:32.309
of x, and then distributing the
c and rearranging them a

00:08:32.309 --> 00:08:33.140
little bit.

00:08:33.140 --> 00:08:35.720
We can now say, using this
definition, that this is equal

00:08:35.720 --> 00:08:39.049
to some new matrix cB.

00:08:39.049 --> 00:08:43.150
We're using this definition,
some new matrix cB, where it's

00:08:43.150 --> 00:08:45.320
essentially c times
each of the column

00:08:45.320 --> 00:08:47.930
vectors of B times x.

00:08:47.930 --> 00:08:49.730
This right here was
our motivation.

00:08:49.730 --> 00:08:53.710
We wanted to be able express
this as a product of some new

00:08:53.710 --> 00:08:56.850
matrix and a vector, because
any linear transformation

00:08:56.850 --> 00:08:59.360
should be expressible
in that way.

00:08:59.360 --> 00:09:01.580
And that's why we made
this definition.

00:09:01.580 --> 00:09:02.600
Now let's apply it.

00:09:02.600 --> 00:09:06.070
And I wanted to show you that
this is perhaps even simpler

00:09:06.070 --> 00:09:07.500
than matrix addition.

00:09:07.500 --> 00:09:12.330
So if we want to multiply the
scalar 5 times the matrix,

00:09:12.330 --> 00:09:14.410
I'll do a 3 by 2 matrix.

00:09:14.410 --> 00:09:20.410
So 1, minus 1, 2, 3, 7, 0.

00:09:20.410 --> 00:09:24.440
This will just be equal to--
by this definition I'm just

00:09:24.440 --> 00:09:26.430
saying, I'm multiplying the
scalar times each of the

00:09:26.430 --> 00:09:27.110
column vectors.

00:09:27.110 --> 00:09:28.640
So it's 5 times 1, 2, 7.

00:09:28.640 --> 00:09:29.570
But what's that?

00:09:29.570 --> 00:09:31.340
That's just 5 times each
of the entries.

00:09:31.340 --> 00:09:33.950
It's 5 times 1, which is 5.

00:09:33.950 --> 00:09:36.170
5 times 2, which is 10.

00:09:36.170 --> 00:09:39.480
5 times 7, which is 35.

00:09:39.480 --> 00:09:42.110
Then the next column is going
to be 5 times this column

00:09:42.110 --> 00:09:44.580
right here, which is just 5
times each of its entries.

00:09:44.580 --> 00:09:47.490
So 5 times minus 1 is minus 5.

00:09:47.490 --> 00:09:50.110
5 times 3 is 15.

00:09:50.110 --> 00:09:52.340
5 times 0 is 0.

00:09:52.340 --> 00:09:53.150
It's that simple.

00:09:53.150 --> 00:09:57.770
You literally, if we go back
to this definition, we can

00:09:57.770 --> 00:10:00.990
define scalar multiplication
of a matrix.

00:10:00.990 --> 00:10:04.680
So we could also define cA as
being equal to, if we'd say

00:10:04.680 --> 00:10:08.200
this is a representation for A,
of the scalar c times each

00:10:08.200 --> 00:10:09.180
of the entries of A.

00:10:09.180 --> 00:10:09.780
That's it.

00:10:09.780 --> 00:10:14.380
So it's c times a11,
c times a12 all the

00:10:14.380 --> 00:10:17.450
way to c times a1n.

00:10:17.450 --> 00:10:22.070
You go down this way, c times
a21 all the way down to c

00:10:22.070 --> 00:10:26.410
times am1 and then if you
go down the diagonal,

00:10:26.410 --> 00:10:28.540
it's be c times amn.

00:10:28.540 --> 00:10:32.080
You literally just take your
scalar and multiply it times

00:10:32.080 --> 00:10:33.230
every entry in A.

00:10:33.230 --> 00:10:34.720
And that's all you have to do.

00:10:34.720 --> 00:10:37.240
So hopefully this clarified
things up a little bit, or

00:10:37.240 --> 00:10:39.060
maybe it was a bit of a review
from things you might have

00:10:39.060 --> 00:10:40.310
learned in highschool.


Sums and scalar multiples of linear transformations

WEBVTT
Kind: captions
Language: en

00:00:00.380 --> 00:00:02.340
Let's say I have two
transformations.

00:00:02.340 --> 00:00:06.350
I have the transformation S,
which is a function or a

00:00:06.350 --> 00:00:13.100
transformation from Rn to
Rm, and I also have the

00:00:13.100 --> 00:00:16.000
transformation T,
which is also a

00:00:16.000 --> 00:00:21.210
transformation from Rn to Rm.

00:00:21.210 --> 00:00:25.120
I'm going to define right now
what it means to add the two

00:00:25.120 --> 00:00:26.010
transformations.

00:00:26.010 --> 00:00:27.330
So this is a definition.

00:00:27.330 --> 00:00:29.930
Let me write it as
a definition.

00:00:29.930 --> 00:00:33.320
I'm going to define the
addition of our two

00:00:33.320 --> 00:00:34.260
transformations.

00:00:34.260 --> 00:00:37.470
So if I add our two
transformations, the addition

00:00:37.470 --> 00:00:41.430
of two transformations operating
on some vector x,

00:00:41.430 --> 00:00:42.340
this is a definition.

00:00:42.340 --> 00:00:46.400
I'm going to say this is the
same thing as the first

00:00:46.400 --> 00:00:50.880
transformation operating on the
vector x plus the second

00:00:50.880 --> 00:00:54.880
transformation operating
on the vector x.

00:00:54.880 --> 00:00:57.190
And obviously, this is going
to end up being a vector in

00:00:57.190 --> 00:01:02.810
Rm, so this whole thing is going
to be a vector in Rm.

00:01:05.680 --> 00:01:12.300
By definition, this S plus T
transformation is still a

00:01:12.300 --> 00:01:15.910
transformation because it
takes an input from Rn.

00:01:15.910 --> 00:01:22.380
It's still a transformation
from Rn to Rm.

00:01:22.380 --> 00:01:24.760
Now let me make another
definition.

00:01:24.760 --> 00:01:27.730
Let me define -- I'll
do it in green.

00:01:27.730 --> 00:01:29.430
Maybe I'll do it in purple.

00:01:29.430 --> 00:01:33.270
I'm going to define a scalar
multiple of a transformation.

00:01:33.270 --> 00:01:37.010
So I'm going to define, let's
say c, where c is just any

00:01:37.010 --> 00:01:38.010
real number.

00:01:38.010 --> 00:01:44.870
c times the transformation S of
some vector x, I'm going to

00:01:44.870 --> 00:01:50.050
say that this is equal to c
times the transformation of x.

00:01:55.080 --> 00:01:59.290
And so similarly, the
transformation of x obviously

00:01:59.290 --> 00:02:01.050
is going to be in Rm.

00:02:01.050 --> 00:02:04.240
So if you multiply any vector
in Rm times some scalar,

00:02:04.240 --> 00:02:06.550
you're still going to have
another vector in Rm.

00:02:06.550 --> 00:02:10.850
So luckily for us, this
definition of a scalar

00:02:10.850 --> 00:02:15.010
multiple-- so if I have this
new transformation called c

00:02:15.010 --> 00:02:23.590
times S, this is still a
mapping from Rn to Rm.

00:02:23.590 --> 00:02:25.690
This is still a vector
in Rm and this is

00:02:25.690 --> 00:02:27.220
still a vector in Rn.

00:02:27.220 --> 00:02:29.050
Fair enough.

00:02:29.050 --> 00:02:32.700
Now, let's see what happens if
we look at their corresponding

00:02:32.700 --> 00:02:34.910
matrices for these
transformation.

00:02:34.910 --> 00:02:38.400
We've seen in a previous video
that any linear transformation

00:02:38.400 --> 00:02:41.900
can be represented as a
matrix vector product.

00:02:41.900 --> 00:02:47.310
So let's say that S of a vector
x is equivalent to the

00:02:47.310 --> 00:02:50.870
matrix A times that vector x.

00:02:50.870 --> 00:02:58.460
And let's say that T of x is
equal to the matrix B times

00:02:58.460 --> 00:03:00.320
the vector x.

00:03:00.320 --> 00:03:03.560
And, of course, since both of
these guys are mappings from

00:03:03.560 --> 00:03:06.100
Rn to Rm, both of these
matrices are

00:03:06.100 --> 00:03:08.470
going to be m by n.

00:03:08.470 --> 00:03:12.810
Both of these are
m by n matrices.

00:03:12.810 --> 00:03:15.150
Now, let's just go back to these
definitions that I just

00:03:15.150 --> 00:03:15.980
constructed.

00:03:15.980 --> 00:03:19.505
What is S of T of x?

00:03:19.505 --> 00:03:22.230
That can then be written as--
so let me write it this way.

00:03:22.230 --> 00:03:24.390
I'll do it in that same color.

00:03:24.390 --> 00:03:26.980
So you have S-- I was going
to do it in red.

00:03:31.460 --> 00:03:32.950
Maybe I'll do it right here.

00:03:32.950 --> 00:03:37.720
You have S plus T-- that's
a capital T.

00:03:37.720 --> 00:03:42.060
S plus T of x-- I'm just
re-writing this up here -- is

00:03:42.060 --> 00:03:49.020
equal to S of x plus T of x, or
the transformation T of x,

00:03:49.020 --> 00:03:51.070
which we now know is equal
to these two things.

00:03:51.070 --> 00:03:56.950
So this is equal to this
term right there.

00:03:56.950 --> 00:04:02.350
The transformation S of
x is equal to Ax.

00:04:02.350 --> 00:04:04.160
That's that one right there.

00:04:04.160 --> 00:04:09.930
And then the transformation
T of x is equal to B, the

00:04:09.930 --> 00:04:12.710
matrix B times x.

00:04:12.710 --> 00:04:15.170
Now, what are these things?

00:04:15.170 --> 00:04:19.130
Let me write our two matrices in
a form that you're probably

00:04:19.130 --> 00:04:20.060
familiar with right now.

00:04:20.060 --> 00:04:24.340
Let's say the matrix A is just a
bunch of column vectors: a1,

00:04:24.340 --> 00:04:27.750
a2, all the way to an.

00:04:27.750 --> 00:04:30.110
And similarly, the matrix
B is just a

00:04:30.110 --> 00:04:31.830
bunch of column vectors.

00:04:31.830 --> 00:04:39.260
The matrix B is b1, b2,
all the way to bn.

00:04:39.260 --> 00:04:42.490
These are each column vectors
with m components, one for

00:04:42.490 --> 00:04:45.050
each of the rows, and there's n
of these because there are n

00:04:45.050 --> 00:04:47.170
columns in each of
these vectors.

00:04:47.170 --> 00:04:50.540
So when you multiply this
guy times-- let me

00:04:50.540 --> 00:04:51.410
make it very clear.

00:04:51.410 --> 00:04:55.590
If I multiply an x, the vector
x is going to look like this.

00:04:55.590 --> 00:04:58.960
The vector x is going
to be x1, x2, all

00:04:58.960 --> 00:05:01.230
the way down to xn.

00:05:01.230 --> 00:05:03.600
And we've shown this multiple,
multiple times.

00:05:03.600 --> 00:05:05.580
It's a very handy way
of thinking about

00:05:05.580 --> 00:05:07.790
matrix vector products.

00:05:07.790 --> 00:05:11.500
But we know that this product
right here can be written be

00:05:11.500 --> 00:05:16.450
as each of these scalar terms
in x times its corresponding

00:05:16.450 --> 00:05:17.530
column vector in A.

00:05:17.530 --> 00:05:19.420
I've done this, and it's
probably the fifth video that

00:05:19.420 --> 00:05:19.960
I'm doing this.

00:05:19.960 --> 00:05:32.070
So this can be written as x1, x1
times a1 plus x2 times a2,

00:05:32.070 --> 00:05:36.880
all the way to xn times
an is equal to this.

00:05:36.880 --> 00:05:40.090
That's what ax can be rewritten
as, as kind of a

00:05:40.090 --> 00:05:42.440
weighted combination of these
column vectors where the

00:05:42.440 --> 00:05:46.380
weights are each of the values
of our vector x.

00:05:46.380 --> 00:05:49.140
And I have to add
this guy to bx.

00:05:49.140 --> 00:05:52.520
So bx, by the same argument, so
plus is just going to be--

00:05:52.520 --> 00:05:54.590
let me do it in the blue.

00:05:54.590 --> 00:06:03.130
It's going to be x1 times b1
plus x2 times b2, all the way

00:06:03.130 --> 00:06:08.650
to xn times bn.

00:06:08.650 --> 00:06:10.460
Now, what is this equal to?

00:06:10.460 --> 00:06:13.920
Well, we know that scalar
multiplication times vector

00:06:13.920 --> 00:06:17.270
exhibits the distributive
property, so we can just add

00:06:17.270 --> 00:06:20.760
these two guys right here
and factor out the x1.

00:06:20.760 --> 00:06:21.590
And what do we get?

00:06:21.590 --> 00:06:25.050
We get this is equal to-- this
whole expression right here,

00:06:25.050 --> 00:06:27.420
let me draw a line here, because
I'm not saying this

00:06:27.420 --> 00:06:28.470
matrix is equal to that.

00:06:28.470 --> 00:06:31.760
I'm saying that this is equal to
this, is equal to this term

00:06:31.760 --> 00:06:43.380
plus this term, which is equal
to x1 times a1 plus b1, plus

00:06:43.380 --> 00:06:49.070
x2 times a2-- I'm just adding
these two terms up-- x2 times

00:06:49.070 --> 00:07:01.650
a2 plus b2, all the way to
plus xn times an plus bn.

00:07:01.650 --> 00:07:03.870
So what is this thing
equal to?

00:07:03.870 --> 00:07:09.480
Well, this is equal to some new
matrix, and let's define

00:07:09.480 --> 00:07:11.420
this new matrix.

00:07:11.420 --> 00:07:14.010
This is equal to some new
matrix-- I'll make it pretty

00:07:14.010 --> 00:07:20.820
big right here-- times
our vector x .

00:07:20.820 --> 00:07:23.950
I'll do the vector x in green.

00:07:23.950 --> 00:07:29.380
Vector x we know is x1, x2,
all the way down to xn.

00:07:29.380 --> 00:07:32.060
But what is the new matrix
going to be?

00:07:32.060 --> 00:07:35.440
Well, this product is going to
be each of these scalar terms

00:07:35.440 --> 00:07:39.073
times the column vectors
of this matrix.

00:07:39.073 --> 00:07:42.210
So these guys right here are
the columns of my matrix.

00:07:42.210 --> 00:07:45.020
This thing is equivalent to a
matrix where the first column

00:07:45.020 --> 00:07:49.470
right here is a1 plus b1.

00:07:49.470 --> 00:07:51.050
We're essentially adding
the column vectors

00:07:51.050 --> 00:07:52.190
of those two guys.

00:07:52.190 --> 00:07:54.910
The second column right here--
let me draw a little line

00:07:54.910 --> 00:07:56.430
right there to show you that
these are different

00:07:56.430 --> 00:07:56.880
expressions.

00:07:56.880 --> 00:08:01.480
The second one would be a2 plus
b2, and then we'll just

00:08:01.480 --> 00:08:03.240
have a bunch of them, and
then the last one will

00:08:03.240 --> 00:08:07.120
just be an plus bn.

00:08:07.120 --> 00:08:11.200
So what happens is that, by
definition, when I added these

00:08:11.200 --> 00:08:13.860
two transformations,
I just used their

00:08:13.860 --> 00:08:14.850
corresponding matrices.

00:08:14.850 --> 00:08:16.050
And I said you know what?

00:08:16.050 --> 00:08:18.710
The addition of these two
transformations created a new

00:08:18.710 --> 00:08:24.410
transformation that is
essentially some matrix times

00:08:24.410 --> 00:08:30.300
my vector, and that matrix ended
up being the sum of the

00:08:30.300 --> 00:08:34.010
corresponding column vectors
of our two original

00:08:34.010 --> 00:08:35.590
transformation matrices,
right?

00:08:35.590 --> 00:08:39.700
This new matrix that I got, and
I haven't defined matrix

00:08:39.700 --> 00:08:42.120
addition yet, but we got
here just by thinking

00:08:42.120 --> 00:08:43.789
about vector addition.

00:08:43.789 --> 00:08:46.930
This matrix is constructed by
adding the corresponding

00:08:46.930 --> 00:08:52.010
vectors of the matrices
A and B.

00:08:52.010 --> 00:08:54.300
Now, why did I go through
all of this trouble?

00:08:54.300 --> 00:08:56.470
Well, I can make a new
definition here that'll make

00:08:56.470 --> 00:08:58.230
everything fit together well.

00:09:02.820 --> 00:09:09.350
I'm going to define this matrix
right here as A plus B.

00:09:09.350 --> 00:09:12.410
So my new matrix definition,
if I have two matrices that

00:09:12.410 --> 00:09:15.020
have the same dimensions, and
they have to have the same

00:09:15.020 --> 00:09:21.350
dimensions, I'm defining A plus
B to be equal to some new

00:09:21.350 --> 00:09:23.870
matrix where you add up their
corresponding columns.

00:09:23.870 --> 00:09:27.870
So a1 plus b1, just like what
I did here, I don't have to

00:09:27.870 --> 00:09:33.000
rewrite it, all the way up to an
plus bn is the last column.

00:09:33.000 --> 00:09:35.360
And you've seen this before in
your algebra II class, but I

00:09:35.360 --> 00:09:37.620
wanted here to do it, because
this shows you the

00:09:37.620 --> 00:09:38.570
motivation for it.

00:09:38.570 --> 00:09:41.340
Because now we can say
that the sum of two

00:09:41.340 --> 00:09:50.530
transformations, So S plus T of
x, which is equal to S of

00:09:50.530 --> 00:09:56.080
x-- this is a vector-- S of x
plus T of x, which we know is

00:09:56.080 --> 00:10:04.530
equal to A times x plus B times
x, we can now say is

00:10:04.530 --> 00:10:08.770
equal to, because it's equal to
some new matrix, which we

00:10:08.770 --> 00:10:13.090
can now call A plus
B times x, right?

00:10:13.090 --> 00:10:15.990
I just showed this part is from
the definition of our

00:10:15.990 --> 00:10:18.680
transformations into some of
our transformation that I

00:10:18.680 --> 00:10:20.140
defined earlier in this video.

00:10:20.140 --> 00:10:24.110
And then when we just worked
this out and kind of expressed

00:10:24.110 --> 00:10:28.230
these products as products of or
as weighted combinations of

00:10:28.230 --> 00:10:29.680
the column vectors
of these guys, we

00:10:29.680 --> 00:10:31.020
got to this new matrix.

00:10:31.020 --> 00:10:34.630
And I defined this new
matrix as A plus B.

00:10:34.630 --> 00:10:37.430
And I did that because it has
this neat property now because

00:10:37.430 --> 00:10:41.270
now the sum of two linear
transformations operating on x

00:10:41.270 --> 00:10:44.350
is equivalent to, when you think
of it is a matrix vector

00:10:44.350 --> 00:10:48.250
product, as the sum of
their two matrices.

00:10:48.250 --> 00:10:52.180
Now, let's do the same thing
with scalar multiplication.

00:10:52.180 --> 00:11:02.170
We know that c times our
transformation of x by

00:11:02.170 --> 00:11:06.410
definition I'm saying is c times
the transformation of x.

00:11:06.410 --> 00:11:09.700
So c times whatever vector
this is in Rm.

00:11:09.700 --> 00:11:15.210
And so we know that S of x can
be rewritten as Ax, so this is

00:11:15.210 --> 00:11:18.290
c times A times x.

00:11:18.290 --> 00:11:21.050
And we know that Ax can be
rewritten as this is equal to

00:11:21.050 --> 00:11:28.230
c times x1 times the first
column vector in a, so a1 plus

00:11:28.230 --> 00:11:35.650
x2 times a2,xn all the way
to plus xn times an.

00:11:35.650 --> 00:11:36.300
Now, what is this?

00:11:36.300 --> 00:11:38.990
This is just scalar
multiplication.

00:11:38.990 --> 00:11:41.070
We can just distribute this c.

00:11:41.070 --> 00:11:42.670
and then what do we get?

00:11:42.670 --> 00:11:46.630
We get x, and multiplication
is associative.

00:11:46.630 --> 00:11:49.950
c is a scalar, x1 is a scalar,
so we can switch them around

00:11:49.950 --> 00:11:50.390
if we want.

00:11:50.390 --> 00:11:51.920
We know that scalar
multiplication is

00:11:51.920 --> 00:11:59.180
distributive, so we can write
this as x1 times ca1 plus x2

00:11:59.180 --> 00:12:04.150
times ca2, all the way
to xn times can.

00:12:07.710 --> 00:12:09.680
Now, what is this equal to?

00:12:09.680 --> 00:12:13.950
This is equal to some
new matrix times x.

00:12:13.950 --> 00:12:17.450
This is equal to some new
matrix-- let me make that

00:12:17.450 --> 00:12:23.586
here-- times x1, x2,
all the way to xn.

00:12:23.586 --> 00:12:25.060
And what is that new matrix?

00:12:25.060 --> 00:12:26.470
What are the columns
of the new matrix?

00:12:26.470 --> 00:12:29.360
Well, the columns are
now that, that,

00:12:29.360 --> 00:12:30.340
all the way to that.

00:12:30.340 --> 00:12:38.090
So the columns of this new
matrix are ca1, ca2, all the

00:12:38.090 --> 00:12:41.130
way to can.

00:12:41.130 --> 00:12:43.700
Now, why would I go through
this exercise?

00:12:43.700 --> 00:12:47.670
Well, wouldn't it be nice,
I already said that by

00:12:47.670 --> 00:12:55.900
definition a scalar multiple of
a transformation is equal

00:12:55.900 --> 00:12:59.830
to the scalar times a
transformation of any vector

00:12:59.830 --> 00:13:01.480
that you input into it.

00:13:01.480 --> 00:13:05.060
And, of course, that is
equal to c times Ax.

00:13:05.060 --> 00:13:09.330
Now, wouldn't it be nice if I
could define this thing as

00:13:09.330 --> 00:13:15.190
some new matrix times
a vector x, right?

00:13:15.190 --> 00:13:18.670
Because this should also be
a linear transformation.

00:13:18.670 --> 00:13:21.490
And this new matrix I'm
going to define.

00:13:21.490 --> 00:13:23.710
This is a definition again.

00:13:23.710 --> 00:13:30.780
I'm going to define this new
matrix as being c times A.

00:13:30.780 --> 00:13:34.340
So now we have this definition
that c times A, if I take any

00:13:34.340 --> 00:13:39.590
scalar times any matrix A, it's
just equal to c times

00:13:39.590 --> 00:13:41.280
each of the column vectors.

00:13:41.280 --> 00:13:43.462
And we know what happens when
you take a scalar times each

00:13:43.462 --> 00:13:44.420
of the-- just let
me write this.

00:13:44.420 --> 00:13:49.810
This is equal to c times a1, c
times a2-- I'm just rewriting

00:13:49.810 --> 00:13:52.920
what I just wrote there-- all
the way to c times an.

00:13:52.920 --> 00:13:54.340
But what is this in effect?

00:13:54.340 --> 00:13:56.780
We know that when you multiply c
times a vector, you multiply

00:13:56.780 --> 00:13:59.490
the scalar times each of
the vector's elements.

00:13:59.490 --> 00:14:03.220
So this is the equivalent of
multiplying c times every

00:14:03.220 --> 00:14:06.720
entry up in this matrix
right here.

00:14:06.720 --> 00:14:08.650
And with this video, you know,
you're probably saying, hey,

00:14:08.650 --> 00:14:12.510
Sal, I already knew how to-- in
algebra II in tenth grade

00:14:12.510 --> 00:14:15.870
or ninth grade, I already was
exposed to multiplying a

00:14:15.870 --> 00:14:19.240
scalar times a matrix or adding
two matrices with the

00:14:19.240 --> 00:14:19.940
same dimensions.

00:14:19.940 --> 00:14:22.910
Why did you go through all of
this trouble of the defining

00:14:22.910 --> 00:14:25.530
the sum of transformations
and the sum of matrices?

00:14:25.530 --> 00:14:28.000
And I went through the trouble
because I wanted you to

00:14:28.000 --> 00:14:31.670
understand that there's
nothing-- I mean, it is

00:14:31.670 --> 00:14:34.390
natural, but there's nothing
about the universe that said

00:14:34.390 --> 00:14:36.970
matrices had to be
defined this way.

00:14:36.970 --> 00:14:39.990
Matrix addition, or matrix
scalar multiplication, or the

00:14:39.990 --> 00:14:41.460
addition of two transformations.

00:14:41.460 --> 00:14:47.560
I wanted you to see the
mathematical world has

00:14:47.560 --> 00:14:50.300
constructed it in this way
because it seems to have nice

00:14:50.300 --> 00:14:52.040
properties that are useful.

00:14:52.040 --> 00:14:53.270
And that's what I've
done in this video.

00:14:53.270 --> 00:14:55.180
In the next video, I'll
do a couple of scalar

00:14:55.180 --> 00:14:57.780
multiplications and matrix
additions just to make sure

00:14:57.780 --> 00:15:02.350
that you remember what you had
learned in your ninth or tenth

00:15:02.350 --> 00:15:04.810
grade algebra class, but you'll
find that the actual

00:15:04.810 --> 00:15:07.770
operations are almost
trivially simple.