Least Squares Optimization

Least squares optimization is a method for finding an approximate solution to a system of equations for which . Formally, given a real matrix and a vector , the least squares problem finds (at least one) vector such that is the orthogonal projection of onto ,

where is always an optimal solution to the system of normal equations .

Particularly, if is in full column rank (i.e., ), and therefore is overdetermined, then the least squares solution is given as

Moreover, if is in full row rank (i.e., ), and therefore is undetermined with infinite solutions, then the least squares solution is defined as the solution of the system with the smallest Euclidean norm, such that

Least Squares and the Pseudoinverse where is the minimum-norm point in the optimal set. This means that if (i.e., is full rank), then the optimal solution .

Note that the set of optimal solutions to the least squares problem can be expressed as

Proofs

1. General Solution

Per the Projection Theorem, we know that given any , there exists some at minimal distance from . We also know that . As such, for all ,

Furthermore, since , there certainly exists some , such that . Combining the two equations,

2. Full Col. Rank Solution

Since is invertible for wide matrices of full column rank, we have .

3. Full Row Rank Solution

When a tall matrix has full row rank , the rank-nullity theorem implies that the nullspace of is nontrivial, such that .

4. Pseudoinverse Solution

Variants

(Weighted LS) For , , such that .

The proof is simple. We know from the proof of general LS that is the optimal solution to . We then take , , and substitute for the solution, such that

(Linearly Constrained LS) For \begin{aligned} \min_\limits{x} \quad & c^T x \\ \text{s.t.:} \quad & Ax \leq b\end{aligned}

(-Regularized LS) For , is the optimal solution to .