$$P_0(x)=1$$ $$P_1(x)=x$$ $$P_2(x)=2x^2-1$$ $$P_3(x)=4x^3-3x$$
$$R(x)=a_0P_0(x)+a_1P_1(x)+a_2P_2(x)+a_3P_3(x)$$ $f(x)$ is an arbitrary real function bounded on [-1,1].
How can I find the $a_3$ expressed by only $P_3(x)$ and $f(x)$ that minimize the following definite integral? $$\int_{-1}^{1}\left[f(x)-R(x)\right]^2\frac{1}{\sqrt{1-x^2}}dx$$
I have known that if let $x=\cos\theta$ then $P_n(x)=\cos n\theta$, and I've calculated that$\int_{-1}^{1}R^2(x)\frac{1}{\sqrt{1-x^2}}dx = a_0^2\pi+0.5a_1^2\pi+0.5a_2^2\pi+0.5a_3^2\pi$.
So I tried to expand the target integral and took its derivative to $a_3$, letting the result equal to $0$. Finally, I got this equation $a_3 = \frac{2}{\pi}\int_{-1}^{1}f(x)P_3(x)\frac{1}{\sqrt{1-x^2}}dx$. I still cannot get rid of $\frac{1}{\sqrt{1-x^2}}$ and the integral sign.
Hope someone can help me, thanks in advance.