Hi, I am currently looking through a few past paper questions and am having trouble with the following:

Find the Fourier series of the function f, with period 2*Pi, where:

f(x)={ 0 if -Pi<x<0
{ 1 if 0<x<Pi/2
{ -1 if Pi/2<x<Pi

By evaluating the Fourier Series at x=0, find an expression for Pi/4 as an infinite series.

So far, I have tried to work out the coefficients a(n) and b(n):

a0=0 (by evaluating the three integrals seperately).

a(n)=integral over 0, for -Pi<x<0, 1/Pi[1/n*sin(nx)] between 0<x<Pi/2 and 1/Pi[-1/n*sin(nx)] between Pi/2<x<Pi.

b(n)=integral over 0, for -Pi<x<0, 1/Pi[-1/n*cos(nx)] between 0<x<Pi/2 and 1/Pi[1/n*cos(nx)] between Pi/2<x<Pi.

Here is where I am stuck. I dont understand how to read the four integrals above. I was shown an example whereby if n was even, the coefficients were all zero and where n is odd, they werent. However, in this case, evaluating Pi/2 would involve looking at four different cases, 4k, 4K+1, 4k+2 and 4k+3, for k in Z. I was thinking too that maybe the Pi/2's would cancel each other out, and do this work for me. If they did, I would have a(n)=0, and b(n)=2/n*Pi for n odd, and 0 for n even. Is this correct?!?

Then, my fourier series would just be:

f(x)~ (2/Pi) * (sum from n=1 to infinity) 1/(2k+1)sin((2k+1)*x).

For the last part, do I just put x=0 into my expression, to give me:

0= (2/Pi) * (sum from n=1 to infinity) 1/(2k+1)sin((2k+1)*0)

But this is then just equal to zero, which leads me to think I have made a mistake in assuming that the Pi/2's cancel with one another above.

Any help would be appreciated on where I have gone wrong!