3D Rotation Matrices — Rotations Around X, Y, Z Axes
Understand 3D rotation matrices for each axis. Learn how to compose rotations, avoid gimbal lock, and use rotation matrices in 3D graphics and robotics.
Detailed Explanation
3D Rotation Matrices
In 3D, there are three basic rotation matrices, one for each coordinate axis.
Rotation Around X-Axis
Rx(a) = | 1 0 0 |
| 0 cos(a) -sin(a) |
| 0 sin(a) cos(a) |
Rotation Around Y-Axis
Ry(a) = | cos(a) 0 sin(a) |
| 0 1 0 |
| -sin(a) 0 cos(a) |
Rotation Around Z-Axis
Rz(a) = | cos(a) -sin(a) 0 |
| sin(a) cos(a) 0 |
| 0 0 1 |
Composing Rotations
A combined rotation is the product of individual rotations. The order matters because matrix multiplication is not commutative:
R = Rz(c) * Ry(b) * Rx(a) (ZYX Euler angles)
Properties
- All 3D rotation matrices have determinant = 1
- They are orthogonal: R^T = R^(-1)
- They form the SO(3) group (Special Orthogonal group in 3D)
- Composing rotations gives another rotation
Gimbal Lock
When using Euler angles (three sequential axis rotations), certain angle combinations cause two axes to align, losing one degree of freedom. This is called gimbal lock. Quaternions are often used to avoid this problem while still representing rotations compactly.
Use Case
3D rotation matrices are essential in computer graphics (camera movement, object orientation), robotics (joint angles, end-effector orientation), aerospace engineering (aircraft attitude), virtual reality (head tracking), and molecular modeling (rotating molecular structures for visualization and docking).