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)\}$.
- Show $B$ is a orthonormal set
- What is the dimension of $W=\operatorname{span}B$?
- 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.
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).