This is an exam question from a previous year that I have not been able to figure out. Any help would be greatly appreciated.
Given are the tuples (1,2),(2,1),(3,1) $$\varepsilon^{2} = \sum_{i=1}^{n} (y_i - a \cdot x_i)^{2}$$
For what value $a\in\mathbb{R}$ is $\varepsilon$ minimal.
My work so far:
$\varepsilon = q(a) = \sum_{i=1}^{n} \sqrt{(y_i - a \cdot x_i)^{2}}$
$q'(a) = \sum_{i=1}^{n} \frac{1}{2}((y_i-ax_i)^2)^{-\frac{1}{2}}\cdot 2(y_i-ax_i)\cdot(-x_i)$
$q'(a) = \sum_{i=1}^{n} \frac{(-x_iy_i+ax_i^2)}{(y_i-ax_i)^2}$
$q''(a) = \sum_{i=1}^{n} \frac{(x_i^2)(y_i-ax_i)^2-2(-x_iy_i+ax_i^2)(-x_iy_i+x_i^2)}{2(y_i-ax_i)^4}$
$q''(a) = \sum_{i=1}^{n} \frac{(x_i^2)(y_i^2 -2ax_iy_i+ax_i^2)-2(x_i^2y_i^2-ax_i^3y_i + ax_i^4 - x_i^3y_i)}{2(y_i-ax_i)^4}$
$q''(a) = \sum_{i=1}^{n} \frac{(x_i^2y_i^2 -2ax_i^3y_i+ax_i^4)-2x_i^2y_i^2+2ax_i^3y_i -2ax_i^4 + 2x_i^3y_i)}{2(y_i-ax_i)^4}$
$q''(a) = \sum_{i=1}^{n} \frac{x_i^2y_i^2 -2ax_i^3y_i+ax_i^4-2x_i^2y_i^2+2ax_i^3y_i -2ax_i^4 + 2x_i^3y_i)}{2(y_i-ax_i)^4}$
$q''(a) = \sum_{i=1}^{n} \frac{2x_i^3y_i-x_i^2y_i^2 -ax_i^4)}{2(y_i-ax_i)^4}$
At this point I would assume that $2x_i^3y_i < x_i^2y_i^2 + ax_i^4$ and therefore $q''(a)$ would be a monotonically falling function, thereby having no minimum. However, I don't know how to prove that other than to plug in the tuples.
Continuing on and trying to find the critical point:
$0 = \sum_{i=1}^{n} \frac{(-x_iy_i+ax_i^2)}{(y_i-ax_i)^2}$
$0 = \sum_{i=1}^{n} \frac{(-x_iy_i+ax_i^2)}{a^2x_i^2 + 2ax_iy_i + y_i^2}$
At this point I am at a loss as to how to factor out $a$.