# What is a line of best fit?

Dec 19, 2017

A line of best fit is a particular linear function chosen to fit some data points.

#### Explanation:

A line of best fit is a particular linear function chosen to model a set of data points.

For example, given points $\left(1 , 2\right)$, $\left(2 , 4\right)$, $\left(3 , 5\right)$, $\left(4 , 7\right)$ we might want to find a line which approximates the relation between the $x$ and $y$ coordinates of the points, something like:

graph{(y-4.5-1.5(x-2.5))((x-1)^2+(y-2)^2-0.01)((x-2)^2+(y-4)^2-0.01)((x-3)^2+(y-5)^2-0.01)((x-4)^2+(y-7)^2-0.01) = 0 [-9.66, 10.34, -1.44, 8.56]}

Here, due to the symmetry of the points, I chose to make the line run through $\left(\frac{5}{2} , \frac{9}{2}\right)$ and have slope $\frac{3}{2}$.

So the linear function can be written:

$f \left(x\right) = \frac{3}{2} \left(x - \frac{5}{2}\right) + \frac{9}{2}$

or:

$f \left(x\right) = \frac{3}{2} x + \frac{3}{4}$

More generally you might seek to minimise the sum of the squares of the distances of the points from the line, or the squares of their $y$ offsets. The process of finding such a line of best fit is called linear regression.