Answer Check: Best Approximation of $(x+1)e^{-x}$ using Legendre Polynomials

68 Views Asked by At

I have worked through and produced an answer for the following question but am unsure of whether or not it is correct. I would appreciate some insight.

$\textbf{Question}$:

Using the Gram-Schmidt orthonormalization process on the basis {${1,x,x^2}$} on $[-1,1]$, find the best approximation $s^* \in S$ of the function $f(x) = (1+x)e^{-x}$, $x \in [-1,1]$ in $S =$ span{${1,x,x^2}$}

$\textbf{My attempt}$:

For the first part, I had found that after the Gram-Schmidt orthonormalization process, the first three normalized Legendre Polynomials are given by

$$P_0 = \frac{\sqrt{2}}{2},\hspace{1cm} P_1 = \frac{\sqrt{6}}{2}x,\hspace{1cm} P_2 = \frac{\sqrt{10}}{4}(3x^2-1)$$

So, we have $S = $ span{${1,x,x^2}$} $=$ span{${\frac{\sqrt{2}}{2},\frac{\sqrt{6}}{2}x,\frac{\sqrt{10}}{4}(3x^2-1)}$}

For the second part of the question, we need to use the orthogonal projector $\hat{P}_{s}$ on $f(x)$ given as $$s^* = \hat{P}_{s}f(x) = \sum_{i=0}^{2} \langle f,P_{i}(x) \rangle P_i(x)$$

where $\langle f,P_{i}(x) \rangle$ is given by $$\langle f,P_{i}(x) \rangle = \int_{-1}^{1} f(x)P_{i}(x)dx, \hspace{1cm} i = 0,1,2$$

So, we have \begin{align*} \langle f,P_{0}(x) \rangle &= \frac{1}{\sqrt{2}}(e-3e^{-1})\\ \langle f,P_{1}(x) \rangle &= \frac{\sqrt{6}}{2}(e-7e^{-1})\\ \langle f,P_{2}(x) \rangle &= \sqrt{10}(2e-15e^{-1}) \end{align*}

Finally, substituting this in and simplifying, we get the best approximation $$s^* = \frac{(30e^{2}-225)x^{2} + (3e^{2}-21)x - (9e^{2}-72)}{2e}$$

Thank you for your help

1

There are 1 best solutions below

3
On BEST ANSWER

I checked the projection with Mathematica – there was a sign error in your initial answer which you corrected, but now it is all correct.

I obtained the projection as $$\frac{e^2-3}{2e}+\frac{3(e^2-7)}{2e}x+\frac{5(2e^2-15)}{2e}(3x^2-1)$$ $$=\frac1{2e}(9(8-e^2)+3(-7+e^2)x+15(2e^2-15)x^2$$ Plotting the approximated and actual curves is a good way to check the projection.