# Rotation in R3 around theÂ x-axis

## Video transcript

In the last video we defined a
transformation that rotated any vector in R2 and just gave
us another rotated version of that vector in R2. In this video, I'm essentially
going to extend this, so I'm going to do it in R3. So I'm going to define a
rotation transformation. I'll still call it theta. There's going to be a mapping
this time from R3 to R3. As you can imagine, the idea
of a rotation in an angle becomes a little bit more
complicated when we're dealing in three dimensions. So in this case we're going to
rotate around the x-axis, let me call it-- so this is going
to rotate around the x-axis. And what we do in this video,
you can then just generalize that to other axes. And if you want to rotate around
the x-axis, and then the y-axis, and then the z-axis
by different angles, you can just apply the transformations one after another. And we're going to cover that
in a lot more detail in a future video. But this should kind of give you
the tools to show you that this idea that we learned in the
previous video is actually generalizeable to multiple
dimensions, and especially three dimensions. So let me just be clear, what
we're going to be doing here. Let me draw some axes. That's my x-axis. That is my y-axis. And this is my z-axis. Of course, this is R3. But any vector here in R3
I will be rotating it counterclockwise around
the x-axis. We'll be rotating like that. So if I had a vector-- I'm
just drawing it in the zy plane because it's a little bit
easier to visualize-- but if I have a vector sitting here
in the zy plane, it will still stay in the zy plane. But it'll be rotated
counterclockwise by an angle of theta, just like that. Now, a little harder to
visualize is a vector that doesn't just sit in
the zy plane. If we have some vector that
has some x-component that comes out like that, then some
y-component and some z-component, it looks
like that. Then when you rotate it, its
z and its y-components will change, but its x-component
will stay the same. So then it might look
something like this. Let me see if I can
give it justice. So then the vector when I rotate
it around might look something like that. Anyway, I don't know if I'm
giving it proper justice but this was rotated around
the x-axis. I think you understand
what that means. But just based on the last
video, we want to build a transformation. Let me call this rotation
3 theta. Or let me call it 3 rotation
theta now that we're dealing in R3. And what we want to do is we
want to find some matrix, so I can write my 3 rotation sub
theta transformation of x as being some matrix A times
the vector x. Since this is a transformation
from R3 to R3 this is of course going to be
a 3 by 3 matrix. Now in the last video we learned
that to figure this out, you just have to apply the
transformation essentially to the identity matrix. So what we do is we start off
with the identity matrix in R3, which is just going
to be a 3 by 3. It's going to have 1, 1,
1, 0, 0, 0, 0, 0, 0. Each of these columns are the
basis vectors for R3. That's e1, e2, e3-- I'm writing
it probably too small for you to see-- but each
of these are the basis vectors for R3. And what we need to do is just
apply the transformation to each of these basis
vectors in R3. So our matrix A will
look like this. Our matrix A is going to
be a 3 by 3 matrix. Where the first column
is going to be our transformation, 3 rotation sub
theta, applied to that column vector right there, 1, 0, 0. And then I'm going to apply it
to this middle column vector right here. You get the idea, I don't
want to write that whole thing again. I'm going to apply 3 rotation
sub theta to 0, 1, 0. And then I'm going to apply
it-- I'll do it here-- 3 rotation sub theta. I'm going to apply it
to this last column vector, so 0, 0, 1. We've seen this multiple
times. So let's apply it. Let's rotate each of these
basis vectors for R3. Let's rotate them around
the x-axis. So the first guy, if I were
to draw an R3, what would he look like? He only has directionality
in the x direction right? If we call this the x-dimension,
if the first entry corresponds to our
x-dimension, the second entry corresponds to our
y-dimension. And the third entry
corresponds to our z-dimension. This vector would just be a unit
vector that just comes out like that, right? So if I'm going to rotate this
vector around the x-axis, what's going to happen to it? Well, nothing. It is the x-axis. So when you rotate it, it's not
changing its direction or its magnitude or anything. So this vector right here
is just going to be the vector 1, 0, 0. Nothing happens when
you rotate it. Now these are a little
bit more interesting. To do these, let me just
draw my zy-axis. Let me just draw my Z. So that's my z-axis and this
is my y-axis right here. Now this basis vector just goes
in the y direction by 1. So this basis vector just
looks like that. And it has a length of 1. And then when you rotate it
around the x-axis, when I draw it like this, you could imagine
the x-axis is just popping out of your
computer screens. So I could draw it like this is
like the tip of the arrow just popping out. Instead of drawing it at an
angle like this, I'm drawing it straight out of the
computer screen. So if you were to rotate this
vector right here, this blue vector right here, by
an angle of theta, it'll look like this. And we've done this in
the previous video. What are its new coordinates? First of all, will
its x-coordinate have changed it all? It's x-coordinate was 0 before,
because it doesn't break out into the
x-dimension. It just stays along
the zy plane. It was 0 before. When you rotate it, it's
still on a zy plane. So its x direction, or
its x-component, won't change at all. So the x direction is
still going to be 0. And then what's its
new y direction? Well, here we do exactly what
we did in the last video. We figure out this is going to
be its new-- I guess I don't want to draw a vector there
necessarily-- but this length right here is going to be
its new y-component. And this length right here
is going to be its new z-component. So what's its new y-component? We did this in the last video
so I won't go into as much detail, but what is
cosine of theta? The length of this vector
is 1, right? These are the standard
basis vectors. And one of the things that makes
them a nice standard basis vector is that their
lengths are 1. So we know that the cosine of
this angle is equal to the adjacent side over
the hypotenuse. The adjacent side is
this right here. And what is the hypotenuse? It's equal to 1. So this adjacent side, which we
said is going to be our new second component, our second
entry, is going to be equal to cosine of theta, right? That's A. You can just ignore the 1's. This going to be equal
to cosine of theta. And what's going to be
its new z-component? Well, sine of theta is equal
to the opposite side, this side over 1. So it just equals its
opposite side. And the length of that
opposite side is this vector's, once it's rotated,
is its new z-component. So you've got a sine
theta right there. Now we just have to do
everything in the z direction. So this z basis vector right
there, what does it look like on this graph? Let me just actually redraw it
just to make things a little bit cleaner. So that's my z-axis and
this is my y-axis. And my z-basis vector e3,
it starts off looking something like that. It just goes only in
the z direction. So first of all, let's
just rotate it by an angle of theta. So I'm going to rotate
it like that. That's an angle of theta. Its former x entry was 0. It did not break out in the
x direction at all. And of course we're still just
in the zy plane so it won't be moving out in the x direction. So it's still going
to be a 0 up here. Now what about its
new y-component? Its new y-coordinate, I guess we
can call it, is going to be this length, or it's going to be
this coordinate right here. And how can we figure
that out? Well, that length is the same
thing as that length. And if we call this the opposite
side of the angle, we know that the sine of theta is
equal to this opposite side over the length of this vector,
which is just 1. So it's just equal to
the opposite side. So the opposite side is equal
to sine of theta. But our new coordinate is to
the left of the z-axis, so this is going to be a
negative version. We did this in the last video. So it's just going to be a
negative sine of theta. This point right here,
that coordinate. So it's minus sine of theta. And then finally, what's its new
z-coordinate going to be? That's going to be this
length right here. And we know that this length,
if we call that adjacent, we know that the cosine of
our theta is equal to this divided by 1. So it's equal to that adjacent
side, so just put a cosine of theta right there. And we get our transformation
matrix. We're done. Our transformation
matrix A is this. So we can now say our new
transformation that this video is about. I call it a 3 because it's
a rotation in R3. Maybe I should call it 3 sub X
because it's a rotation around the x-axis, but I think
you get the idea. It is equal to this matrix right
up here-- maybe I could rewrite it. Let me do it this way. Let me delete all of this so
I don't have to rewrite. So my transformation that this
videos is about, 3 rotation theta of x, that transformation
is equal to this matrix times whatever
vector x I have in R3. And you might say, hey, Sal,
that looks exactly like what you did in the second. If you remember the last video
when we defined our rotation in R2, we had a transformation
matrix that looked very similar to this. And that makes sense because
we're essentially just rotating things counterclockwise in the zy plane. Now you might say, hey, Sal,
why is this even useful? You extended it to three
dimensions or to R3, I saw what you did in R2. Why is this useful? It's kind of a limited case
where you're just rotating around the x-axis. And I did it for two reasons. One to show you that you
can generalize to R3. But the other thing is, if you
think about it, a lot of the rotations that you might want
to do in R3 can be described by a rotation around the x-axis
first-- which we did in this video-- then by rotation
around the y-axis and then maybe some rotation
around the z-axis. This is just a special case
where we're dealing with rotation around the x-axis. But you could do the exact
same process to define transformation matrices for
rotations around the y-axis or the z-axis, and then you can
apply them one after another. And we'll talk a lot about that
in the future when we start applying one transformation after the other. But anyway, hopefully you found
this slightly useful. It's a slight extension
of what we did in R2.