Find best approximation of $\sin(\pi x)$ over $[0,1]$ with quadratic polynomial $a_0+a_1x+a_2x^2$ Use the theory of orthogonal functions to find best in the mean approximation of the function $\sin(πx)$ on the interval $[0,1]$ by a second-order polynomial
That is, find such coefficients $a_0, a_1$ and $a_2$ that,
$$\int^1_0 (\sin(\pi x)-a_0-a_1x-a_2x^2)^2 \, dx, $$
takes a minimal possible value.
I feel as though this has something to do with Fourier series but I really cant be sure because I am not very familiar with this area.
Also, I'm not sure what "best in mean approximation" means, so any help with that would be great.
 A: Your problem is equivalent of finding the projection of $f : \rightarrow \sin(\pi x) $ on the vectorial space $F\triangleq \operatorname{Vect}(1,\mathrm{Id},\mathrm{Id}^2)=R_2[X]$ and calculating the distance of $f$ to $F$
In order to do this decompose the projection of $f$ which is 
$$ P_F(f) = a_0 + a_1X+ a_2X^2 $$
On the normalized base relatively to your scalar product (you have to Schmidt the canonical of $\mathbb{R}_2[X]$ relatively to your scalar product).
And find the coefficient of $P_F(f) $ in your Schmited basis, those are consequently linked to your $a_0,a_1,a_2$

Once you find it, compute
$$d(f, F)^2=\|f-P_F(f)\|^2$$
which is your integral squared, minimized by the definition of the projection.
Furthermore, 
We call mean approximation because it is an average made through an integral (which plays the role of "continuous" averages when we need it instead of summing, here your interval has a mesure of $1$ so it is an average (sum divided by the amplitude of number we take) 
Don't hesitate if you need precision. 
A: \begin{align}
\int^1_0 ( & \sin(\pi x)-a_0-a_1x-a_2x^2)^2 \, dx, \\[8pt]
= \int_0^1 \Big( & \sin^2(\pi x) \,dx + a_0^2 + a_1^2 x^2 + a_2^2 x^4 \\
& {}-2a_0\sin(\pi x) - 2a_1x\sin(\pi x) - 2a_2x^2 \sin (\pi x) \\
& {} -{}2a_0a_1 x -2a_0a_2x^2 -2a_1a_2 x^2 \Big) \, dx \\[10pt]
= {} & \int_0^1 \sin ^2(\pi x)\, dx + a_0^2 \int_0^1 1\,dx + a_1^2 \int_0^2x^2\, dx + a_2^2\int_0^1 x^2\,dx \\[10pt]
& {} - 2a_0 \int_0^1\sin(\pi x)\,dx - 2a_1 \int_0^1 x\sin(\pi x)\,dx - 2a_2 \int_0^1 x^2 \sin(\pi x)\,dx \\[10pt]
& {} - 2a_0a_1 \int_0^1 x\,dx -2a_0a_2 \int_0^1 x^2\, dx - 2a_1 a_2 \int_0^1 x^2 \, dx \\[12pt]
= {} & B_0 + B_1a_0^2 + B_2a_1^2 + B_3 a_2^2 - 2B_4 a_0 - 2B_5 a_1 -2B_6 a_2 \\
& {} -2B_7 a_0 a_1 - 2B_8 a_0 a_2 - 2B_9 a_1 a_2.  
\end{align}
So you have a quadratic polynomial in three variables and the problem is to find the values of the variables that minimize the value of the polynomial.
A: Note that $x \mapsto x^k$, $k=0,1,...$ is a Schauder basis for $L^2[0,1]$. If we use, say, Gram Schmidt to orthonormalise these to get $e_k$ then we know that
for any $f \in L^2[0,1]$, we have
$f = \sum_{k=0}^n \langle e_k, f \rangle e_k$ (in an $L^2$ sense). Furthermore, the best approximation to $f$ in an $L^2$ sense in the subspace spanned by $e_0,...,e_n$ is given by $\sum_{k=0}^n \langle e_k, f \rangle e_k$.
So, with $\langle f,g \rangle = \int_0^1 f(x),g(x) dx $, we get
$e_0(x) = 1$, $e_1(x)=2 \sqrt{3}(x-{1 \over 2})$,
$e_2(x) = 6 \sqrt{5}(x^2-x+{1 \over 6})$. (These are the normalised shifted Legendre polynomials.)
With $f(x) = \sin ( \pi x)$, we get
$\langle e_0, f \rangle = {2 \over \pi}$,
$\langle e_1, f \rangle = 0$,
$\langle e_2, f \rangle = {2 \sqrt{5} \over \pi^3} (\pi^2-12)$,
and so the best $L^2$ approximation is
$\sum_{k=0}^2 \langle e_k, f \rangle e_k(x) = {( 60 {{\pi }^{2}}-720 ){{x}^{2}} +( 720-60{{\pi }^{2}} ) x -120+12 {\pi^{2}} \over {{\pi }^{3}}}$.
A: Take the advantage of the symmetry to express  
$$\sin(\pi x) = p+ q\>(\frac12-t)^2$$
Minimize  
\begin{align}
f(p,q)&= \int_0^{\frac12} [p+ q\>(\frac12-x)^2 - \sin(\pi x)]^2dt\\
& =\frac12p^2 + \frac1{12} pq  +\frac1{160}q^2-\frac2\pi p+\frac{8-\pi^2 }{2\pi^3}q+\frac14
\end{align}
by setting 
$$f_p’=p+\frac1{12}q-\frac2\pi=0,\>\>\>
f_q’=\frac1{12}p+\frac1{80}q+ \frac{8-\pi^2 }{2\pi^3} =0
$$
to obtain the optimal coefficients $p= \frac{60-3\pi^2 }{\pi^3},\> q= \frac{60(\pi^2 -12)}{\pi^3}$. Thus,
$$\sin(\pi x) =  \frac{60-3\pi^2 }{\pi^3}+\frac{60(\pi^2 -12)}{\pi^3}\left(\frac12-x\right)^2$$
as shown in the plots below

