Mathematics · lesson 3 of 3
Orthogonality and least-squares fitting
The closest point in a subspace is found by an orthogonal residual.
Learn the ideas
Prerequisites: Dot products, matrices and Euclidean norms.
Projection
The closest point in a subspace is found by an orthogonal residual.
Normal equations
AᵀAx=Aᵀb characterizes least-squares solutions.
Uniqueness
Full column rank makes AᵀA invertible; without it, fitted values may be unique while coefficients are not.
Computation
QR factorization avoids explicitly forming AᵀA and often offers better numerical stability.
Worked examples
Project v=(3,4) onto the x-axis. Enter the x-coordinate.
The closest point is (3,0), leaving residual (0,4) perpendicular to the axis.
3
Fit a constant c by minimizing (1−c)²+(3−c)²+(8−c)². Find c.
The minimizer is the sample mean (1+3+8)/3=4.
4
Check your understanding
8 questionsDecimals or fractions are accepted for numeric answers. Proofs and written responses use sample answers and require human marking. This is practice, not a protected examination.
Further reading and review references
These are reference links, not copied exercises, institutional endorsement or proof of independent review.