If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Rotation in R3 around the x-axis

Construction a rotation transformation in R3. Created by Sal Khan.

Want to join the conversation?

  • leaf green style avatar for user Tabitha
    What is Sal not writing at when he says "you get the idea, I don't wanna write that whole thing again."
    The truth is, I don't get the idea, that's why I'm here trying to learn. It looks to me like he went ahead and wrote what he said he wasn't going to anyway, which is incredibly confusing for a beginner. I'm not ready for shortcuts, omissions or other surprises yet.
    (1 vote)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user ledaneps
      Tabitha, you are correct. Sal did write what he said that he did not want to write. (We all do things that we don't want to do.)
      Even so, stay with him. Sal often rambles, and he makes mistakes as well. Sometimes, he corrects them, and sometimes we in the KhanAcademy community are left to "proofread" his videos. But Sal is an excellent teacher. He constantly goes back to explain previous videos when developing the concept further.
      Watch the videos in order. In math, each new concept depends on the ones before. Measure your progress in terms of how much you understand, not by how many videos you have watched, or how many points you have accrued.
      Don't be frustrated if you feel lost. We have all been there. Review previous videos and read all the comments. Do the applicable exercise sets. Ask questions when you need clarification. The KA community will always be there for you.
      Best of luck in your continued studies.
      (24 votes)
  • purple pi purple style avatar for user Christopher Moen Monrad
    Are there any further videos building on this basis? As for example: Theta rotations around x, Phi rotations around y and Psi rotations around z, where you need to combine the 3 individual matrices into one? Not the best explaination, but maybe some of you get the point.
    (7 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Learner 1
      ψ for z, Φ for y, 𝛳 for x (Rotation angles)

      we could create a rotation matrix around the z axis as follows:
      cos ψ -sin ψ 0
      sin ψ cos ψ 0
      0 0 1

      and for a rotation about the y axis:
      cosΦ 0 sinΦ
      0 1 0
      -sinΦ 0 cosΦ

      I believe we just multiply the matrix together to get a single rotation matrix if you have 3 angles of rotation.

      (cosψ*cosΦ) (cosψ*sinΦ*sin𝛳 - sinψ*cos𝛳) (cosψ*sinΦ*cos𝛳 + sinψ*sin𝛳)
      (sinψ*cosΦ) (sinψ*sinΦ*sin𝛳 + cosψ*cos𝛳) (sinψ*sinΦ*cos𝛳 - cosψ*sin𝛳)
      (-sinΦ) (cosΦ*sin𝛳) (cosΦ*cos𝛳)

      Where ( ) denotes one of the 9 row and column combinations of the rotation matrix.
      (4 votes)
  • male robot donald style avatar for user ravin2014
    Does 90 degrees equal -270 degrees?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Sydney Feirstein
    if you have an angle of 30 degrees how do you find the coterminal angles? then find one positive and one negative angle?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user LoL.Oxhorn
    How do you find a transformation matrics that roate the #D point around the:

    x-axis by angle a
    y-axis by angle b
    z-axis by angle c

    x-axis by angle a=>y-axis by angle b=>z-axis by angle c
    (1 vote)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Khan Gressman
    How could you figure out the rotation transform matrix for n dimensions on any axis?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Kyler Kathan
      The best way to think of rotations is on a plane. Every point on that plane gets spun around a point by θ degrees/radians. In 3 dimensions, you have an infinite set of planes and the point you rotate about becomes a line (or an axis). In 4 dimensions, that line gets extruded again and becomes a plane (not just a single axis). So, in n-dimensions, you can't rotate about an axis, that's specific to 3-dimensions. So, the best way to define an n-dimensional rotation isn't with the axis you rotate about, it's with the 2D subspace you rotate on (as well as the orientation/angle of rotation). This can be defined using 2 unit vectors, one for the initial position and one for the final. By setting the initial vector equal to 1 and an orthonormal, co-planar vector equal to i, we can then use complex number rotation tricks to get a rotation matrix for any n-dimensional rotation.

      I realize I skimmed over a lot there, so let me know if you need me to expound on any points.
      (3 votes)
  • female robot ada style avatar for user bill.walter
    in this video at 1 minute you say: "you can apply rotation transformations one after another". And that: "you will cover this in a lot more detail in a future video".
    I can't find the other videos that cover this. Can you help me?
    I found videos covering composition of 2 or 3 transformations but nothing specific on rotations.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • old spice man green style avatar for user Leon Hook Hook
    Is theta always the variable for angles?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user kinghayve
    What happens if the angle is greater than 45 degrees? Then this method breaks down doesn't it?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user Emmanuel Ombwayo
    at is the x-coordinate value 0 because it doesn't change in the x-direction, or is it because the value of x is zero?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user InnocentRealist
      Because it doesn't change in the x direction.

      If the vector being transformed has a non zero x component, the value of x isn't 0, but in the transformation of j = (0, 1, 0) and k = (0, 0, 1), and therefore the column vectors i' and j' of the transformation matrix, the x component is 0.

      j and k have no x component (their x component is 0). So if the x component of j' or k' were anything other than 0, it would mean j was rotated around both the x and z axis, or k was rotated around both the x and y axis (which it's given they are not),
      (1 vote)

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.