The idea
Any reasonably well-behaved periodic function can be rebuilt out of sines and cosines. For a function f(x) with period 2π:
f(x)=2a0+n=1∑∞(ancosnx+bnsinnx)where the coefficients are found by integrating over one full period:
a0=π1∫−ππf(x)dx,an=π1∫−ππf(x)cosnxdx,bn=π1∫−ππf(x)sinnxdxA shortcut for odd and even functions
If f(x) is odd (symmetric about the origin), every an (including a0) is automatically zero, since cosine is even and an odd-times-even integrand over a symmetric interval vanishes. Only the sine terms survive.
Worked example: the Fourier series of f(x) = x
Find the Fourier series of f(x)=x on (−π,π).
Solution: f(x)=x is odd, so a0=0 and every an=0. Only bn needs computing, and since xsinnx is even, the integral over (−π,π) is twice the integral over (0,π):
bn=π2∫0πxsinnxdxIntegrating by parts (u = x, dv = sin nx dx):
∫0πxsinnxdx=[−nxcosnx]0π+n1∫0πcosnxdx=−nπcosnπ+n1[nsinnx]0πThe second term vanishes since sinnπ=0 for every integer n, and cosnπ=(−1)n:
∫0πxsinnxdx=−nπ(−1)n=nπ(−1)n+1So:
bn=π2⋅nπ(−1)n+1=n2(−1)n+1giving b1=2, b2=−1, b3=32, and so on, so the full series is:
x=2sinx−sin2x+32sin3x−21sin4x+⋯=n=1∑∞n2(−1)n+1sinnx