How to find a line of best fit of the form $y=ax$? We have the following points:
$$ (0,0)(1,51.8)(1.9,101.3)(2.8,148.4)(3.7,201.5)(4.7,251.1)(5.6,302.3)(6.6,350.9)(7.5,397.1)(8.5,452.5)(9.3,496.3)$$
How can we find the best fitting line $y=ax$ through the points? My calculator has the option to find the best fitting line $y=ax+b$ through these points, which is:
$$y \approx 53,28x + 0.37$$
How can I find the best fiting $y=ax$? It seems to me we can't just remove the $0.37$ without compensating in the $a$?
 A: To find a best fit, you must first decide what you judge it by. A simple method would be, wanting the least ("vertical") distance from your predicted values. But because one usually doesn't care whether it's above or below it, the square of the distance is used. This is of course holds info about a single point only. So the sum of these can be used instead.
So that for example, if you wish to fit your $n$ data points of the format $(x_i,y_i)$ to a function $y'=ax$ - That is to every point $x_i$, you predict $a x_i$ and get $y_i$ instead. Therefore the above goodness function is described by
$$ f(a) = \sum_n (y_i - a x_i)^2$$
This is a function of your parameter $a$ and can be optimized for it:
$$\frac{df}{da} = 0 \Rightarrow \sum_n 2x_i(a x_i - y_i) = 0 \Rightarrow a = \frac{\sum_n x_i y_i}{\sum_n x_i^2}$$
Edit: Actually for this function, $y'=ax$, the distance to the line and the vertical distance are the same up to a constant factor, which leads to the same result. Lucky, I guess... =)
