# dimension of orthonormal set

Here is a question I am hoping a friendly person can clarify for me:

Consider the inner product space V with inner product $$\langle f,g \rangle = \frac1\pi\int_{-\pi}^\pi f(x)g(x)dx.$$ Let $B=[\frac{1}{\sqrt2},cos(x),cos(2x),...,cos(nx),sin(x),sin(2x),...,sin(nx)]$.

I proved that B is an orthonormal set.
I am wondering: is the dimension of the subspace $W=span(B)$ equal to n+1? I figured this might be correct because of the relationship between sinusoids.
Secondly, for the case n=1, how would I find the orthogonal projection of $f(x)=x$ in W?

-
If it is orthonormal, isn't the dimension the size of B which is $2n + 1$? –  Memming Nov 11 '12 at 17:59
If two elemtents of an innerproduct space are orthogonal, then they are linear independent. –  Stefan Nov 11 '12 at 18:01

the dimension is 1 constant + $n$ cosines + $n$ sines for $2n+1.$
There is no difficulty taking an orthogonal projection of a function $f$ given an orthonormal basis. Number your basis $g_1, g_2, \ldots, g_{2n+1}.$ The projection is just $$\sum_{i=1}^{2n+1} \; \langle f, g_i \rangle \; g_i$$ You have $f(x) = x.$ Each integral can be done with integration by parts, take $u = f, \; dv = g \, dx.$ I really would prefer you to do the integrals yourself.