Normal Equations
Normal equations and the geometry of residuals
For an overdetermined system Ax≈b, a least-squares solution minimizes the sum of squared differences between observations and predictions. Define the residual as r=b-Ax. The governing condition is that this residual has zero dot product with every column of A, even when no coefficient vector fits every observation exactly.
From error to equations
Expanding the squared length of b-Ax and differentiating with respect to the coefficients gives the normal equations ATA x=ATb. Rearranging yields ATr=0, which expresses orthogonality to every design column. Each entry of ATA is a dot product between two columns, so it is a Gram matrix, rather than an elementwise square of A.
If A has full column rank, its columns are independent and ATA is invertible. The coefficient vector is then unique.
If the columns are dependent, a nonzero vector z can satisfy Az=0; adding z to a solution changes its coefficients without changing the fitted vector Ax.
The best fitted vector remains unique because it is the orthogonal projection of b onto the column space of A.
Worked example
Take A with rows (1,0), (1,2), and (1,4), and let b=(2,4,9)T. The column dot products give ATA with rows (3,6) and (6,20), while ATb=(15,44)T. Solving 3x1+6x2=15 and 6x1+20x2=44 gives x=(3/2,7/4)T.
The predictions are (3/2,5,17/2)T, so r=(1/2,-1,1/2)T.
The first column has dot product 1/2-1+1/2=0 with r; the second has 2(-1)+4(1/2)=0. These checks show that the residual is orthogonal to both columns, although none of its three entries is zero.
Let A=(1,1,1)T and b=(1,4,7)T. For the least-squares scalar fit x, which residual r=b-Ax satisfies the normal equation?
For a real m×n matrix A with m≥n, which condition guarantees a unique least-squares coefficient vector for every b?