I would like to understand more about the Least Squares, but it remains unclear to me, where these equations come from.
for a linear approximation $y=ax+b$
$a=\frac{m\sum_{i=1}^{m} x_iy_i-(\sum_{i=1}^{m}x_i)(\sum_{i=1}^{m}y_i)} {m\sum_{i=1}^{m}x_i^2 - (\sum_{i=1}^{m}x_i)^2}$
and
$b = \frac{(\sum_{i=1}^{m}x_i^2)(\sum_{i=1}^{m}y_i)-(\sum_{i=1}^{m}x_iy_i)(\sum_{i=1}^{m}x_i)}{m\sum_{i=1}^{m}x_i^2 - (\sum_{i=1}^{m}x_i)^2}$
What I have tried so far:
In the least squares method, the quadratic error should be minimized.
This means
$E(a,b)=\sum_{i=1}^{m}[y_i-(ax_i+b)]^2$
should be minimal.
For a minimum to exist, the partial derivatives of this expression must be zero.
$\frac{\partial{E}}{\partial{a}}$ = $2 \sum_{i=1}^{m}[y_i-(ax_i+b)]\hspace{2pt}(-x_i)=0$
$\frac{\partial{E}}{\partial{b}}$ = $2 \sum_{i=1}^{m}[y_i-(ax_i+b)]\hspace{2pt}(-1)=0$
Rearranging these, yields the following:
$a\sum_{i=1}^{m}x_i^2 + b\sum_{i=1}^{m}x_i = \sum_{i=1}^{m}x_iy_i$
$a\sum_{i=1}^{m}x_i+bm = \sum_{i=1}^{m}y_i$
This is where I'm stuck. I see the terms $x_iy_i$, etc. that also appear in the expressions in question - but I don't know how to rearrange to get there.