A rotation matrix represents geometric rotation by mapping vectors to new coordinates while preserving their distance from the center. In two dimensions, rotation by θ uses R = [[cos θ, −sin θ], [sin θ, cos θ]]. Three-dimensional variants rotate around the X, Y, or Z axis; the coordinate on the rotation axis remains unchanged. section 2.14 section 2.14.1
Key properties connect the geometry to matrix computation:
- Every rotation matrix R is orthogonal: RᵀR = RRᵀ = I, so Rᵀ = R⁻¹. section 2.14.2
- Orthogonality preserves vector length, so rotating u into Ru does not change its magnitude. section 2.14.2
- Negating the angle reverses the rotation: R(−θ) = R(θ)ᵀ. section 2.14.2
- Every rotation has eigenvalue 1; its corresponding eigenvector defines the rotation axis, whose points remain fixed. section 2.14.4
Compose two three-dimensional rotations
Start with u = [1, 1, 1]. Apply a 45° rotation about the Z-axis to obtain v = R₃ᴅ,z(45°)u, then apply a 45° rotation about the X-axis to obtain w = R₃ᴅ,x(45°)v. In PyTorch, each step is matrix multiplication, such as torch.matmul(R3dz, u).
Rotation also changes coordinates without changing the underlying geometry of a quadratic shape. For a hyperellipse, diagonalizing its symmetric matrix supplies an orthogonal eigenvector matrix S; rotating coordinates by S aligns the coordinate axes with the ellipse axes. section 2.17 section 2.17.1

