A Fourier series writes a periodic function as a constant plus a sum of sines and cosines, f(x) = a₀/2 + ∑ (aₙ cos nx + bₙ sin nx), and the whole job in an exam is finding the coefficients a₀, aₙ and bₙ by integration. Get the formulas for the right interval, use symmetry to skip integrals that are zero, and know what the series gives at a jump. That covers most Fourier questions in engineering maths papers.
This guide works through five original examples, from the square wave to harmonic analysis from a table of values, and then lists the slips we see most often when marking students' attempts.
The coefficient formulas you need
For a function with period 2π defined on (−π, π):
a₀ = (1/π) ∫₋π^π f(x) dx
aₙ = (1/π) ∫₋π^π f(x) cos nx dx
bₙ = (1/π) ∫₋π^π f(x) sin nx dx
and the series is f(x) = a₀/2 + ∑ₙ₌₁^∞ (aₙ cos nx + bₙ sin nx).
Some textbooks write the constant term as a₀ (not a₀/2) and define a₀ = (1/2π)∫f dx. Both give the same constant. Pick one convention, write it at the top of your answer, and stick to it.
Two facts do most of the simplifying: cos nπ = (−1)ⁿ and sin nπ = 0 for every integer n.
| Situation | Interval | Constant term | aₙ | bₙ |
|---|---|---|---|---|
| Full range, period 2π | (−π, π) or (0, 2π) | a₀/2, a₀ = (1/π)∫f | (1/π)∫f cos nx | (1/π)∫f sin nx |
| Full range, period 2L | (−L, L) or (0, 2L) | a₀/2, a₀ = (1/L)∫f | (1/L)∫f cos(nπx/L) | (1/L)∫f sin(nπx/L) |
| f even on (−L, L) | (−L, L) | a₀ = (2/L)∫₀^L f | (2/L)∫₀^L f cos(nπx/L) | 0 |
| f odd on (−L, L) | (−L, L) | 0 | 0 | (2/L)∫₀^L f sin(nπx/L) |
| Half-range cosine | (0, L) only | a₀ = (2/L)∫₀^L f | (2/L)∫₀^L f cos(nπx/L) | not used |
| Half-range sine | (0, L) only | not used | not used | (2/L)∫₀^L f sin(nπx/L) |
If you are working through the B.Tech Engineering Mathematics course and want sessions that follow your own syllabus, our online engineering maths tutoring page explains how classes with Ajay Vatsyayan run.
Example 1: the square wave
Find the Fourier series of f(x) = −3 for −π < x < 0 and f(x) = 3 for 0 < x < π, period 2π.
Step 1: check symmetry. f(−x) = −f(x), so f is odd. Every aₙ and a₀ is zero. Only bₙ remains.
Step 2: compute bₙ. Because f(x) sin nx is even,
bₙ = (2/π) ∫₀^π 3 sin nx dx = (6/π) [−cos nx / n]₀^π = (6/(nπ)) (1 − (−1)ⁿ)
Step 3: split odd and even n. For even n, bₙ = 0. For odd n, bₙ = 12/(nπ).
Step 4: write the series.
f(x) = (12/π) (sin x + sin 3x / 3 + sin 5x / 5 + …)
What happens at the jump? At x = 0 every sine term is 0, so the series gives 0, the average of −3 and 3. This is Dirichlet's theorem: at a jump the series converges to the mean of the left and right limits.
A bonus result. At x = π/2 the function equals 3 and sin(nπ/2) alternates 1, −1, 1, … over odd n. So 3 = (12/π)(1 − 1/3 + 1/5 − …), which gives 1 − 1/3 + 1/5 − … = π/4.
Near each jump, partial sums overshoot by about 9% of the jump (here the peak is close to 3.54, not 3), however many terms you take. That is the Gibbs phenomenon, and it is why signal engineers care about how a series converges, not just whether it does.
Example 2: a function that is neither odd nor even
Find the Fourier series of f(x) = x + x² on (−π, π), period 2π, and deduce ∑ 1/n².
Split it: x is odd and x² is even. The odd part gives only bₙ; the even part gives a₀ and aₙ.
Constant term. a₀ = (1/π)∫₋π^π x² dx = (1/π)(2π³/3) = 2π²/3, so a₀/2 = π²/3.
Cosine coefficients. aₙ = (2/π)∫₀^π x² cos nx dx. Integrating by parts twice (or using the tabular method),
aₙ = 4(−1)ⁿ / n²
Sine coefficients. bₙ = (2/π)∫₀^π x sin nx dx = 2(−1)ⁿ⁺¹ / n
Series.
x + x² = π²/3 + ∑ [4(−1)ⁿ/n² cos nx + 2(−1)ⁿ⁺¹/n sin nx]
Deduction. Put x = π. The periodic extension jumps there, from π + π² (left) to −π + π² (right), so the series converges to the average, π². Every sine term vanishes and cos nπ = (−1)ⁿ, so
π² = π²/3 + 4 ∑ 1/n², which gives ∑ 1/n² = π²/6.
Students who write f(π) = π + π² here get a wrong sum. The trap is deliberate.
Example 3: a general period 2L
Find the Fourier series of f(x) = 0 for −2 < x < 0 and f(x) = x for 0 < x < 2, period 4 (so L = 2).
There is no symmetry, so compute all three.
a₀ = (1/2)∫₀² x dx = 1, so the constant term is 1/2.
aₙ = (1/2)∫₀² x cos(nπx/2) dx = 2((−1)ⁿ − 1)/(n²π²), which is −4/(n²π²) for odd n and 0 for even n.
bₙ = (1/2)∫₀² x sin(nπx/2) dx = 2(−1)ⁿ⁺¹/(nπ)
So f(x) = 1/2 − (4/π²)[cos(πx/2) + cos(3πx/2)/9 + …] + (2/π)[sin(πx/2) − sin(πx)/2 + sin(3πx/2)/3 − …]
The most common error on this type is keeping 1/π in front of the integrals instead of 1/L. Write L = 2 on the first line of your answer so you cannot forget it.
Example 4: half-range cosine and sine series of the same function
Expand f(x) = x on (0, 3) as (a) a half-range cosine series and (b) a half-range sine series.
Why two answers? On (0, L) you choose the extension. A cosine series extends f as an even function; a sine series extends it as an odd function. The question tells you which.
(a) Cosine series, L = 3.
a₀ = (2/3)∫₀³ x dx = 3, so the constant term is 3/2.
aₙ = (2/3)∫₀³ x cos(nπx/3) dx = 6((−1)ⁿ − 1)/(n²π²), so −12/(n²π²) for odd n and 0 for even n.
x = 3/2 − (12/π²)[cos(πx/3) + cos(πx)/9 + cos(5πx/3)/25 + …]
(b) Sine series, L = 3.
bₙ = (2/3)∫₀³ x sin(nπx/3) dx = 6(−1)ⁿ⁺¹/(nπ)
x = (6/π)[sin(πx/3) − sin(2πx/3)/2 + sin(πx)/3 − …]
Compare them. The cosine coefficients shrink like 1/n², the sine coefficients like 1/n. The even extension of x is continuous (a triangle wave) while the odd extension jumps at x = 3, so the cosine series converges much faster. Putting x = 0 in (a) also gives 1 + 1/9 + 1/25 + … = π²/8.
Example 5: harmonic analysis from a table
Many B.Tech papers include a question where f is known only at equally spaced points. Find the constant term and the first harmonic for this data over one full period.
| x (degrees) | y | cos x | y cos x | sin x | y sin x |
|---|---|---|---|---|---|
| 0 | 9 | 1 | 9 | 0 | 0 |
| 60 | 18 | 0.5 | 9 | 0.8660 | 15.588 |
| 120 | 24 | −0.5 | −12 | 0.8660 | 20.785 |
| 180 | 28 | −1 | −28 | 0 | 0 |
| 240 | 26 | −0.5 | −13 | −0.8660 | −22.517 |
| 300 | 20 | 0.5 | 10 | −0.8660 | −17.321 |
| Sum | 125 | −25 | −3.464 |
With N = 6 points, the integrals become averages: a₀ = (2/N)∑y, a₁ = (2/N)∑y cos x, b₁ = (2/N)∑y sin x.
a₀ = (2/6)(125) = 41.667, so the constant term a₀/2 = 20.833 (the mean of y).
a₁ = (2/6)(−25) = −8.333
b₁ = (2/6)(−3.464) = −1.155
First harmonic: −8.333 cos x − 1.155 sin x, with amplitude √(8.333² + 1.155²) ≈ 8.413.
Do not include x = 360°. It repeats x = 0, and counting it twice changes N and every coefficient.
Which series does the question want?
- Period 2π, interval (−π, π): check odd or even first. If neither, split into odd and even parts as in Example 2.
- Interval (0, 2π): no odd/even shortcut. Integrate over (0, 2π) directly.
- Period 2L with L ≠ π: replace nx with nπx/L and 1/π with 1/L.
- Function given only on (0, L) and the words "half-range": cosine or sine series, as instructed.
- Table of values: harmonic analysis with the 2/N formulas.
- "Hence deduce" a sum: pick the x that makes the sines or cosines simple (0, π/2 or π) and check whether that point is a jump.
Where students lose marks
- Mixing a₀ conventions. Writing a₀ (not a₀/2) as the constant after using a₀ = (1/π)∫f doubles the constant. Fix: state your series form on line one.
- Using the odd/even shortcut on (0, 2π). Symmetry only works on an interval symmetric about 0.
- Integration by parts sign errors. x² cos nx needs two rounds. Fix: use the tabular (Bernoulli) layout and check one coefficient numerically, for example n = 1.
- Writing sin nπ = (−1)ⁿ. It is cos nπ that equals (−1)ⁿ; sin nπ = 0.
- Ignoring the jump in a "deduce" part. At a discontinuity, use the average of the one-sided limits.
- Forgetting to separate odd and even n. Leaving (1 − (−1)ⁿ) unsimplified loses the presentation mark and hides that half the terms are zero.
Practice set
- f(x) = 1 + |x| on (−π, π). Find a₀ and aₙ.
- f(x) = x on (−1, 1), period 2. Find bₙ.
- Find the half-range sine series of f(x) = 1 on (0, 2).
- Use the series in Example 2 at x = 0 to find 1 − 1/4 + 1/9 − 1/16 + ….
- For the table in Example 5, find a₂ and b₂.
Answers. (1) a₀ = 2 + π, so the constant is 1 + π/2; aₙ = −4/(πn²) for odd n, 0 for even n. (2) bₙ = 2(−1)ⁿ⁺¹/(nπ). (3) bₙ = 4/(nπ) for odd n and 0 for even n, so 1 = (4/π)[sin(πx/2) + sin(3πx/2)/3 + …]. (4) π²/12. (5) a₂ = −7/3 ≈ −2.333, b₂ = 0.
Where Fourier series leads next
Fourier series is the tool behind separation of variables for the heat and wave equations, which usually come soon after in the PDE unit; the second-order linear differential equations guide covers the ODE step those problems reduce to, and our differential equations tutoring page covers the PDE unit. It also leads to the Fourier transform, which sits next to the Laplace transform methods for B.Tech exams in signals and control courses. If coefficient integrals feel slow, revise the tabular approach in our integration by parts guide. For the other half of the paper, the Newton-Raphson and bisection walkthrough covers root finding.
How Maths Bodhi helps
We go through your syllabus and past papers, practise the coefficient integrals until they are routine, and review your own attempts line by line. If you have a back paper, our plan for clearing an engineering maths back paper shows how to prioritise, and the university maths tutoring hub lists the other courses we cover.
Home tuition is available in Gurgaon (Gurugram). Students elsewhere in India and abroad learn with us online. You can book a free demo class.
Written and checked by the Maths Bodhi team (November 2026).
Frequently asked questions
- How do you find Fourier series coefficients?
- Integrate f(x) times 1, cos nx and sin nx over one period, divide by π (or by L for period 2L), and simplify using cos nπ = (−1)ⁿ and sin nπ = 0.
- What is the Fourier series of a square wave?
- For f = −k on (−π, 0) and k on (0, π) it is (4k/π)(sin x + sin 3x/3 + sin 5x/5 + …), with only odd sine terms.
- What is a half-range Fourier series?
- A series for a function given only on (0, L), using only cosines (even extension) or only sines (odd extension).
- Why is a₀ divided by 2 in a Fourier series?
- Dividing by 2 lets one formula, (1/π)∫f cos nx dx, work for n = 0 as well as n ≥ 1.
- What does a Fourier series converge to at a discontinuity?
- To the average of the left-hand and right-hand limits of the function at that point.
- Is harmonic analysis part of Fourier series?
- Yes; it finds Fourier coefficients from tabulated values using sums such as a₁ = (2/N)∑y cos x instead of integrals.
