LINEAR-ALGEBRA · Unit 14 · Video 1 · Interactive Practice

One Right Angle Is All You Need — The Projection Matrix

IKey Formulas

Formula Name Description
x^=aTbaTa\hat{x} = \dfrac{\mathbf{a}^T\mathbf{b}}{\mathbf{a}^T\mathbf{a}} Scalar coefficient How far along a to walk
p=x^a=aTbaTaa\mathbf{p} = \hat{x}\,\mathbf{a} = \dfrac{\mathbf{a}^T\mathbf{b}}{\mathbf{a}^T\mathbf{a}}\,\mathbf{a} Projection vector Closest point on line to b
P=aaTaTaP = \dfrac{\mathbf{a}\mathbf{a}^T}{\mathbf{a}^T\mathbf{a}} Projection matrix Maps any vector onto line through a
PT=P,P2=PP^T = P, \quad P^2 = P Key properties Symmetric and idempotent

IIVisualization 1 — Projecting onto a Line

The projection p\mathbf{p} is the closest point on the line through a\mathbf{a} to b\mathbf{b}; the error e=bp\mathbf{e} = \mathbf{b} - \mathbf{p} always meets the line at a right angle.

💡 Challenge: drag the tip of b\mathbf{b} until it lands on the line — the error collapses to zero and p=b\mathbf{p} = \mathbf{b}.

IIIVisualization 2 — Scaling a and b

Scaling b\mathbf{b} stretches its projection by the same factor; scaling a\mathbf{a} leaves the projection exactly where it was.

💡 P=aaT/aTaP = \mathbf{a}\mathbf{a}^T / \mathbf{a}^T\mathbf{a} depends only on the direction of a\mathbf{a}: the extra factors of kk in numerator and denominator cancel.

IVVisualization 3 — What P Does to Every Vector

The matrix PP crushes the whole plane onto the line through a\mathbf{a} (rank 1), and applying it a second time changes nothing (P2=PP^2 = P).

Pv — every image lands on the line (rank 1)

P²v = Pv — the rings sit on the arrow tips (idempotent)

VQuiz Questions

Question 1

Given a=[123]\mathbf{a} = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} and b=[210]\mathbf{b} = \begin{bmatrix} 2 \\ 1 \\ 0 \end{bmatrix}, what is the scalar coefficient x^=aTbaTa\hat{x} = \dfrac{\mathbf{a}^T\mathbf{b}}{\mathbf{a}^T\mathbf{a}}?

Correct! aᵀb = 4 and aᵀa = 14, so x̂ = 4/14 = 2/7.

Not quite. Compute aᵀb (numerator) and aᵀa (denominator) separately, then simplify the fraction.

Show solution

Solution:

Compute the dot products step by step:

aTb=(1)(2)+(2)(1)+(3)(0)=2+2+0=4\mathbf{a}^T\mathbf{b} = (1)(2) + (2)(1) + (3)(0) = 2 + 2 + 0 = 4

aTa=12+22+32=1+4+9=14\mathbf{a}^T\mathbf{a} = 1^2 + 2^2 + 3^2 = 1 + 4 + 9 = 14

x^=414=27\hat{x} = \frac{4}{14} = \frac{2}{7}

The answer is 2/7.

Question 2

In the projection matrix formula P=aaTaTaP = \dfrac{\mathbf{a}\mathbf{a}^T}{\mathbf{a}^T\mathbf{a}}, the numerator aaT\mathbf{a}\mathbf{a}^T and denominator aTa\mathbf{a}^T\mathbf{a} are:

Correct! Column × row = matrix (outer product); row × column = scalar (inner product). The order matters!

Not quite. Think about dimensions: a is n×1 and aᵀ is 1×n. What shape does each product give?

Show solution

Solution:

  • aaT\mathbf{a}\mathbf{a}^T is column × row (outer product): (n×1)(1×n)=n×n(n \times 1)(1 \times n) = n \times n matrix. Every column is a scalar multiple of a\mathbf{a} — it's rank 1.

  • aTa\mathbf{a}^T\mathbf{a} is row × column (inner product / dot product): (1×n)(n×1)=1×1(1 \times n)(n \times 1) = 1 \times 1 scalar.

Key: The order of multiplication matters! aaT\mathbf{a}\mathbf{a}^T (outer) \neq aTa\mathbf{a}^T\mathbf{a} (inner).

Question 3

True or False: Replacing a\mathbf{a} with 5a5\mathbf{a} changes the projection matrix P=aaTaTaP = \dfrac{\mathbf{a}\mathbf{a}^T}{\mathbf{a}^T\mathbf{a}}.

Correct! The scale factors cancel — P depends only on the direction of a, not its length.

Not quite. Try substituting 5a into the formula and see what cancels in the numerator and denominator.

Show solution

Solution: False.

Substitute 5a5\mathbf{a} for a\mathbf{a}:

P=(5a)(5a)T(5a)T(5a)=25aaT25aTa=aaTaTa=PP' = \frac{(5\mathbf{a})(5\mathbf{a})^T}{(5\mathbf{a})^T(5\mathbf{a})} = \frac{25\,\mathbf{a}\mathbf{a}^T}{25\,\mathbf{a}^T\mathbf{a}} = \frac{\mathbf{a}\mathbf{a}^T}{\mathbf{a}^T\mathbf{a}} = P

The factors of 2525 cancel completely. PP depends only on the direction of a\mathbf{a}, not its magnitude.

Question 4

You project b\mathbf{b} onto the line through a\mathbf{a} and get p=Pb=[2,  4,  6]T\mathbf{p} = P\mathbf{b} = [2,\; 4,\; 6]^T. Now you project p\mathbf{p} onto the same line again. What is PpP\mathbf{p}?

Correct! By idempotency (P² = P), projecting again gives the same result. The shadow of a shadow is the shadow itself!

Not quite. Remember P² = P (idempotency). What happens when you project a vector that's already on the line?

Show solution

Solution:

By idempotency (P2=PP^2 = P):

Pp=P(Pb)=P2b=Pb=p=[246]P\mathbf{p} = P(P\mathbf{b}) = P^2\mathbf{b} = P\mathbf{b} = \mathbf{p} = \begin{bmatrix} 2 \\ 4 \\ 6 \end{bmatrix}

Geometrically, p\mathbf{p} already lies on the line through a\mathbf{a}. Projecting a point that's already on the line onto the same line doesn't move it.

The shadow of a shadow is the shadow itself.

Solved: 0 / 4