Matrix Representation: Rotation by 45°

April 13, 2026

Problem

Build the matrix for a 45° counter-clockwise rotation in the plane. Show how it rotates a sample vector and preserves lengths.

Explanation

The recipe for a transformation matrix

Every linear transformation T:RnRmT : \mathbb{R}^n \to \mathbb{R}^m can be represented by a matrix AA such that T(x)=AxT(\mathbf{x}) = A \mathbf{x}. To construct AA:

Apply TT to each standard basis vector; each result becomes a column of AA. A=[  T(e1)T(e2)T(en)  ]A = \bigl[\; T(\mathbf{e}_1) \mid T(\mathbf{e}_2) \mid \cdots \mid T(\mathbf{e}_n) \;\bigr]

The rotation matrix

A counter-clockwise rotation by angle θ\theta in R2\mathbb{R}^2: Rθ=(cosθsinθsinθcosθ)R_\theta = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}

Step-by-step for θ=45°\theta = 45°

Step 1 — Rotate e1=(1,0)\mathbf{e}_1 = (1, 0).

Point (1,0)(1, 0) rotated by 45° lands at (cos45°,sin45°)=(22,22)(0.707,0.707)(\cos 45°, \sin 45°) = (\tfrac{\sqrt{2}}{2}, \tfrac{\sqrt{2}}{2}) \approx (0.707, 0.707). So first column of AA is (cos45°,sin45°)T(\cos 45°, \sin 45°)^T.

Step 2 — Rotate e2=(0,1)\mathbf{e}_2 = (0, 1).

Point (0,1)(0, 1) rotated by 45° CCW ends at (sin45°,cos45°)=(22,22)(0.707,0.707)(-\sin 45°, \cos 45°) = (-\tfrac{\sqrt{2}}{2}, \tfrac{\sqrt{2}}{2}) \approx (-0.707, 0.707). So second column is (sin45°,cos45°)T(-\sin 45°, \cos 45°)^T.

Step 3 — Assemble. R45°=(cos45°sin45°sin45°cos45°)=(22222222)R_{45°} = \begin{pmatrix} \cos 45° & -\sin 45° \\ \sin 45° & \cos 45° \end{pmatrix} = \begin{pmatrix} \tfrac{\sqrt{2}}{2} & -\tfrac{\sqrt{2}}{2} \\ \tfrac{\sqrt{2}}{2} & \tfrac{\sqrt{2}}{2} \end{pmatrix}

Testing on a sample vector

Rotate v=(1,0)\mathbf{v} = (1, 0): R45°v=(2222)R_{45°} \mathbf{v} = \begin{pmatrix} \tfrac{\sqrt{2}}{2} \\ \tfrac{\sqrt{2}}{2} \end{pmatrix}

Correct — v\mathbf{v} pointed along the x-axis, now points along y=xy = x, 45° up. ✓

Rotate w=(3,4)\mathbf{w} = (3, 4) (length 5): R45°w=(22(3)22(4)22(3)+22(4))=(22722)R_{45°} \mathbf{w} = \begin{pmatrix} \tfrac{\sqrt{2}}{2}(3) - \tfrac{\sqrt{2}}{2}(4) \\ \tfrac{\sqrt{2}}{2}(3) + \tfrac{\sqrt{2}}{2}(4) \end{pmatrix} = \begin{pmatrix} -\tfrac{\sqrt{2}}{2} \\ \tfrac{7\sqrt{2}}{2} \end{pmatrix}

Length: (22)2+(722)2=12+492=25=5\sqrt{(-\tfrac{\sqrt{2}}{2})^2 + (\tfrac{7 \sqrt{2}}{2})^2} = \sqrt{\tfrac{1}{2} + \tfrac{49}{2}} = \sqrt{25} = 5

Length preserved — a hallmark of rotations.

Why rotations preserve length

For any v\mathbf{v}: Rθv2=vTRθTRθv=vTIv=v2\|R_\theta \mathbf{v}\|^2 = \mathbf{v}^T R_\theta^T R_\theta \mathbf{v} = \mathbf{v}^T I \mathbf{v} = \|\mathbf{v}\|^2

since RθTRθ=IR_\theta^T R_\theta = I. A matrix with this property is called orthogonal. Rotations and reflections are the only length-preserving linear maps.

Key properties of rotation matrices

  • Determinant: detRθ=cos2θ+sin2θ=1\det R_\theta = \cos^2 \theta + \sin^2 \theta = 1.
  • Inverse: Rθ1=Rθ=RθTR_\theta^{-1} = R_{-\theta} = R_\theta^T — the inverse is the transpose.
  • Composition: RαRβ=Rα+βR_\alpha R_\beta = R_{\alpha + \beta} — rotation matrices add their angles.
  • Fixed point: only 0\mathbf{0} is fixed (for θ2πk\theta \ne 2\pi k).

Transformations by inspection

Some useful matrices built via "where do the basis vectors go":

  • Scale x by 2: (1,0)(2,0),(0,1)(0,1)(1, 0) \to (2, 0), (0, 1) \to (0, 1): (2001)\begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}.
  • Reflect across y=xy = x: (1,0)(0,1),(0,1)(1,0)(1, 0) \to (0, 1), (0, 1) \to (1, 0): (0110)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.
  • Shear x by 1 unit per y: (1,0)(1,0),(0,1)(1,1)(1, 0) \to (1, 0), (0, 1) \to (1, 1): (1101)\begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}.

Common mistakes

  • Putting the sine and cosine in the wrong spots. Double-check by rotating e1\mathbf{e}_1 and comparing.
  • Assuming every matrix represents a rotation. Only orthogonal matrices with det=1\det = 1 are rotations; det=1\det = -1 orthogonals are reflections.
  • Mixing up clockwise vs. counter-clockwise. Our formula is CCW; for CW, replace θ\theta with θ-\theta (which flips the signs on the sin\sin entries).

Try it in the visualization

Drag the angle θ\theta via a slider from 0° to 360°. A sample vector rotates live; the matrix entries update; the unit circle stays a unit circle, confirming length preservation.

Interactive Visualization

Parameters

45.00
3.00
3.00
4.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day