Mathwords logoMathwords

Rotation Matrix — Definition, Formula & Examples

A rotation matrix is a square matrix that, when multiplied by a vector, rotates that vector by a specified angle around the origin without changing its length. In two dimensions, a rotation matrix is a 2×2 matrix defined by a single angle θ.

A rotation matrix RR is an orthogonal matrix with determinant +1+1, belonging to the special orthogonal group SO(n)SO(n). It satisfies RTR=IR^T R = I and det(R)=1\det(R) = 1, where RTR^T is the transpose and II is the identity matrix. These conditions guarantee that RR preserves both distances and orientation.

Key Formula

R(θ)=(cosθsinθsinθcosθ)R(\theta) = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}
Where:
  • θ\theta = The angle of counterclockwise rotation (in radians or degrees)
  • R(θ)R(\theta) = The 2×2 rotation matrix that rotates vectors by angle θ

How It Works

To rotate a 2D column vector v\mathbf{v} by an angle θ\theta counterclockwise about the origin, multiply it by the 2D rotation matrix: v=R(θ)v\mathbf{v'} = R(\theta)\,\mathbf{v}. The resulting vector v\mathbf{v'} has the same magnitude as v\mathbf{v} but points in a new direction. A positive angle θ\theta corresponds to counterclockwise rotation, while a negative angle rotates clockwise. Because rotation matrices are orthogonal, the inverse of a rotation by θ\theta is simply the rotation by θ-\theta, which equals the transpose RTR^T. In 3D, separate rotation matrices exist for rotation about the xx-, yy-, and zz-axes, and general 3D rotations are built by composing these.

Worked Example

Problem: Rotate the vector v=(10)\mathbf{v} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} by 90° counterclockwise about the origin.
Step 1: Write the rotation matrix for θ = 90°. Since cos 90° = 0 and sin 90° = 1:
R(90°)=(0110)R(90°) = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}
Step 2: Multiply the rotation matrix by the vector:
v=(0110)(10)=(01+(1)011+00)=(01)\mathbf{v'} = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \cdot 1 + (-1) \cdot 0 \\ 1 \cdot 1 + 0 \cdot 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix}
Step 3: Verify the result preserves length. The original vector has length 1, and the rotated vector also has length √(0² + 1²) = 1.
v=02+12=1\|\mathbf{v'}\| = \sqrt{0^2 + 1^2} = 1
Answer: The rotated vector is (01)\begin{pmatrix} 0 \\ 1 \end{pmatrix}, which points straight up along the positive yy-axis — exactly 90° counterclockwise from the original.

Another Example

Problem: Rotate the point (3,4)(3, 4) by 60° counterclockwise about the origin.
Step 1: Build the rotation matrix for θ = 60°. Use cos 60° = 0.5 and sin 60° ≈ 0.866:
R(60°)=(0.50.8660.8660.5)R(60°) = \begin{pmatrix} 0.5 & -0.866 \\ 0.866 & 0.5 \end{pmatrix}
Step 2: Multiply the rotation matrix by the position vector:
(0.50.8660.8660.5)(34)=(0.5(3)+(0.866)(4)0.866(3)+0.5(4))=(1.9644.598)\begin{pmatrix} 0.5 & -0.866 \\ 0.866 & 0.5 \end{pmatrix} \begin{pmatrix} 3 \\ 4 \end{pmatrix} = \begin{pmatrix} 0.5(3) + (-0.866)(4) \\ 0.866(3) + 0.5(4) \end{pmatrix} = \begin{pmatrix} -1.964 \\ 4.598 \end{pmatrix}
Step 3: Check that the distance from the origin is preserved. The original distance is √(9 + 16) = 5, and the new distance is √(1.964² + 4.598²) ≈ √(3.857 + 21.143) = √25 = 5.
v=(1.964)2+(4.598)2=5\|\mathbf{v'}\| = \sqrt{(-1.964)^2 + (4.598)^2} = 5
Answer: The rotated point is approximately (1.964,  4.598)(-1.964,\; 4.598), still at distance 5 from the origin.

Why It Matters

Rotation matrices are foundational in computer graphics, robotics, and aerospace engineering — any field that needs to describe orientation or movement in space. In a linear algebra course, they serve as a key example of orthogonal transformations and connect abstract theory to geometric intuition. Physics and engineering students use them extensively when working with coordinate transformations, rigid-body dynamics, and satellite attitude control.

Common Mistakes

Mistake: Swapping the signs in the rotation matrix, writing sinθ\sin\theta in the top-right entry and sinθ-\sin\theta in the bottom-left.
Correction: The standard counterclockwise rotation matrix has sinθ-\sin\theta in the top-right and +sinθ+\sin\theta in the bottom-left. Reversing the signs produces a clockwise rotation (or equivalently, the transpose).
Mistake: Using degrees in a calculator set to radians (or vice versa) when evaluating sin and cos.
Correction: Always check your calculator's angle mode. If θ = 90°, using radian mode will compute sin(90) ≈ 0.894 instead of the correct sin(90°) = 1.

Related Terms