Problem Find a parabola ($f(x)=ax^2+bx+c$) that approximate the function sine the best on interval [0,$\pi$].
The distance between two solutions is calculated this way (in relation to scalar product): $\langle u,v \rangle=\int_0^\pi fg$.
My (wrong) solution I thought that I would get the solution by calculating the orthogonal projection $w=a+bx+cx^2$ of $v=\sin x$ on subspace $W=\langle u_1,u_2,u_3 \rangle=\langle 1,x,x^2\rangle$ using Gramm matrix. Then I have $$\begin{pmatrix}\langle u_1, u_1\rangle&\langle u_1, u_2\rangle&\langle u_1, u_3\rangle\\ \langle u_2, u_1\rangle&\langle u_2, u_2\rangle&\langle u_2, u_3\rangle\\ \langle u_3, u_1\rangle&\langle u_3, u_2\rangle& \langle u_3, u_3\rangle\end{pmatrix} \begin{pmatrix} a\\b\\c\end{pmatrix}= \begin{pmatrix} \langle u_1, v\rangle\\ \langle u_2,v\rangle\\ \langle u_3, v\rangle \end{pmatrix}$$ So then $$\begin{pmatrix} \int_0^\pi 1&\int_0^\pi x&\int_0^\pi x^2\\ \int_0^\pi x& \int_0^\pi x^2& \int_0^\pi x^3 \\ \int_0^\pi x^2&\int_0^\pi x^3&\int_0^\pi x^4\end{pmatrix}\begin{pmatrix} a\\b\\c\end{pmatrix}=\begin{pmatrix} \int_0^\pi \sin x\\\int_0^\pi x\sin x\\\int_0^\pi x^2 \sin x \end{pmatrix}$$ But solving these equations didn't give me any good answer. So my question is - is my way of solving it completely wrong (if so, can you give me hints how to do it otherwise)?
Thank you
Edit Then$$ \begin{pmatrix} \pi&\frac{\pi^2}{2}&\frac{\pi^3}{3}\\ \frac{\pi^2}{2}&\frac{\pi^3}{3}&\frac{\pi^4}{4}\\ \frac{\pi^3}{3}&\frac{\pi^4}{4}&\frac{\pi^5}{5}\end{pmatrix}\begin{pmatrix} a\\b\\c\end{pmatrix}=\begin{pmatrix} 2\\\pi\\\pi^2-4 \end{pmatrix}$$ $$ \begin{pmatrix} \pi&\frac{\pi^2}{2}&\frac{\pi^3}{3}\\ 0&\frac{\pi^3}{12}&\frac{\pi^4}{12}\\ 0&\frac{\pi^4}{12}&\frac{4\pi^5}{45}\end{pmatrix}\begin{pmatrix} a\\b\\c\end{pmatrix}=\begin{pmatrix} 2\\0\\\frac{1}{3}\pi^2-4 \end{pmatrix}$$ $$ \begin{pmatrix} \pi&\frac{\pi^2}{2}&\frac{\pi^3}{3}\\ 0&\frac{\pi^3}{12}&\frac{\pi^4}{12}\\ 0&0&\frac{\pi^5}{180}\end{pmatrix}\begin{pmatrix} a\\b\\c\end{pmatrix}=\begin{pmatrix} 2\\0\\\frac{1}{3}\pi^2-4 \end{pmatrix}$$ Edit II My way (I have found the mistake I did) will get the result $$f(x)=\dfrac{60(\pi^2-12)}{\pi^5}x^2-\dfrac{60(\pi^2-12)}{\pi^4}x+\dfrac{12(\pi^2-10)}{\pi^3}$$ which I hope is the right answer with error approx. $0,000936$