No, rotation matrices are not commutative in general.
Understanding the nature of rotation matrices is fundamental in fields like 3D graphics, physics, and engineering. Unlike simple scalar multiplication where order doesn't matter (e.g., 2 3 = 3 2), the order of applying multiple rotations significantly impacts the final orientation.
As the reference states, "Rotations are not to commutative." This means that if you perform a sequence of rotations, the final result depends on the order in which those rotations are applied. Applying rotation A followed by rotation B will typically result in a different orientation than applying rotation B followed by rotation A.
Let's consider a classic example highlighted by the reference:
- A rotation of 90 degrees around the x-axis.
- Followed by a rotation of 90 degrees around the y-axis.
If you reverse the order and first rotate 90 degrees around the y-axis and then 90 degrees around the x-axis, the final orientation will be different.
Illustrating the Difference
Imagine an object starting aligned with the coordinate axes. Let's see what happens to a point initially on the positive X-axis (e.g., the vector [1, 0, 0]) under these two sequences of 90-degree rotations:
Rotation Sequence | Step 1: Rotate 90° X-axis | Step 2: Rotate 90° Y-axis | Final Vector Result |
---|---|---|---|
Order 1: Rx then Ry | [1, 0, 0] -> [1, 0, 0] |
[1, 0, 0] -> [0, 0, -1] |
[0, 0, -1] |
Order 2: Ry then Rx | [1, 0, 0] -> [0, 0, -1] |
[0, 0, -1] -> [0, 1, 0] |
[0, 1, 0] |
Note: A 90° rotation around X transforms the Y-axis to Z and Z to -Y. A 90° rotation around Y transforms the X-axis to -Z and Z to X.
As the table shows, starting with the same vector [1, 0, 0]
, applying a 90° X rotation followed by a 90° Y rotation results in [0, 0, -1]
. However, applying a 90° Y rotation followed by a 90° X rotation results in [0, 1, 0]
. Since the outcomes are different, the operations (and the matrices representing them) are non-commutative: Ry * Rx ≠ Rx * Ry
.
When Might They Be Commutative?
While rotations are generally non-commutative, there are specific cases where they can commute:
- Rotations around the same axis: Rotating by angle A around the X-axis and then by angle B around the X-axis is the same as rotating by angle B then angle A around the X-axis (it's equivalent to a single rotation of A+B).
- Rotation by 0 or 360 degrees: A null rotation commutes with any other rotation.
However, these are exceptions. For arbitrary rotations around different axes, the order matters.
Understanding this property is crucial for correctly composing transformations in 3D space, whether you're animating objects, calculating robot arm movements, or simulating physics.