Project a vector onto a column space
Set up and solve the normal equations AT A x = AT b and form p = A x. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.
A line was one direction. Now the target is a column space — several directions at once, usually not perpendicular to each other.
The projection of is still the closest point, and the residual is still perpendicular to everything in the space. "Perpendicular to every column" is one matrix equation:
These are the normal equations. Solve them for, then set.
Never invert. It is usually a rectangle with no inverse. The matrix that gets inverted is, which is square.
The residual must be perpendicular to every column of. That is separate conditions, one per column, and they pack into a single equation:.
Substituting:
Rearrange and you have the normal equations.
Two facts make this usable. is square ) and symmetric, so it is a system you can actually solve. And when has independent columns, is invertible — its nullspace is the same as's, and's nullspace is trivial by assumption. Without independence, is singular and there is no single closest-point formula of this shape.
Why and not? is and its rank is, so it is singular whenever has fewer columns than rows — which is the usual case. The order is forced.
Problem. Project onto the column space of.
Solution, set up.
Solve. Subtracting the two equations gives, so; then and both coordinates are.
Build.
Check., and ✓ — perpendicular to both columns at once, which is what "closest point in the plane" means.
Why this and not a nicer one. This column space is the plane, and has, so is genuinely off the plane and the projection is not itself. Choosing would have made and taught nothing.
- Set up and solve the normal equations A^T A x = A^T b and form p = A x
- Verify the projection by testing that the residual is orthogonal to every column
- Recognise the orthonormal case where A^T A = I and no inverse is needed
(a) For of shape with independent columns, what is the shape of and of?
(b) Why is invertible exactly when has independent columns?
Answers
(a) is; is with rank.
(b) If, then multiplying by gives, so. With independent columns that forces, so has trivial nullspace and is invertible. Dependent columns give a nonzero with, hence a nonzero nullspace of.