Finding the second-degree polynomial that is the best approximation for cos(x) So, I need to find the second-degree polynomial that is the best approximation for $f(x) = cos(x)$ in $L^2_w[a, b]$, where $w(x) = e^{-x}$, $a=0$, $b=\infty$.
"Best approximation" for f is a function $\hat{\varphi} \in \Phi$ such that:
$||f - \hat{\varphi}|| \le ||f - \varphi||,\; \forall \varphi \in \Phi$
I have several methods available:


*

*Lagrange interpolation

*Hermite interpolation


Which would be the most appropriate?

In your $L^2$ space the Laguerre polynomials form an orthonormal family, so if you use the polynomial
$$
P(x)=\sum_{i=0}^n a_i L_i(x),
$$
you will get the approximation error
$$
||P(x)-\cos x||^2=\sum_{i=0}^n(a_i-b_i)^2+\sum_{i>n}b_i^2,
$$
(Possibly you need to add a constant to account for the squared norm of the component of cosine, if any, that is orthogonal to all the polynomials. If the Laguerre polynomials form a complete orthonormal family, then this extra term is not needed. Anyway, having that extra term will not affect the solution of this problem.)
 where
$$
b_k=\langle L_k(x)|\cos x\rangle=\int_0^{\infty}L_k(x)\cos x e^{-x}\,dx.
$$
I recommend that you calculate $b_0$, $b_1$ and $b_2$, and then try and figure out how you should select the numbers $a_i$ to minimize the error and meet your degree constraint.
