More Equations Than Unknowns
Suppose we want to fit a curve to measured data. We often have more observations than model parameters. Writing one equation for each observation then produces an overdetermined linear system.
A system is overdetermined when the number of equations is greater than the number of unknowns, so . Such a system can have an exact solution. Measurement data usually contain points that do not lie exactly on the chosen model.
Quadratic Fit for Seven Observations
Consider data points that we want to fit with a quadratic polynomial.
The observations are:
We seek a parabola of the form:
The unknowns are the parameters (quadratic coefficient), (linear coefficient), and (constant term).
Setting Up the System of Equations
Substituting each pair into the polynomial gives one equation. The observations therefore give equations for only unknown coefficients.
Evaluating the powers of each turns the system into:
Matrix Form
The system of equations above can be written in matrix form .
For a quadratic model fitted to data points, the same construction has the general form:
Why There Is No Exact Solution
In this example, matrix has size and the coefficient vector has size . We therefore have equations for unknowns.
An exact solution exists exactly when . Matrix dimensions alone do not decide this.
The three columns of are linearly independent. Indeed, a polynomial of degree at most that vanishes at all seven distinct values of must be the zero polynomial. Therefore .
Appending forms the augmented matrix . The first four rows already give the nonzero minor
This nonzero minor shows that .
Because , the system has no exact solution. No single quadratic polynomial passes through all observations.
Solution with Least Squares
When an overdetermined system has no exact solution, we can instead find the polynomial that is closest to the observations in the least-squares sense.
For observation , the vertical residual is . Least squares chooses the coefficients that minimize the sum of the squared residuals:
This criterion penalizes large misses more strongly and produces one best-fitting parabola because has full column rank. The normal equations are
The middle equation directly gives the linear coefficient. Use the last equation to express the constant through the quadratic coefficient, then substitute into the first equation.
Solving them gives
The fitted values do not equal every observation, which is expected. The residual vector is
The residual vector satisfies
The equation says that the remaining error is orthogonal to every column of . Geometrically, is the orthogonal projection of onto the column space of .
Overdetermined systems are common in engineering and science because experiments often provide many measurements for a model with relatively few parameters. Least squares uses all of those measurements without pretending that noisy data fit the model exactly.
The curve shows the fitted model, while the points mark observations. Rotate or zoom to compare each point with the curve. Its vertical difference is the residual at the same time value.