[Math] Least squares approximation: Legendre polynomial

orthogonal-polynomials

Find the best quadratic least squares approximation to $f(x)=e^x$ on $[-1,1]$ with respect to the inner product $\langle f(x),g(x) \rangle = \displaystyle\int_{-1}^1 f(x)g(x)dx$.

I cannot figure out how to do this. Is there a good online resource for this? Unfortunately, I don't have a book for it.

Any tips/hints would be helpful.

Best Answer

You have to project $e^x$ on the vector space $P_2 = \{ ax^2+bx+c : a,b,c \in \mathbb{R} \}$.

Notice that a basis for $P_2$ is $1,x, x^2$. So you have to find $a,b,c \in \mathbb{R}$ such that $\langle e^x - (ax^2+bx+c), 1 \rangle = \langle e^x- (ax^2+bx+c), x \rangle = \langle e^x- (ax^2+bx+c), x^2 \rangle = 0$.

So you have three equations with three indeterminates $a,b,c$

$$ \int_{-1}^1 (e^x - (ax^2+bx+c)) \ dx=0 $$ $$ \int_{-1}^1 (e^x - (ax^2+bx+c))x \ dx=0 $$ $$ \int_{-1}^1 (e^x - (ax^2+bx+c))x^2 \ dx=0 $$

Getting $$ \left\{ \begin{matrix} -\frac{2}{3} a &&-2c &+e - \frac{1}{e} &=& 0 \\ & -\frac{2}{3} b && +\frac{2}{e} &=& 0 \\ -\frac{2}{5} a && -\frac{2}{3} c &+e - \frac{5}{e} &=& 0 \end{matrix} \right. $$