If the system

has no solution, a closest solution can be found by solving

. In terms of a set of points that seems to be linearly related, you can find the best fit line by using this method. Given

,

,

,

,

.
Find the best fit line for these points.
1) Set up the matrix

and

for each

:
2) Compute

.
So the resulting system is

.
3) Row reduce the matrix:

.
The best fit line is therefore

or

.