<s>[INST] Minimizing the error for a second degree interpolating polynomial 
Construct the second degree polynomial $q_2(t)$ that approximates $g(t) = \sin(\pi t)$ on the interval [0,1] by minimizing
  $$\int_0^1 [g(t) - q_2(t)]^2dt$$
  A useful integral: $\int_0^1 (6t^2-6t+1)^2dt=\frac{1}{5}$

My attempt:
We Know $q_2(t)$ will come in the form of $q_2(t) = zt^2 + yt + x$.
First we can expand $[g(t) - q_2(t)]^2dt$ and get the integral
$$\int_0^1 g^2(t)-2q_2(t)g(t)+q_2^2(t)dt$$
$$\rightarrow \int_0^1 \sin^2(\pi t)-2\sin(\pi t)(zt^2+yt+x)+(zt^2+yt+x)^2dt$$
$$\rightarrow \frac{1}{2}-\frac{4x}{\pi}-\frac{2y}{\pi}-\frac{2z(\pi^2-4)}{\pi^3}+\int_0^1 (zt^2+yt+x)^2dt$$
I am having difficulty utilizing the hint to handle $\int_0^1 (zt^2+yt+x)^2dt$. Is the hint implying that the the second degree polynomial $q_2(t)$ is equal to $6t^2-6t+1$? My big picture goal of this problem was to find $x,y,z$ such that the integral is minimized by expanding and solving the integral and then solving for $x,y,z$. What am I missing, or what am I doing wrong? Thank you!
 [/INST] I do not see why the hint was even given since
$$I=\int_0^1 (zt^2+yt+x)^2\,dt=\int_0^1 (x^2+2  x yt+ \left(2 x z+y^2\right)t^2+2 y z t^3+ z^2 t^4)\,dt$$ that is to say
$$I=x^2+x y+\frac{2 x z}{3}+\frac{y^2}{3}+\frac{y z}{2}+\frac{z^2}{5}$$ So, for the total
$$R=\frac{1}{2}-\frac{4x}{\pi}-\frac{2y}{\pi}-\frac{2z(\pi^2-4)}{\pi^3}+x^2+x y+\frac{2 x z}{3}+\frac{y^2}{3}+\frac{y z}{2}+\frac{z^2}{5}$$ Computing the partial derivatives
$$\frac{\partial R}{\partial x}=2 x+y+\frac{2 z}{3}-\frac{4}{\pi }=0$$
$$\frac{\partial R}{\partial y}=x+\frac{2 y}{3}+\frac{z}{2}-\frac{2}{\pi }=0$$
$$\frac{\partial R}{\partial z}=\frac{2 x}{3}+\frac{y}{2}+\frac{2 z}{5}-\frac{2 \left(\pi ^2-4\right)}{\pi ^3}=0$$
Solving for $(x,y,z)$
$$x=\frac{12 \left(\pi ^2-10\right)}{\pi ^3} \qquad y=\frac{60 \left(12-\pi^2\right)}{\pi ^3}\qquad z=\frac{60 \left(\pi ^2-12\right)}{\pi ^3}$$ and, for these values,
$$R=\frac{1}{2}-\frac{24 \left(120-20 \pi ^2+\pi ^4\right)}{\pi ^6}\approx 3 \times 10^{-4}$$
</s>