# Questions on Inner Product Space with Trig

Let $V=C[-\pi,\pi]$ and define $\displaystyle \langle f,g\rangle:=\frac{1}{\pi}\int_{-\pi}^\pi f(x)g(x)\,dx$.

Let $B:=\{1/\sqrt2,\cos(x),\dotsc,\cos(nx),\sin(x),\dotsc,\sin(nx)\}$.

1. Show $B$ is a orthonormal set
2. What is the dimension of $W=\operatorname{span}B$?
3. For case $n=1$, find orthogonal projection of $f(x)=x$ in $W$ and compute $\min\{\|x-p(x)\|:p\in W\}$

For 1, I can do the following:

\begin{align} \frac{1}{\pi}\int_{-\pi}^\pi\cos(nx)\sin(nx)\,dx &= \frac{1}{2\pi}\int_{-\pi}^\pi\sin(nx+nx)-\sin(nx-nx)\,dx \\ &= \frac{1}{2\pi}\int_{-\pi}^\pi\sin(2nx)-\sin(0)\,dx \\ &= \frac{1}{2\pi}\int_{-\pi}^\pi\sin(2nx)\,dx=0. \end{align}

But I'm a bit confused as to what to do with that lingering $\frac{1}{\sqrt2}$.

For 2, wouldn't the dimension simply be three?

For 3, I think I could get the explicit form of the projection, but to get the '$\min$,' I'm not quite sure.

-
Please examine the edits I made to your question carefully. I've tried to make them as close to "proper MathJax+Markdown style" as possible. –  kahen Nov 22 '12 at 19:49

For 1, you are correctly proving that $\sin(nx)$ is orthogonal to $\cos(nx)$. That's part of what you have to prove, but you have to prove that any two guys on this list are orthogonal. You also have to check that the inner product of any guy on this list with itself is 1.
For 2, no. Since $B$ is an orthonormal set, its elements are linearly independent, so the dimension is the number of elements in $B$, which is $2n + 1$.
For 3, to find your min, express a generic element of $W$ as $v = a\frac{1}{\sqrt{2}} + b\sin(x) + c\cos(x)$ and compute $\langle v - x, v - x \rangle$; that's a quadratic function of $a$, $b$, and $c$ which you are trying to minimize (really you're trying to minimize it's square root).
I get $\frac{2}{3}\pi^2 - 3$ (for the square of the distance), achieved when $a = c = 0$ and $b = 1$. It shouldn't be 0, that would say that $x$ is in the span of these other three functions, which is false. –  user29743 Nov 12 '12 at 16:18
but I may have made an error. The computation is less involved if you use $\langle v - x, v - x \rangle = a^2 + b^2 + c^2 - 2\langle v, x\rangle + \langle x, x \rangle$ –  user29743 Nov 12 '12 at 16:19