Check that the error b - p is orthogonal to the column space
Compute the error e = b - p of a proposed projection and dot it with every column of A. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.
For a subspace and a vector, the projection is the point of closest to. Equivalently — and this is the definition to compute with — is the point of for which
When is the column space of, "orthogonal to every vector of" reduces to a finite list: must be perpendicular to each column of. That is the same statement as which is the normal equation rearranged.
Three facts that follow, all used constantly.
- 1. is perpendicular to every column of.
- 2. is perpendicular to every vector in the column space, because each is a combination of the columns.
- 3. is perpendicular to, because is itself in the column space.
One thing that does not follow. is not perpendicular to. See the trap.
Projection is a minimisation: among all points of, is the closest to. The condition that characterises a minimum is exactly orthogonality of the error, and it is worth seeing why once because the same argument returns for least squares.
The argument. Let be the closest point and let be any other point of. Write. For any real, This is a quadratic in with a minimum at. For to be the closest point, must be the minimum, which requires. Since was arbitrary in, the error is perpendicular to all of.
Why this matters practically. The condition is a test, not just a definition: given any candidate, you can check it in one dot product per column and know whether it is right. Nothing else about a projection is this cheap to verify.
And why the formula is what it is. Solving gives, hence and. The projection matrix is a consequence of the orthogonality condition, not a separate fact to memorise.
Let
The true least-squares solution. With and, Check both columns: ✓ and ✓.
A wrong coefficient and what it looks like. Try: then and. Both dots fail — and. So a single wrong coefficient can break every dot at once.
A wrong coefficient that breaks only one. Try: that is, giving and. Then and. Again both. The direction that breaks exactly one dot is a displacement along a vector perpendicular to the other column, which is why the practice items draw matrices whose columns are not perpendicular — with orthogonal columns the two failure patterns collapse into one.
- Compute the error e = b - p of a proposed projection and dot it with every column of A
- Name which column a proposed projection fails against, and read that as 'the coefficient was wrong'
- Explain why e is perpendicular to the whole column space and to p, but not to b
(a) A projection of onto a plane gives. What is the error and what is for a column spanning the normal? (b) If is the error of a projection, what is? (c) Can ever be zero for a non-exact fit?
Answers
(a) and, so this is not the projection onto that plane — the error is along the normal, which is exactly the failure the check catches.
(b) Zero. lies in the column space and is perpendicular to the whole of it.
(c) No., which is strictly positive unless, i.e. unless the fit is exact.