Fourier Series

The idea

Any reasonably well-behaved periodic function can be rebuilt out of sines and cosines. For a function f(x)f(x) with period 2π2\pi:

f(x)=a02+∑n=1∞(ancos⁡nx+bnsin⁡nx)f(x) = \dfrac{a_0}{2} + \sum_{n=1}^{\infty}\left(a_n\cos nx + b_n\sin nx\right)

where the coefficients are found by integrating over one full period:

a0=1π∫−ππf(x) dx,an=1π∫−ππf(x)cos⁡nx dx,bn=1π∫−ππf(x)sin⁡nx dxa_0 = \dfrac{1}{\pi}\int_{-\pi}^{\pi} f(x)\,dx, \qquad a_n = \dfrac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos nx\,dx, \qquad b_n = \dfrac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin nx\,dx

For a general period 2L2L on (−L,L)(-L, L), replace nxnx by nπxL\dfrac{n\pi x}{L} everywhere and 1π\dfrac{1}{\pi} by 1L\dfrac{1}{L} in front of each integral.

Shortcuts for odd and even functions

If f(x)f(x) is odd (symmetric about the origin), every ana_n (including a0a_0) is automatically zero, since cosine is even and an odd-times-even integrand over a symmetric interval vanishes. Only the sine terms survive.

If f(x)f(x) is even (symmetric about the yy-axis), it's the other way round: every bn=0b_n = 0, and only a0a_0 and the cosine terms survive. In both cases the remaining integrals can be taken over (0,π)(0, \pi) and doubled.

What survives for odd and even functions on (−π, π)
FunctionZero coefficientsSeries contains
Odd, e.g. xx, x3x^3, sin⁡x\sin xa0a_0 and every ana_nSine terms only
Even, e.g. x2x^2, ∣x∣|x|, cos⁡x\cos xEvery bnb_nConstant and cosine terms only
NeitherNone in generalBoth

Worked example: the Fourier series of f(x) = x

Find the Fourier series of f(x)=xf(x) = x on (−π,π)(-\pi, \pi).

Solution: f(x)=xf(x)=x is odd, so a0=0a_0 = 0 and every an=0a_n = 0. Only bnb_n needs computing, and since xsin⁡nxx\sin nx is even, the integral over (−π,π)(-\pi,\pi) is twice the integral over (0,π)(0,\pi):

bn=2π∫0πxsin⁡nx dxb_n = \dfrac{2}{\pi}\int_0^{\pi} x\sin nx\,dx

Integrating by parts (u=xu = x, dv=sin⁡nx dxdv = \sin nx\,dx):

∫0πxsin⁡nx dx=[−xcos⁡nxn]0π+1n∫0πcos⁡nx dx=−πcos⁡nπn+1n[sin⁡nxn]0π\int_0^\pi x\sin nx\,dx = \left[-\dfrac{x\cos nx}{n}\right]_0^\pi + \dfrac{1}{n}\int_0^\pi \cos nx\,dx = -\dfrac{\pi\cos n\pi}{n} + \dfrac{1}{n}\left[\dfrac{\sin nx}{n}\right]_0^\pi

The second term vanishes since sin⁡nπ=0\sin n\pi = 0 for every integer nn, and cos⁡nπ=(−1)n\cos n\pi = (-1)^n:

∫0πxsin⁡nx dx=−π(−1)nn=π(−1)n+1n\int_0^\pi x\sin nx\,dx = -\dfrac{\pi(-1)^n}{n} = \dfrac{\pi(-1)^{n+1}}{n}

So:

bn=2π⋅π(−1)n+1n=2(−1)n+1nb_n = \dfrac{2}{\pi}\cdot\dfrac{\pi(-1)^{n+1}}{n} = \dfrac{2(-1)^{n+1}}{n}

giving b1=2b_1=2, b2=−1b_2=-1, b3=23b_3=\tfrac{2}{3}, and so on, so the full series is:

x=2sin⁡x−sin⁡2x+23sin⁡3x−12sin⁡4x+⋯=∑n=1∞2(−1)n+1nsin⁡nxx = 2\sin x - \sin 2x + \dfrac{2}{3}\sin 3x - \dfrac{1}{2}\sin 4x + \cdots = \sum_{n=1}^{\infty} \dfrac{2(-1)^{n+1}}{n}\sin nx

