2D Rotation Matrices — Rotating Points in a Plane
Learn how 2D rotation matrices work, how to construct them for any angle, and how to combine multiple rotations using matrix multiplication.
Applications
Detailed Explanation
2D Rotation Matrix
A 2D rotation matrix rotates a vector counterclockwise by angle theta around the origin:
R(theta) = | cos(theta) -sin(theta) |
| sin(theta) cos(theta) |
Example: 90-Degree Rotation
R(90) = | cos(90) -sin(90) | = | 0 -1 |
| sin(90) cos(90) | | 1 0 |
Applying to point (3, 1):
| 0 -1 | | 3 | = | -1 |
| 1 0 | | 1 | | 3 |
The point (3, 1) rotates to (-1, 3), which is correct for a 90-degree counterclockwise rotation.
Common Rotation Matrices
- 0 degrees: Identity matrix I
- 90 degrees: [[0, -1], [1, 0]]
- 180 degrees: [[-1, 0], [0, -1]]
- 270 degrees: [[0, 1], [-1, 0]]
Properties
- det(R) = 1: Rotation preserves area and orientation
- R^(-1) = R^T: Rotation matrices are orthogonal
- R(a) * R(b) = R(a + b): Rotations compose by adding angles
- ||Rv|| = ||v||: Rotation preserves vector length
Rotation Around Arbitrary Point
To rotate around point (px, py) instead of the origin:
- Translate: subtract (px, py)
- Rotate: apply R(theta)
- Translate back: add (px, py)
Use Case
2D rotation matrices are used in game development (rotating sprites and objects), robotics (joint rotations in 2D kinematic chains), image processing (rotating images), UI design (rotating elements in canvas-based applications), and physics simulations (rotational dynamics in 2D).