Find the parabola of the form $y=ax^2+b$ which best fits the points $(1,0), (4,4), (5,8)$ by minimizing the sum of squares, $S$, given by
$$S=(a+b)^2 + (16a+b−4)^2 + (25a+b−8)^2$$
My work so far
The variables are a and b, so we set
$$\frac{∂S}{∂a}=2(a+b)+32(16a+b−4)+50(25a+b−8)=0$$
and
$$\frac{∂S}{∂b}=2(a+b)+2(16a+b−4)+2(25a+b−8)=0.$$
Collecting terms, we get
$$1764a+84b−528=0$$
and
$$84a+6b−24 = 0,$$
At this point, I'm stuck. I checked the solution in the textbook, but was unsure how they were calculated. What would be the first step? Would it be using the least squares approximation?
Solution
and solving for a and b gives
$$a=\frac{16}{49}$$
and
$$b=\frac{-4}{7}$$
Since there is only one critical point and S is unbounded as $a,b → ∞$, this critical point is the global minimum. Therefore, the best fitting parabola is
$$y=\frac{16}{49}$$
and
$$x=\frac{-4}{7}$$
 A: Given set of $n$ points $(x_i,y_y)$, $i=1,\dots,n$,
the parameters of the best fit parabola $y(x)=a_2x^2+a_1 x+a0$
can be found as:
\begin{align} 
\begin{bmatrix}
a_0 \\ a_1 \\ a_2
\end{bmatrix}
&=
\begin{bmatrix}
n       & s_x     & s_{x^2}\\
s_x     & s_{x^2} & s_{x^3}\\
s_{x^2} & s_{x^3} & s_{x^4}
\end{bmatrix}
^{-1}
\cdot
\begin{bmatrix}
s_y \\ s_{xy} \\ s_{x^2y}
\end{bmatrix}
.
\end{align}
where
\begin{align} 
s_{x}&=\sum_{i=1}^n x_i
,\quad
s_{x^2}=\sum_{i=1}^n x_i^2
,\quad
s_{x^3}=\sum_{i=1}^n x_i^3
,\quad
s_{x^4}=\sum_{i=1}^n x_i^4
,\\
s_{y}&=\sum_{i=1}^n y_i
,\quad
s_{xy}=\sum_{i=1}^n x_i y_i
,\quad
s_{x^2y}=\sum_{i=1}^n x_i^2y_i
.
\end{align}
For the set of three points $(1,0),(4,4),(5,8)$,
$a_0=\tfrac43$,
$a_1=-2$,
$a_2=\tfrac23$.

In a special case where the parameter $a_1$ is forsd to be zero,
the solution simplifies
by eliminating all corresponding items
to
\begin{align} 
\begin{bmatrix}
a_0 \\ a_2
\end{bmatrix}
&=
\begin{bmatrix}
n       & s_{x^2}\\
s_{x^2} & s_{x^4}
\end{bmatrix}
^{-1}
\cdot
\begin{bmatrix}
s_y \\ s_{x^2y}
\end{bmatrix}
.
\end{align}
For the set of three points $(1,0),(4,4),(5,8)$,
we have $n=3$,
$x=[1,4,5]^{\mathsf{T}}$,
$y=[0,4,8]^{\mathsf{T}}$,
$s_{x^2}=42$,
$s_{x^4}=882$,
$s_{y}=12$,
$s_{x^2y}=264$,
and
\begin{align} 
\begin{bmatrix}
a_0 \\ a_2
\end{bmatrix}
&=
\begin{bmatrix}
3       & 42 \\
42 & 882
\end{bmatrix}
^{-1}
\cdot
\begin{bmatrix}
12 \\ 264
\end{bmatrix}
\\
&=
\begin{bmatrix}
1       & -1/21 \\
-1/21 & 1/294
\end{bmatrix}
\cdot
\begin{bmatrix}
12 \\ 264
\end{bmatrix}
=
\begin{bmatrix}
-4/7  \\ 16/49
\end{bmatrix}
,
\end{align}
so
$a_0=-\tfrac47$,
$a_2=\tfrac{16}{49}$
and
\begin{align} 
y(x)&=\tfrac{16}{49}\,x^2-\tfrac47
.
\end{align}