Worked example: the Fourier series of f(x) = x²

Find the Fourier series of f(x)=x2f(x) = x^2 on (−π,π)(-\pi, \pi), and use it to find ∑n=1∞1n2\displaystyle\sum_{n=1}^{\infty} \dfrac{1}{n^2}.

Solution: x2x^2 is even, so every bn=0b_n = 0. For the constant term:

a0=2π∫0πx2 dx=2π⋅π33=2π23,a02=π23a_0 = \dfrac{2}{\pi}\int_0^\pi x^2\,dx = \dfrac{2}{\pi}\cdot\dfrac{\pi^3}{3} = \dfrac{2\pi^2}{3}, \qquad \dfrac{a_0}{2} = \dfrac{\pi^2}{3}

For ana_n, integrate by parts twice. The boundary terms leave only the part with cos⁡nπ=(−1)n\cos n\pi = (-1)^n:

an=2π∫0πx2cos⁡nx dx=2π⋅2π(−1)nn2=4(−1)nn2a_n = \dfrac{2}{\pi}\int_0^\pi x^2\cos nx\,dx = \dfrac{2}{\pi}\cdot\dfrac{2\pi(-1)^n}{n^2} = \dfrac{4(-1)^n}{n^2}x2=π23+4∑n=1∞(−1)nn2cos⁡nx=π23−4cos⁡x+cos⁡2x−49cos⁡3x+⋯x^2 = \dfrac{\pi^2}{3} + 4\sum_{n=1}^{\infty} \dfrac{(-1)^n}{n^2}\cos nx = \dfrac{\pi^2}{3} - 4\cos x + \cos 2x - \dfrac{4}{9}\cos 3x + \cdots

Now put x=πx = \pi. Since cos⁡nπ=(−1)n\cos n\pi = (-1)^n, every term becomes 4n2\dfrac{4}{n^2}:

π2=π23+4∑n=1∞1n2  ⇒  ∑n=1∞1n2=π26\pi^2 = \dfrac{\pi^2}{3} + 4\sum_{n=1}^{\infty}\dfrac{1}{n^2} \;\Rightarrow\; \sum_{n=1}^{\infty}\dfrac{1}{n^2} = \dfrac{\pi^2}{6}

What the series does at a jump

Under the usual (Dirichlet) conditions, the series equals f(x)f(x) wherever ff is continuous. At a jump it converges to the average of the values on either side.

The series for xx shows this. Repeated with period 2π2\pi, the function jumps from π\pi down to −π-\pi at x=πx = \pi. Every term sin⁡nπ\sin n\pi is 0 there, so the series gives 0=π+(−π)20 = \dfrac{\pi + (-\pi)}{2}, the midpoint of the jump.

That is the value at the jump. Just beside it, the partial sums overshoot by about 9% of the jump however many terms you add, the Gibbs phenomenon, which has its own worked post.

Common mistakes

  • Mixing the two conventions for the constant. With a0=1π∫f dxa_0 = \dfrac{1}{\pi}\displaystyle\int f\,dx, the series starts with a02\dfrac{a_0}{2}. Some books define a0a_0 with 12π\dfrac{1}{2\pi} and start with a0a_0. Use one convention throughout.
  • Computing coefficients you already know are zero. Check odd or even first: it removes half the work.
  • Forgetting cos⁡nπ=(−1)n\cos n\pi = (-1)^n and sin⁡nπ=0\sin n\pi = 0. Almost every boundary term simplifies through these two facts.
  • Keeping nxnx for a period other than 2π2\pi. On (−L,L)(-L, L) the arguments become nπxL\dfrac{n\pi x}{L}.
  • Claiming the series equals ff at a discontinuity. It gives the average of the two one-sided values there.

Where this comes up in exams

Fourier series are listed in the GATE 2027 EE syllabus under both Engineering Mathematics and Signals and Systems, and under Signals and Systems in the GATE 2027 EC and IN syllabi.

Checked against GATE 2027 EE syllabus, GATE 2027 IN syllabus and GATE 2027 EC syllabus. Syllabi can change from year to year, so confirm with the latest official notification for your exam.

Continue learning

GATE practice: the signals view of the same series (exponential form, Parseval and filtering), and the overshoot at a jump. Laplace transforms are engineering maths' other tool for moving a hard problem into an easier domain.

From past GATE papers