Rotations
Analytic Geometry
A rotation is a linear transformation that preserves lengths, angles, and orientation. In mathbb{R}^2, rotation by angle theta counterclockwise is the matrix R_theta = begin{pmatrix}costheta & -sintheta \\ sintheta & costhetaend{pmatrix}. Its columns are unit vectors 90° apart; it satisfies R^top R
A rotation is an orthogonal matrix with — it preserves lengths, angles, and orientation.
Without orthogonal / rotation matrices there is no QR decomposition, no Gram-Schmidt, no rotary embeddings, and no clean treatment of stability in deep networks.
A rotation is a linear transformation that preserves lengths, angles, and orientation. In , rotation by angle counterclockwise is the matrix . Its columns are unit vectors 90° apart; it satisfies and (the is what distinguishes rotations from reflections, which have ).
Rotations in form a group under composition: , rotations commute, and every rotation has an inverse . This beautiful structure is called , the special orthogonal group in 2 dimensions.
In 3D, rotations are specified by an axis and an angle. Elementary rotations about the -, -, and -axes have well-known matrix forms; any rotation can be decomposed into three such elementary ones via Euler angles. Unlike 2D, 3D rotations do not commute — rotating yaw-then-pitch is different from pitch-then-yaw, a fact pilots and robotics engineers know intimately.
Higher-dimensional rotations live in , the group of orthogonal matrices with determinant . These preserve Euclidean distance and orientation in any number of dimensions. An important fact: every rotation can be written as for some skew-symmetric matrix (i.e., ). This is the bridge between the Lie group and its Lie algebra , used in robotics and differential geometry.
Worked example — composition of rotations: — rotations compose by *adding* angles. Algebraically, , the well-known trig identity that emerges naturally from matrix multiplication.
Rotations matter in ML beyond graphics. In PCA, a data rotation aligns axes with directions of maximum variance. In normalizing flows, each invertible transformation is often a composition of rotations and scalings. Rotary Position Embedding (RoPE) in modern transformers encodes positions by rotating query/key vectors in high-dimensional space — a mathematically elegant way to inject sequence position that preserves inner products up to phase. Knowing your rotations is surprisingly practical.
Exercises
Put your understanding to the test. Score + streak + speed all count.
Confirm you've got it
3 quick questions. Get 2 right to mark this lesson complete.