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.
Let $X$ be the inner product space in question. Note $\dim P_2 =3$. The problem is $\min_{p \in P_2} \|p-\exp\|^2$.
Note that the minimum exists by a compactness argument because $P_2$ is finite dimensional and $\|p-\exp\| \ge \|p\|-\|\exp\|$, hence has a solution $\hat{p} \in P_2$.
It follows that $(\hat{p}-\exp) \bot P_2$ (and hence that $\hat{p}$ is unique by Pythagoras).
In other words, you need to find the $\hat{p}$ that solves $\langle \hat{p}-\exp, p \rangle = 0$ for all $p \in P_2$.
Note that if $b_0,b_1,b_2$ is any basis of $P_2$, this reduces to solving $\langle \hat{p}-\exp, b_k \rangle = 0$, or $\langle \hat{p}, b_k \rangle = \langle \exp, b_k \rangle $.
Since $\hat{p} \in P_2$, we can write $\hat{p} = \sum_i \pi_i b_i $ for some constants $\pi_i$, so the problem reduces to solving $\sum_i \pi_i \langle b_i, b_k \rangle = \langle \exp, b_k \rangle $.
If the $b_k$ are orthogonal, the solution is immediate, otherwise this reduces to solving a $3 \times 3$ system of equations.
The Legendre polynomials $P_k$ are orthogonal, hence letting $b_k =P_k$, we obtain $\pi_k = { \langle \exp, P_k \rangle \over \|P_k\|^2 }$.