All labs › Learn › Communication Systems
All articlesAll labs

Fourier Series of a Square Wave and Its Harmonics

See how a square wave is built from odd harmonics, with the amplitude formula, dB levels, the Gibbs overshoot and the bandwidth needed to show clean corners.

Updated 28 November 2026 · 4 min read · Designed by Fasih Ullah Saleem

01A repeating signal is a sum of sines02The series for a square wave03Worked numbers04Where the power goes05Adding harmonics, and the Gibbs overshoot06What this means for your measurements07Check it on a spectrum analyzer08Try it in the virtual lab09Questions and answers10Related topics
01

A repeating signal is a sum of sines

Any signal that repeats every T seconds can be written as a sum of sine waves. Their frequencies are the base frequency f0 = 1/T and its whole number multiples. These multiples are called harmonics. The sum is the Fourier series, and the spectrum of such a signal is a set of separate lines.

The square wave is the standard example because it is simple to draw yet needs infinitely many sines. It is also what you meet in every digital circuit.

02

The series for a square wave

Take a square wave that swings between +A and −A with equal time high and low. It is an odd function of time, so it needs only sines, and only the odd harmonics survive.

x(t) = (4A/π) [ sin(ω0 t) + (1/3) sin(3 ω0 t) + (1/5) sin(5 ω0 t) + ... ]
amplitude of harmonic k = 4A / (π k), for k = 1, 3, 5, ...

There are no even harmonics. The harmonic amplitudes fall in proportion to 1/k, which is a slow fall. That slow fall is the reason a sharp edge needs so much bandwidth.

03

Worked numbers

Let A = 1 V and f0 = 1 kHz. The fundamental has a peak amplitude of 4/π, which is 1.273 V. Notice that this is larger than the 1 V peak of the square wave itself. The higher harmonics then subtract from it to flatten the top.

HarmonicFrequencyPeak amplitudeLevel vs fundamental
11 kHz1.273 V0 dB
33 kHz0.424 V−9.5 dB
55 kHz0.255 V−14.0 dB
77 kHz0.182 V−16.9 dB
99 kHz0.141 V−19.1 dB

The level of harmonic k is −20 log10(k) dB relative to the fundamental. You can check it on a spectrum analyzer: the third harmonic of a clean square wave sits close to 9.5 dB below the first.

04

Where the power goes

The average power of the ±A square wave is A². The fundamental alone carries (4A/π)² / 2, which is 8A²/π², about 81 percent of that total. The third harmonic adds roughly 9 percent, the fifth about 3 percent. So a few harmonics hold nearly all the power, even though many more are needed to get the corners right.

05

Adding harmonics, and the Gibbs overshoot

If you add the harmonics one at a time, the sum gets closer to a square wave. With only the fundamental it looks like a sine. With three terms it has flat tops with ripple. With ten terms the edges are steep.

Near each jump the partial sum always overshoots. The overshoot is about 9 percent of the jump height and does not shrink as you add terms. It only gets narrower. This is the Gibbs phenomenon. It means a square wave cut off by a filter shows ringing at the edges.

06

What this means for your measurements

The rise time of a signal and its bandwidth are linked by the rule of thumb bandwidth ≈ 0.35 / rise time. An oscilloscope that shows a square wave with clean corners needs a bandwidth of at least five times the wave frequency, so that it passes the fifth harmonic. Ten times is better, because it passes the ninth.

  • If the duty cycle is not 50 percent, even harmonics appear. A 25 percent duty cycle wave has no fourth harmonic, but it has a second.
  • A triangle wave also has only odd harmonics, but they fall as 1/k², so it needs far less bandwidth.
  • Add a DC offset and a line appears at 0 Hz. Shift the wave in time and only the phases change, not the line heights.
07

Check it on a spectrum analyzer

Feed a 1 kHz square wave of 2 V peak to peak (A = 1 V) into a 50 ohm analyzer. The fundamental has a peak of 1.273 V, which is 0.900 V rms. The power is 0.81 / 50 = 16.2 mW, or 12.1 dBm. The third harmonic is 9.5 dB lower, so it reads about 2.6 dBm at 3 kHz. The fifth reads near −1.9 dBm at 5 kHz.

If the lines at even multiples of 1 kHz are not very small, the duty cycle is not 50 percent. If the odd lines fall off faster than 1/k, the source has slow edges. Both are useful clues about the signal.

08

Try it in the virtual lab

SinBench has free 3D benches and interactive demos for this topic. Open one to try the ideas above with real instruments, no sign up needed.

Lab 2

Fourier Transform and the Spectrum Analyzer

Open the lab →Concepts and demos
09

Questions and answers

Why does a square wave have only odd harmonics?

A square wave with equal high and low times has a symmetry that cancels every even harmonic. Only the 1st, 3rd, 5th and later odd terms remain.

How many harmonics make a good square wave?

Five to ten odd harmonics give flat tops and steep edges for most uses. Some ripple at the corners always remains, because of the Gibbs overshoot.

What is the amplitude of the fundamental of a square wave?

For a wave swinging between +A and −A it is 4A/π, about 1.273 A. It is larger than the square wave peak.

What is the Gibbs phenomenon?

It is the overshoot of about 9 percent that appears near a jump when a Fourier series is cut off. It becomes narrower with more terms but does not become smaller.

10

Related topics

Communication Systems

Fourier Transform Basics: From Time to Frequency

Learn what the Fourier transform does, how time and frequency views of a signal connect and how to read a spectrum, with worked examples and a free lab.

Communication Systems

How to Use a Spectrum Analyzer: Span, RBW and Reference Level

A practical guide to spectrum analyzer settings: center frequency, span, resolution bandwidth, reference level, dBm and sweep time, with worked examples.

Communication Systems

How to Use an Oscilloscope: Volts per Div, Time per Div and Trigger

Learn the main oscilloscope controls: volts per division, time per division, trigger level and slope, AC and DC coupling and probes, with worked measurements.

SinBench SinBench · Free virtual labsDesigned by Fasih Ullah Saleem
© 2026 Fasih Ullah Saleem. All rights reserved. fasihullahsaleem.com · About · Terms of Use · Privacy