# Math Help - Need help with a Fourier series

1. ## 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.

2. ## Re: Need help with a Fourier series

$\frac{1}{\pi }\int _{-\pi }^{\pi }f(x) \cos (n x)dx = \frac{-\pi n \sin (\pi n)-2 \cos (\pi n)+2}{\pi n^2}$

$\mathcal{F}_x[f(x)](\omega ) = -\frac{e^{-i \pi \omega } \left(-1+e^{i \pi \omega }\right) \left(-1+e^{i \pi \omega }-i \pi \omega \right)}{\sqrt{2 \pi } \omega ^2}$

3. ## 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?