Fourier Series of Square Wave
Odd harmonics, 1/n decay, spectral analysis.
The square wave is the standard test signal for Fourier series because its sharp transitions produce a rich harmonic spectrum that shows clearly how sinusoids rebuild a discontinuous waveform. Understanding its series is foundational for pulse-width modulation, digital clock analysis, and switched-mode power supply design.
Core Concept
A square wave flips between two values — call them A and 0 — at regular intervals. It has half-wave symmetry, which immediately tells you that all even harmonics are absent from its Fourier series. The signal is also odd if you centre it around zero, but even in the uncentred form only odd harmonics appear.
Each harmonic contribution is a sinusoid at frequency kf0, and the amplitude falls off as 1/k. The fundamental (k=1) contributes the most. The third harmonic contributes 1/3 as much, the fifth 1/5, and so on. This slow 1/k decay is why a square wave needs many harmonics to look square — the sharp edges require very high-frequency content.
Adding more terms of the series produces a better approximation. But no matter how many terms you add, an overshoot appears near each discontinuity. That overshoot is about 9% of the jump height and never fully disappears. This is the Gibbs phenomenon, and it is a fundamental property of Fourier series near jump discontinuities.
Key Formula
For the square wave defined as x(t) = A for 0 < t < T/2 and x(t) = 0 for T/2 < t < T, with period T and fundamental frequency ω0 = 2π/T, the Fourier series is x(t) = A/2 + (2A/π) · Σ [sin(kω0t)/k] summed over odd k = 1, 3, 5, ... The term A/2 is the DC offset. The coefficients are a_0 = A/2, a_k = 0 for all k ≥ 1, and b_k = 2A/(kπ) for odd k, zero for even k.
Given: x(t) = A for 0 < t < T/2, x(t) = 0 for T/2 < t < T. Period T.
Step 1: Find a_0 (DC term).
a_0 = (1/T) ∫₀ᵀ x(t) dt
= (1/T) [∫₀^(T/2) A dt + ∫_(T/2)^T 0 dt]
= (1/T)(A · T/2) = A/2
Step 2: Find a_k for k ≥ 1.
a_k = (2/T) ∫₀^(T/2) A cos(kω0t) dt
= (2A/T) · [sin(kω0t)/(kω0)]₀^(T/2)
= (2A/T) · sin(kπ)/(kω0) [since ω0·T/2 = π]
= 0 (since sin(kπ) = 0 for all integer k)
Step 3: Find b_k.
b_k = (2/T) ∫₀^(T/2) A sin(kω0t) dt
= (2A/T) · [-cos(kω0t)/(kω0)]₀^(T/2)
= (2A/kω0T)[1 - cos(kπ)]
= (A/kπ)[1 - (-1)^k]
Step 4: Evaluate.
If k is even: b_k = (A/kπ)[1-1] = 0
If k is odd: b_k = (A/kπ)[1+1] = 2A/(kπ)
Final Answer:
x(t) = A/2 + (2A/π)[sin(ω0t) + sin(3ω0t)/3 + sin(5ω0t)/5 + ...]Exam Tip: The DC value a_0 equals the average of the waveform over one period — for a 50% duty cycle square wave of amplitude A, it is simply A/2. If the problem shifts the wave to be symmetric about zero (from -A to +A), then a_0 = 0 and all a_k vanish too, leaving only odd b_k terms. Always redraw the waveform and identify the average value first.
Properties Summary
- DC component: a_0 = A/2, equal to the average value of the waveform over one period.
- Only odd harmonics present: b_k = 2A/(kπ) for k = 1, 3, 5, ...; even harmonics are zero due to half-wave symmetry.
- Amplitude decay: spectral amplitudes fall as 1/k, slower than triangle (1/k²) or Gaussian.
- No cosine terms: all a_k = 0 for k ≥ 1, because the cosine integral over the rectangular pulse yields zero.
- Power: average power = Σ b_k²/2 + a_0², computed using Parseval theorem over all harmonics.
- Gibbs overshoot: partial sum of N terms overshoots by ~9% near discontinuities regardless of N.
Quick Revision
- Square wave with 50% duty cycle: DC = A/2, odd sine harmonics only.
- Coefficient magnitude: |b_k| = 2A/(kπ) for odd k.
- Half-wave symmetry kills all even harmonics automatically.
- Shifting the square wave vertically to be centred on zero removes the DC term.
- Sharp edges in time correspond to slow 1/k amplitude decay in frequency.
- The Gibbs overshoot is always 8.9% of the jump — adding more terms does not remove it.
- For a duty cycle d ≠ 50%, b_k = (2A/kπ) sin(kπd) and even harmonics are no longer zero.
- Exam trap: using b_k = A/(kπ) instead of 2A/(kπ) — the factor of 2 comes from [1 - cos(kπ)] = 2 for odd k.
Square Wave Fourier Quiz
Test your knowledge of the Fourier series of a square wave and its spectral properties.
Q1.The trigonometric Fourier series of an odd square wave with amplitude A and period T0 contains:
Related Articles
Fourier Series of Triangle Wave
Odd harmonics only, 1/n² decay.
11 min read
Trigonometric Fourier Series
a0, an, bn coefficients, DC and harmonic terms.
4 min read
Fourier Series Properties
Linearity, time shift, frequency shift, Parseval.
8 min read
Exponential Fourier Series
Complex coefficients cn, compact notation.
4 min read
Power Spectrum of Periodic Signals
Line spectrum, power in harmonics, Parseval relation.
9 min read