In the real linear space [-1,1] with inner product $\int^1_{-1} f(x)g(x)\,dx$. Find the linear polynomial $g$ nearest to $f$ and find $||g -f||^2$ for this $g$.
My problem is that I simply don't know how to do this. All the examples that involve projections (maybe even Graham-Schmidt here?) were all vectors. So I don't know how to do this.
This is an easy question to answer once we have an orthonormal basis for the functions we're using to approximate $e^x$. In this case, we are approximating $e^x$ using linear polynomials.
That is, we'd like an orthonormal basis for the subspace (of all real functions on $[-1,1]$) spanned by $\{1,x\}$. Let's use the Graham-Schmidt process: $$ \|1\|_2 = \sqrt{\langle 1,1 \rangle} = \sqrt{\int_{-1}^1 (1)^2\,dx} = \sqrt{2}\\ u_1 = \frac{1}{\|1\|_2} = \frac 1{\sqrt 2} \\ \langle x, u_1 \rangle = \int_{-1}^1 x \cdot \frac{1}{\sqrt 2} dx = 0 \\ v_2 = x - \langle x, u_1 \rangle u_1 = \cdots $$ Can you take it from there? You should find $u_2 = x$, so that $\{\frac{1}{\sqrt 2}, \sqrt{\frac{3}{2}}x\}$ is an orthonormal basis. From there, we have $$ e^x \approx \langle e^x, u_1\rangle u_1 + \langle e^x, u_2\rangle u_2 $$