Orthogonality and Least Squares/Least-Squares Problems

Lesson 6.4784 words

Least-Squares Problems

When Ax = b has no solution, the least-squares solution makes Ax as close to b as possible. The closest Ax is the projection of b onto the column space, and the vector that produces it solves the normal equations A-transpose A x = A-transpose b.

╌╌╌╌

Over-determined systems — more equations than unknowns, built from noisy measurements — usually have no exact solution. The coefficient matrix maps onto the subspace , and the target typically lies outside it, so no exact solution exists. The practical question is which makes closest to , and the best-approximation theorem answers it: project onto .

The least-squares problem

The name records that is the square root of a sum of squares, so minimizing it minimizes the total squared error. No matter what is chosen, lands somewhere in . The task is to make that point the one in nearest to .

Every A x lies in the column space of A; the least-squares solution is the x whose image A x-hat equals b-hat, the orthogonal projection of b onto Col A, so the residual b minus A x-hat is perpendicular to the subspace.

The normal equations

Let . It is in , so is consistent and has a solution . Because is the closest point of to , this minimizes and so is a least-squares solution.

The residual is orthogonal to , hence orthogonal to every column of . If is a column, then , i.e. . Stacking these over all columns is the single matrix equation , which rearranges to

The normal equations say the residual b minus A x-hat is orthogonal to every column of A: it stands perpendicular to the plane spanned by a1 and a2, so each dot product with a column vanishes.

The forward direction is the derivation above. Conversely, if satisfies the normal equations, then is orthogonal to the rows of , hence to the columns of , hence to all of . So is an orthogonal decomposition, and by uniqueness must equal the projection — making a least-squares solution. The normal equations convert a minimization into a square linear system.

Non-unique least-squares solutions

When the columns of are dependent, has free variables and the least-squares solutions form a whole family.

Such matrices appear in the analysis-of-variance problems of statistics, where the columns encode overlapping group memberships.

With dependent columns the least-squares solutions fill a line in the domain, yet every point of that line maps to the same projection b-hat in Col A.

Uniqueness of the least-squares solution

The projection is unique, but the producing it need not be. Uniqueness is governed by the columns of .

The equivalence rests on the fact that : if , then , so , and the reverse is obvious. Independent columns thus make have trivial null space, hence invertible. The closed form is convenient for a system but is not the recommended route for larger or ill-conditioned problems.

When the columns are orthogonal, no inverse is needed at all: the projection is the sum of one-dimensional projections, and the weights are the least-squares solution directly. For with orthogonal columns,

Matrices with orthogonal columns arise routinely in the regression models where centering the data makes the design matrix's columns orthogonal by construction.

The least-squares error

Once is found, the quality of the fit is the distance from to its approximation.

For the worked example, , so and the error is . No can bring within of ; the residual is the leg of the right triangle from down to . An error of zero means was already in and the original system was consistent.

The QR route

The formula can amplify rounding error: forming squares the sensitivity of the problem. When the columns of are independent, the QR factorization gives a more reliable path.

With , the projection of onto is (projection onto an orthonormal basis). Then , so is the least-squares solution. In practice one does not invert ; since is upper triangular, the system

is solved by back-substitution, which is faster and more accurate than computing .

Two routes to the least-squares solution: the normal equations square the matrix and can be ill-conditioned, while the QR route projects with Q then back-substitutes through the triangular R.

Summary

QuantityFormulaNotes
Normal equationsalways consistent
Unique solutionneeds independent columns
Orthogonal columnsweights no inverse needed
QR routeback-substitution, more stable
Errorminimum residual length

The least-squares solution is a projection: is the foot of the perpendicular from to , and the normal equations are the algebraic statement that the residual is orthogonal to every column. Fitting lines, polynomials, and surfaces to data applies the same machinery with a design matrix.1

Footnotes

  1. Lay, §6.5 — Least-Squares Problems: the definition of a least-squares solution, Theorem 13 (normal equations), Theorem 14 (uniqueness via independent columns and invertibility of ), the least-squares error, and Theorem 15 (the QR solution ).

╌╌ END ╌╌