Need help with a Fourier series

The original problem is: f(x) = x if -pi<x<0, and f(x) = pi - x if 0<x<pi. I'm supposed to model this as a Fourier series. I got the sine series correct, but for some reason, when I try to calculate the cosine series as 1/pi * integral[f(x)*cos(nx) dx, -pi, pi], I keep coming up with zero. I cannot spot my error. I don't know if the issue is setting it up, the integration by parts, or what.

1 Attachment(s)

Re: Need help with a Fourier series

Re: Need help with a Fourier series

Yeah, I mean, even a casual inspection of that graph reveals that the cos series can't be zero.

I probably just made a careless mistake or two; I'll go back (again) and review my work.

EDIT: Wait a minute. Isn't sin(n*pi) = 0 whenever n is an integer, which is the case with Fourier?