<s>[INST] Find best-fit parabola to the given data 
Find the parabola $At^2+Bt+C$ that best approximates the data set $t= -1,0,1,2,3$ and $b(t) = 5,2,1,2,5$.

Would I be using least squares such that $x = (A^TA)^{-1}A^Tb$? Thank you in advance.
 [/INST] Problem statement
Given a sequence of $m=5$ data points $\left\{ x_{k}, y_{k} \right\}_{k=1}^{m}$, and the trial function
$$
 y(x) = a_{0} + a_{1} x + a_{2} x^{2}.
$$
The linear system is
$$
\begin{align}
  \mathbf{A} a &= y\\
%
\left[
\begin{array}{rrr}
 1 & -1 & 1 \\
 1 & 0 & 0 \\
 1 & 1 & 1 \\
 1 & 2 & 4 \\
 1 & 3 & 9 \\
\end{array}
\right]
%
\left[
\begin{array}{rrr}
 a_{0} \\
 a_{1} \\
 a_{2} 
\end{array}
\right]
%
& =
%
\left[
\begin{array}{rrr}
 5 \\
 2 \\
 1 \\
 2 \\
 5 
\end{array}
\right]
%
\end{align}
$$
Solution via normal equations
The normal equations are
$$
\begin{align}
  \mathbf{A}^{*} \mathbf{A} a  & = \mathbf{A}^{*} y \\
%
\left[
\begin{array}{rrr}
 5 & 5 & 15 \\
 5 & 15 & 35 \\
 15 & 35 & 99 \\
\end{array}
\right]
%
\left[
\begin{array}{rrr}
 a_{0} \\
 a_{1} \\
 a_{2} 
\end{array}
\right]
%
&=
%
\left[
\begin{array}{rrr}
 15 \\
 15 \\
 59 
\end{array}
\right]
%
\end{align}
$$
The solution is 
$$
 \begin{align}
   a_{LS}  & = \left( \mathbf{A}^{*} \mathbf{A} \right)^{-1}
  \mathbf{A}^{*} y \\
%
&=
\frac{1}{70}
\left[
\begin{array}{rrr}
 26 & 3 & -5 \\
 3 & 27 & -10 \\
 -5 & -10 & 5 \\
\end{array}
\right]
%
\left[
\begin{array}{rrr}
 15 \\
 15 \\
 59 
\end{array}
\right] \\
%
&=
%
\left[
\begin{array}{rrr}
  2 \\
 -2 \\
  1 
\end{array}
\right],
%
\end{align}
$$
$$
  y(x) = 2 -2x + x^{2}.
$$
This is an exact fit because 
$$
r^{2} = 
\left( \mathbf{A} a_{LS} - b \right)^{*}
\left( \mathbf{A} a_{LS} - b \right) = 0.
$$
The plot shows the solution against the data points.

</s>