1. Projections

I am trying to find the projection of a function onto a space spanned by
{1, sinx, cosx} on the interval $\displaystyle [\pi, -\pi]$ This is equal to the first 3 terms of the fourier expansion of f(x)

The function is $\displaystyle f(x) = x^{2} + x$

I found the first term of the fourier expansion to be:
a0 = $\displaystyle \frac{\pi^{2}}{3}$

Im not to sure on calculating the 2nd term...

can i use a1 =
$\displaystyle \frac{1}{\pi}\int_{-\pi}^{\pi}f(x) cosxdx$?

or should i use
a1 = $\displaystyle \frac{1}{\pi}\int_{-\pi}^{\pi}f(x) sinxdx$? because sinx is the 2nd term of the span..

Im fine with the integration itself, its just the formula...

sorry if question is badly constructed, am still in early days of using laTex

2. Hi,

It really doesn't matter because addition is commutative! You could order the terms however you wanted. Just normalise $\displaystyle 1,\sin x, \cos x$ to get an orthonormal basis $\displaystyle \{e_{1},e_{2},e_{3}\}$ for $\displaystyle \text{span}\{1,\sin x, \cos x\}$. Then you can calculate the projection $\displaystyle P:C[-\pi,\pi] \rightarrow \text{span}\{1,\sin x, \cos x\}$ by

$\displaystyle Pf(x) = \sum_{i=1}^{3} \langle f,e_{i} \rangle e_{i}$,

where $\displaystyle \langle f,g \rangle = \int^{\pi}_{-\pi}f(x)g(x)dx$.

The point is, it doesn't matter how you label the $\displaystyle e_{i}$, the sum is still the same.