The Least-Squares Solution of a Linear System (Without Collinearity)
Compute the least-squares solution of an overdetermined linear system using the normal equations, and apply it to fit a line through data points.
Step 1 of 119%
Tutorial
The Normal Equations
An overdetermined linear system is a system with more equations than unknowns. In general, no vector satisfies every equation exactly. Instead, we look for the vector that makes as close to as possible. This vector is the least-squares solution -- it minimizes
The least-squares solution satisfies the normal equations
When the columns of are linearly independent (the "no collinearity" condition), is invertible. Solving for gives
To use this formula, we just need four steps: form , form , invert the (or larger) matrix , and multiply.