# 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.

• Do you know the standard inner product on $C[-2,2]$? – user251257 Mar 13 '16 at 15:52
• I was given $(f,g):=\int_{-2}^2 f(t)g(t)dt$ and to determine the real numbers of c for which 3x was orthogonal to x+2c and I already determined that there there was no such c via calculation of the problem @user251257 – user316861 Mar 13 '16 at 16:11

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$.

• This is great, but for some reason I thought I needed to use the grahm-schmidt process on this? @user35603 – user316861 Mar 13 '16 at 17:01
• this is great. Two different ways to approach one single problem. I really appreciate a very precise answer and explanation – user316861 Mar 13 '16 at 17:07
• @user316861 Do you know how to perform Grahm-Schmidt Process in this situation? – user35603 Mar 13 '16 at 17:09
• I honestly don't but I was just going to try to look it up and figure it out. I didn't want to keep bothering you with questions. I'm not very strong the ways of the Grahm-Schmidt process @user35603 – user316861 Mar 13 '16 at 17:11
• @user316861 Basically, it's the same as for vectors from $\mathbb{R}^n$, you simply replace the standard dot product by the inner product with integral. – user35603 Mar 13 '16 at 17:18