# Calculating fourier Series

1. Dec 5, 2011

### Studious_stud

1. The problem statement, all variables and given/known data

2. Relevant equations
Equations to compute fourier series given in question

3. The attempt at a solution

Ok so I've just done this problem and I'm having some trouble computing the fourier series of $x^{2}$ between -∏ < ∏

So first I calculate $a_{0}$ and that turns out to be $\frac{∏^{2}}{3}$, which according to wolfram is right.

Next $a_{n}$, which is the one I'm having trouble with. Essentially you have to do integration by parts twice (right?) and I end up getting something quite messy, as does wolfram

http://www.wolframalpha.com/input/?i=integrate+x^2+cos+%28n+x%29+dx+from+x%3D-pi+to+pi

Is there any way to clean this up for when I plug $a_{n}$ into the final formula?

$b_{n}$ is 0 obviously so there's no issue there (since it's an even function times an odd function).

1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

2. Dec 5, 2011

### vela

Staff Emeritus
You should find it simplifies down to $a_n = (-1)^n\frac{4}{n^2}$. Since you know n is an integer, you should find some terms vanish, etc.

You can get the answer from Wolfram Alpha by entering "FourierTrigSeries[x^2, x, 10]".

3. Dec 5, 2011

### Studious_stud

Thanks for the response.

So let me get this right... $cosn∏ = (-1)^n$ and $sinn∏ = (-1)^n$?

Sorry still a bit confused!

4. Dec 5, 2011

### vela

Staff Emeritus
Not quite. You might want to take a look at a plot of the trig functions.

5. Dec 5, 2011

### Studious_stud

Whoops, meant to say $sinn∏=0$, is this correct?

6. Dec 5, 2011

### vela

Staff Emeritus
Yes, that's right.