Compute the residual b - Ax
Compute b - Ax entry by entry and say what each entry means. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.
For a matrix, a vector and a right-hand side, the residual is Entry is so each entry is data minus model for that one measurement. The residual is a vector of the same length as, and it says how much of each entry the model failed to produce.
Sign convention., never. The residual is what is left of the right-hand side after the model has explained its part, and it carries the sign that makes rebuild.
Three readings of the same vector.
| observation | conclusion | |---|---| | | is in the column space; the system is consistent | | but | is the least-squares solution | | and | is neither a solution nor the best fit |
The middle row is the one worth memorising: the least-squares residual is perpendicular to every column.
The condition is worth deriving rather than memorising, because it is the same argument as projection.
Minimise. Expand: The gradient with respect to is, and setting it to zero gives which is exactly, i.e..
What that says geometrically. The residual is perpendicular to every column of, hence to the whole column space. Among all points reachable by the model, the one closest to is the one whose error sticks out perpendicularly — the foot of the perpendicular.
Why the sign never matters for the minimum., so the sum of squares is blind to the convention. What is not blind is the interpretation: with, a positive entry means the model under-predicted that measurement, and a plot drawn from is a mirror image. The sign matters for reading the residual, not for finding the optimum, which is exactly why it is easy to get wrong and never notice.
And why a zero residual is special. If the minimum error is, so no better exists. The system is consistent and solves it exactly. But uniqueness is a separate question: it needs independent columns, not a zero residual.
Fit to,,.
Set up. and.
Normal equations. and, so
Residual. Predictions, so
The check. — carefully: the first entry is ✓ and the second is ✓.
What the residual says about the data. The first point sits above the line, the second below, the third above. The signs alternate, which is what a best-fit line does; if every miss had the same sign the line could be moved to reduce all of them at once.
What it does not say., so is not in the column space — no line passes through all three points. And, so the residual is not perpendicular to.
- Compute b - Ax entry by entry and say what each entry means
- Read a zero residual as 'b is in the column space' and nothing more
- Recognise the residual of a least-squares fit and verify it is perpendicular to every column
(a) For,,: what is the residual? (b) A residual is perpendicular to both columns. Is it perpendicular to? (c) True or false: a zero residual makes unique.
Answers
(a) and. This particular solves the system exactly.
(b) No., so unless.
(c) False. It makes a solution. Uniqueness needs independent columns; a system can fit exactly and still be non-unique in general.