Orthogonality
View .md

Least Squares

When Ax=bAx = b has no solution, we find the best approximate solution by minimizing the error:

min⁑xβˆ₯Axβˆ’bβˆ₯2\min_x \|Ax - b\|^2

The Normal Equations

The solution satisfies:

ATAx^=ATbA^TA\hat{x} = A^Tb

This always has a solution (if ATAA^TA is invertible, it’s unique).

Why It Works

We project bb onto C(A)C(A). The projection p=Ax^p = A\hat{x} is the closest point in the column space to bb.

Applications

  • Line fitting β€” find the best line through data points
  • Curve fitting β€” find the best polynomial
  • Overdetermined systems β€” more equations than unknowns

Example

Fitting y=c+dxy = c + dx to points (1,1),(2,2),(3,2)(1,1), (2,2), (3,2):

A=(111213),b=(122)A = \begin{pmatrix}1&1\\1&2\\1&3\end{pmatrix}, \quad b = \begin{pmatrix}1\\2\\2\end{pmatrix}

Solve ATAx^=ATbA^TA\hat{x} = A^Tb for best c,dc, d.