The Gram-Schmidt algorithm transforms any basis into an orthonormal basis—and in
doing so, computes the QR factorization. Just as Gaussian elimination organized
as matrix operations gives LU, Gram-Schmidt organized as matrix operations gives
QR.
Prerequisite: Math 235
You learned the Gram-Schmidt process in linear algebra (Math 235). Here we
revisit it with two new perspectives: (1) understanding it as computing a matrix
factorization, and (2) analyzing its numerical behavior.
Despite its elegance, classical Gram-Schmidt has serious numerical issues.
When the columns of A are nearly linearly dependent, the subtraction
vj=aj−∑⟨aj,qi⟩qi involves subtracting nearly
equal vectors. This catastrophic cancellation means the computed vj is
dominated by rounding errors, and the resulting q^j is not orthogonal
to the previous vectors.
The loss of orthogonality scales with the condition number of A: the computed
vectors satisfy ∣⟨q^i,q^j⟩∣=O(κ(A)⋅εmach).
For ill-conditioned matrices, this can be unacceptably large.
The subtraction cancels most significant digits. The result is dominated by
rounding errors, so q^2 is far from orthogonal to q1.
This motivates the Householder approach: instead of
orthogonalizing columns by subtraction (which cancels), we triangularize A by
multiplication with orthogonal matrices, which preserves norms and avoids
cancellation entirely.