Projection onto a Subspace
Problem
Project b = [1, 2, 3] onto the column space of A = [[1, 0],[0, 1],[0, 0]]. Show the projection and the residual.
Explanation
Projection — the idea
Given a vector and a subspace , the orthogonal projection of onto , written , is the unique vector closest to . The residual is orthogonal to every vector in .
Decomposition:
This split is unique.
Projection formula via a matrix
If where 's columns are linearly independent, then
The matrix is the projection matrix.
Properties of any projection matrix:
- (applying twice is the same as once — idempotent).
- (symmetric — for orthogonal projection).
- Eigenvalues are 0 (in ) or 1 (in ).
Step-by-step
is the -plane in — the set of all vectors with last coordinate zero.
Step 1 — .
Since , .
Step 2 — .
Step 3 — Projection.
Step 4 — Residual.
Check : the plane is spanned by . , ✓
Visual interpretation
is a vector in . The plane is the floor (-plane). The projection is the shadow of directly below it — on the floor. The residual is the straight-up vertical piece.
Projection onto a line
For spanned by a single non-zero vector , the formula simplifies dramatically:
This is the scalar "coefficient of in " times itself. It's the 1-column case of the general formula above.
Where projections appear
- Least squares regression: the fitted values are the projection of onto the column space of the design matrix.
- PCA: project data onto principal components.
- Orthogonal decompositions: separating a signal into parts (low-frequency + high-frequency).
- Image compression: project onto a few top basis vectors and discard the rest.
- Fourier series: coefficients are projections of onto basis functions.
Best approximation property
Among all vectors , minimizes . That's why projection is the foundation of least-squares approximation — it provides the closest point in a subspace.
Common mistakes
- Using the wrong columns. Only use columns that are linearly independent; otherwise is singular.
- Forgetting that projection is idempotent. Applying twice gives the same result as once; .
- Confusing orthogonal projection with oblique projection. Oblique projections exist ( but not symmetric); our formula produces orthogonal ones.
Try it in the visualization
and the subspace are drawn in 3D. A vertical dashed line from to the subspace shows the projection path. The projected vector sits on the plane; the residual points perpendicular.
Interactive Visualization
Parameters
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.