Orthogonal Projection of a function If $C[-2,2]$, let $W:= span\{x,e^x\}.$ 
How would I go about figuring out the orthogonal projection of $x+1$ on $W$?
encountered this problem and it really has me stumped. I was told that the Grahm-Schmidt Process is the correct route but am a bit confused on how to even go about that with this type of problem. 
 A: 1. Not using Grahm-Schmidt Process:
Let $g(x)$ be the orthogonal projection of $f(x)=x+1$ on $W$. Since $g \in W$ then $g(x) = c_1x+c_2e^x$ for some $c_1,c_2 \in\mathbb{R}$. Then $f(x)-g(x)$ is orthogonal to $W$. So, $f(x)-g(x)$ is orthogonal to $x$ and to $e^x$. In other words,
$$
  \left\{
  \begin{array}{l}
  \int\limits_{-2}^2(x+1 - c_1x - c_2e^x)x{\text d}x = 0,\\
  \int\limits_{-2}^2(x+1 - c_1x - c_2e^x)e^x{\text d}x = 0.
  \end{array}
  \right.
$$
2. Using Grahm-Schmidt Process:
1) Using Grahm-Schmidt Process find an orthonormal base of $\text{span}\{x, e^x\}$.
2) Suppose $g_1(x),g_2(x)$ are the new base vectors (that are orthogonal and normal). Then the projection $g(x)=c_1g_1(x)+c_2g_2(x)$, where 
$$c_1 = \int\limits_{-2}^2 f(x)g_1(x){\text d}x \qquad\text{and}\qquad c_2 = \int\limits_{-2}^2 f(x)g_2(x){\text d}x$$
Grahm-Schmidt Process:
a) $g_1(x) = x$.
b) $g_2(x) = k g_1(x) + e^x$. Now, since $\langle g_1, g_2 \rangle$ should be $0$, we can find 
$$k=-\frac{\langle e^x, g_1 \rangle}{\langle g_1, g_1 \rangle}=-\frac{\int_{-2}^2 xe^x \text{d}x}{\int_{-2}^2 x^2 \text{d}x}.$$
And don't forget to normalize $g_1$ and $g_2$.
