Projection and Best Approximation
The projection of onto is — the shadow casts on the line through . What is LEFT OVER, , is perpendicular to ; its length is the distance to the line.
When has no solution, solve instead: is the PROJECTION of onto the column space — the best possible fit. Every regression line in statistics is this computation.
Fitting a constant to data minimizes ; the derivative vanishes at the MEAN, . Least squares generalizes the average — and orthogonality is why it works.
Gauss invented least squares to find a lost asteroid (Ceres, 1801) — and today every regression, every GPS position fix (overdetermined satellite equations), and every curve fit in every lab runs the normal equations from this topic. Orthogonality is also why JPEG and MP3 work: signals are projected onto orthogonal cosine bases and the small components discarded.
Find the distance from to the line through the origin along . Work: coefficient ; projection ; remainder ; distance . Verify: remainder ✓.
Proofs & Why It Matters
Seek the multiple of making the remainder orthogonal to : gives in one step.
This is also the CLOSEST point on the line: for any other multiple , Pythagoras gives .
The best minimizes , i.e. makes the closest point to in the column space. Closest means the error is orthogonal to every column of (else sliding along that column would shrink it — the projection argument again).
Orthogonality to all columns at once is , i.e. . Fitting a constant to data makes this one equation whose solution is the mean.
Going Deeper: Explanations & Worked Problems
The projection formula does more than find shadows — it SPLITS any into two orthogonal pieces relative to a direction : the part along, , and the part across, , which is orthogonal to by construction. Pythagoras then bookkeeps the lengths: . The "across" length IS the distance from the point to the line — that is where the point-to-line distance formula comes from. Iterating the split against several directions in turn is Gram–Schmidt: peel off the component along each previously built direction, keep what remains, normalize — manufacturing an orthogonal basis from any basis, one subtraction at a time.
Take and direction .
Step 1 — the coefficient: .
Step 2 — the along part: .
Step 3 — the across part: ; check orthogonality: ✓.
Step 4 — distance from to the line : the across length, — matching the point-to-line formula ✓.
Step 5 — Pythagoras audit: ✓. Five steps, three self-checks — the decomposition verifies itself.
Fit to the points ... which happen to be collinear — so fit instead.
Step 1 — the (unsolvable) system: , , , i.e. , .
Step 2 — normal equations : compute and .
Step 3 — solve: and ; subtracting, , , then .
Step 4 — the fitted line predicts ; residuals sum to — as they must, since orthogonality of the error to the all-ones column is literally one of the normal equations.