has no guarantee of a solution — can only ever produce outputs inside its column space, and might simply live outside it. So what does "solving" even mean when an exact solution doesn't exist?
Here 's column space has collapsed to a single line (drawn through ). Drag anywhere on the plane and watch — the closest point on that line to — barely budge in comparison. is the best can ever do.
The projection of onto the line spanned by is the point that's closest to , found by requiring the leftover piece to be perpendicular to :
- — the vector spanning the column space (here, a single column, so the column space is a line).
- — the target vector being projected.
- — the projection: the closest point on the line to .
- Where this scalar comes from
Writing and demanding (the residual is perpendicular to the line) gives , which solves directly to .
- This is exactly what Ax=b means geometrically
When has one column , solving means finding a scalar with — possible only when already lies on the line. is the nearest point on that line when it doesn't.
- The residual is never part of the column space
is perpendicular to by construction, so it has zero component along the only direction can reach — it's the part of that gets permanently left behind.
Ax = b exactly solvable: no
Toggle between a that sits off the line (no exact solution — is a genuine approximation) and a that sits exactly on it (an exact solution exists, and ).
For and :
- Compute the scalar
, and , so .
- Compute the projection
— the closest point on the line through to .
- Verify the residual is perpendicular to a
. Check: — exactly perpendicular, confirming really is the closest point.
Drag b until its projection p onto the line spanned by a = (2.0, 1.0) lands on (4.0, 2.0). Any b that projects there will do — there's more than one right answer.
Every matrix's column space is some subspace of its output space — sometimes the whole space, sometimes (as here) a lower-dimensional slice of it. only has an exact solution when happens to fall inside that subspace; otherwise the best you can do is project onto it. This exact mechanism — minimize the perpendicular residual — is what least-squares regression solves in full generality, just with a column space spanned by many columns instead of one.