LESSON

# Rotations are non commutative in 3D

#### Share

#### Transcript

Now we're going to talk about one of the more perplexing elements of rotations in 3D. I've got three coordinate frames here and they're all initially parallel to each other. The x-axes, the y-axes and the z-axes are all aligned. I'm going to pick up the first one, the red one, and I'm going to rotate it by +90 degrees around its x-axis. Positive is in this direction so after rotating it by 90 degrees in x-axis, it looks like this. And now I'm going to rotate it by +90 degrees around the y-axis. So this frame is going to end up looking like this. This is its final orientation. I'm just going to put it down there. I'm going to pick up the blue frame and I'm going to do the rotation within the opposite order. First of all, I'm going to rotate it by +90 degrees around the y-axis. That's the positive direction. So it's initially going to look like this. And now I'm going to rotate it by +90 degrees around the x-axis. The x-axis is now pointing downwards, that's the positive rotation direction. So this is what the final orientation will look like. And we can see that these two frames have gotten very, very different orientations. So when it comes to doing rotations in three dimensions, the order in which you do them is critically important. Rotations are not to commutative.

Let's look at the non-commutative nature of rotation matrix multiplication. I'm going to have a rotation of 90 degrees around the x-axis. And then I'm going to rotate by 90 degrees around the y-axis. And the resulting rotation matrix looks like this. If I do this in the opposite order, I'll rotate around the y-axis first, and then I'll rotate around the x-axis, by 90 degrees in each case. I end up with a resulting rotation matrix which looks like this. And we can see that these two matrices are quite different. When you're multiplying rotation matrices, the order is critically important.

#### Code

If we apply a sequence of 3D rotations to an objects we see that the order in which they are applied affects the final result.

### Skill level

Undergraduate mathematics

This content assumes high school level mathematics and requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.