The least-squares approximation to a set of data points $\left({x}_{i}\,{y}_{i}\right)$ is the line $y\=a\cdot x\+b$ that comes closest to going through all the points, in the following sense:

The sum of the squares of all the errors (the difference in the y-value between the data point and the closest point on the line) is minimized.

The problem is to find values $a$ and $b$ such that the sum $\sum _{i}^{n}{\left[{y}_{i}-\left(aplus;b\cdot {x}_{i}\right)\right]}^{2}$ is minimal.

${}$

Click on the graph to create the set of data. The total area covered by all the purple squares represents the error that should be minimized.

## Was this information helpful?