Let $$F(a,b) = \sum_{i=1}^n \left[ y_i - (ax_i+b) \right]^2$$
Find the minimum of $F$.
Evaluating the dirctional derivatives:
$$\frac{dF}{da} = \sum_{n=1}^n 2\cdot (y_i - (ax_i+b))(-x_i) \\ \frac{dF}{db} = \sum_{n=1}^n 2\cdot (y_i - (ax_i+b))$$
Now, we want $\nabla F = (\frac{dF}{da}, \frac{dF}{db}) = (0,0)$.
So we have (after some algebra):
$$ \sum_{n=1}^n y_i = \sum_{n=1}^n (ax_i+b)(-x_i) \\ \sum_{n=1}^n y_i = \sum_{n=1}^n ax_i+b$$
So far so good? How should I continue? (this two equations relatively complicated)