Fourier Series Basics Problem

Hello,

I am learning to calculate fourier series, but am having difficulty with this basic problem. The problem is to find the fourier series for the given function (extended periodically in this case for the sine series only)

*please excuse notation...sorry

f(x)={ x , 0<x<1

1 , 1<x<2

This function is then extended periodically to have a period of 4, with L = 2. when calculating the b_n fourier coefficients I am using the form:

b_n = (1/2) ∫ f(x)cos(n*pi*x/L)dx

I integrated over the interval (-1,3). So from (-1,1) i am integrating xsin(ax) and a square wave centered around the x-axis from (1,3). The square wave integral is an odd function over a symmetric interval so goes to zero....I am left with the xsin(ax) portion from (-1,1). I get:

(-(2/(n*pi))cos((n*pi*x)/2)+(4/((n*pi)^2)sin((n*pi*x)/2) evaluated from -1 to 1

using cos(-x) = cos(x) and sin(-x) = -sin(x), it looks to me as though the sine terms will cancel off, and the cosine terms should double. but this is not the correct answer (solving just for the coefficient not the fourier series). Any help would be greatly appreciated.

Thanks,

Nick