For a general period 2L on (−L,L), replace nx by Lnπx everywhere and π1 by L1 in front of each integral.
Shortcuts 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.
If f(x) is even (symmetric about the y-axis), it's the other way round: every bn=0, and only a0 and the cosine terms survive. In both cases the remaining integrals can be taken over (0,π) and doubled.
What survives for odd and even functions on (−π, π)
Function
Zero coefficients
Series contains
Odd, e.g. x, x3, sinx
a0 and every an
Sine terms only
Even, e.g. x2, ∣x∣, cosx
Every bn
Constant and cosine terms only
Neither
None in general
Both
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,π):
Now put x=π. Since cosnπ=(−1)n, every term becomes n24:
π2=3π2+4n=1∑∞n21⇒n=1∑∞n21=6π2
What the series does at a jump
Under the usual (Dirichlet) conditions, the series equals f(x) wherever f is continuous. At a jump it converges to the average of the values on either side.
The series for x shows this. Repeated with period 2π, the function jumps from π down to −π at x=π. Every term sinnπ is 0 there, so the series gives 0=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∫fdx, the series starts with 2a0. Some books define a0 with 2π1 and start with a0. Use one convention throughout.
Computing coefficients you already know are zero. Check odd or even first: it removes half the work.
Forgetting cosnπ=(−1)n and sinnπ=0. Almost every boundary term simplifies through these two facts.
Keeping nx for a period other than 2π. On (−L,L) the arguments become Lnπx.
Claiming the series equals f 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.
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.