QR Factorization for Least Squares
Reduce an overdetermined system to a triangular solve and explain why forming normal equations can amplify conditioning.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Orthogonal coordinates preserve residual length
For a full-column-rank matrix, write the thin factorization \(A=QR\) with orthonormal columns of \(Q\). Decompose \(b\) into its projection onto those columns plus a perpendicular residual. Minimizing \(\|Ax-b\|_2\) is equivalent to choosing \(x\) so \(Rx=Q^\top b\). For \(A=(1,1)^\top\) and \(b=(1,3)^\top\), this yields \(x=2\). The remaining error is perpendicular to the column because its two components sum to zero.
Avoid squaring the spread of singular values
Normal equations use \(A^\top A\), whose two-norm condition number is the square of that of full-rank \(A\). QR can work directly using orthogonal transformations such as Householder reflections. Rank-deficient systems need additional choices for a solution, often based on a singular value decomposition. Condition numbers explain why two mathematically equivalent formulations can give different numerical results.[1][2]