# Finding the Fourier series of a function.

1. Dec 7, 2011

### bubokribuck

1. The problem statement, all variables and given/known data
f(x)=
-cos(x) when -π<x<0
cos(x) when 0<x<π

Decide if f is an even, odd function or either.
Find the Fourier series of f.

2. Relevant equations

odd function: f(x)=f(-x)
even function: -f(x)=f(-x) or f(x)=-f(-x)

3. The attempt at a solution

substitute -x into either cos(x) or -cos(x) => -cos(x)=-cos(-x) and cos(x)=cos(-x),
therefore, f is an even function.

However, I'm stuck when it comes to finding the Fourier series.

I know how to solve a0, where I just need to find the integration of -cos(x)dx and cos(x)dx. To find an and bn, I need to find the integration of [-cos(x)cos(nx)dx], [cos(x)cos(nx)dx], [-cos(x)sin(nx)] and [cos(x)sin(nx)dx]. I tried to solve them using integration by parts, but it turned out to be infinitely expanding, so I guess integration by parts won't work. Is there any other way to integrate the above four functions?

2. Dec 7, 2011

### Ray Vickson

Your definitions of "even" and "odd" are the exact opposite of everybody else's in the world.

RGV

3. Dec 7, 2011

### LCKurtz

You need the product formulas:

http://www.sosmath.com/trig/prodform/prodform.html

4. Dec 7, 2011

### bubokribuck

I just typed it wrong but they wouldn't let me edit it. :(

5. Dec 7, 2011