The Daily Reckoning
How Can Smooth Waves Build a Square Wave?
Fourier series stack odd sine waves into flat plateaus and sudden jumps, turning a complicated signal into a frequency recipe.
- Difficulty
- Intermediate
- Area
- Analysis and signal processing
- Reading time
- 10 minutes
- Prerequisites
- Sine and cosine graphs · Radian measure · Definite integrals as signed area
A sine wave bends everywhere. A square wave stays flat, then jumps in an instant. How could any pile of smooth sine waves produce a shape with corners and vertical cliffs?
No finite pile succeeds exactly. Yet an infinite sequence of carefully weighted sine waves reproduces every flat stretch of a square wave and converges to a precise compromise at each jump. The first few waves already make the construction visible.
Give the target a definition
Let denote a square wave on the interval from to . Define it by
Then repeat the same shape every units, so . The symbol marks horizontal position, and radians is half of one full cycle. At the repeated jump points, including and , assign the value halfway between the two plateaus: .
The interactive figure below begins with three sine waves. Move the slider from one harmonic to fifteen. The upper plot shows their sum; the lower plot shows the coefficient attached to each frequency.
Harmonic builder
Add smooth waves and watch corners appear
The recipe uses only odd harmonics
Bar height is the coefficient 4 / (πn).
The curve acquires flatter decks and steeper sides because the added sine waves oscillate faster. Their amplitudes shrink at the same time. The first frequency supplies the broad outline, while each later frequency corrects smaller-scale error.
The frequency recipe
For every that is not a jump point, the square wave has the Fourier series
The index runs through the nonnegative integers . Therefore runs through the odd harmonic numbers . The word harmonic means an integer multiple of the base frequency. Writing out the first terms gives
The equality describes the infinite series. A graph on a screen can only draw a partial sum. Using the first odd harmonics gives
where is the number of included sine waves. The interactive figure draws .
Why the even harmonics vanish
A general -periodic Fourier series can contain a constant, cosine waves, and sine waves. The coefficient of is
where is a positive integer. The square wave and the sine wave both change sign when changes sign. Their product does not change sign, so the product is symmetric about . We may double the integral over the positive half:
When is even, , so . When is odd, , so
That calculation produces the descending odd bars in the lower diagram. The constant and every cosine coefficient are also because the square wave is odd: . A constant or cosine term would introduce an even component that the waveform does not have.
Worked example: three harmonics at the middle of a plateau
Evaluate the three-term approximation at . Begin with the definition:
The three sine values are , , and . Substitute them one at a time:
The target value is , so three harmonics overshoot by about there. More terms make the middle of the plateau settle toward .
Near a jump, the behavior is stranger. The tallest overshoot approaches about even as more terms are added. Its height does not fall to ; instead, the overshooting region becomes narrower. This persistent ringing is called the Gibbs phenomenon. At the jump itself, every term contains , so every partial sum equals —the average of the neighboring values and . MIT OpenCourseWare’s notes on the standard square wave derive the same coefficients and describe this midpoint rule at discontinuities.
Try two checks
Problem 1
Use only the first two odd harmonics. What is ?
Reveal the solution
The two-term partial sum is
At , the two sine values are and :
The second harmonic correction leaves the approximation below the plateau. Adding the next odd harmonic raises it above the plateau to about .
Problem 2
What is for any positive whole number ? Explain without adding the terms individually.
Reveal the solution
Every term in the partial sum has the form
At ,
for every value of . A sum of zeros is zero, so
for every positive whole number . The Fourier series lands exactly halfway between the square wave’s left-hand value and right-hand value .
Heat, revolution, empire, and an unwelcome kind of function
Joseph Fourier did not begin with electronic signals. He wanted to calculate how heat spreads through a solid. Eighteenth-century mathematicians including Jean le Rond d’Alembert, Leonhard Euler, and Daniel Bernoulli had already argued about trigonometric sums while studying vibrating strings. Fourier pushed the idea into a broader claim: temperature profiles, including piecewise-defined profiles, could be decomposed into trigonometric waves and evolved one frequency at a time.
The mathematics emerged inside a life repeatedly redirected by political power. According to the University of St Andrews’ history of Fourier, he joined a local Revolutionary Committee in 1793, was imprisoned during the French Revolution, and escaped a possible death sentence after Robespierre’s fall. In 1798 Fourier joined Napoleon’s invasion of Egypt as a scientific adviser and became secretary of the Cairo Institute created during the French occupation. After Fourier returned to France, Napoleon appointed him prefect of the Isère department. Fourier began his sustained work on heat in Grenoble around 1804 while also serving as an imperial administrator.
Fourier presented a heat memoir to the Paris Institute in 1807. A committee that included Joseph-Louis Lagrange and Pierre-Simon Laplace objected to the trigonometric expansions and to parts of the physical derivation. A revised submission won the Institute’s 1811 prize, but the report still questioned its generality and rigor. Fourier’s Théorie analytique de la chaleur finally appeared in 1822.
That chronology resists a tidy discovery myth. Fourier did not invent trigonometric decomposition from nothing, and his original generality needed later mathematicians to state accurate convergence conditions. His decisive move was to treat a complicated temperature profile as a spectrum of frequencies and then solve the heat problem frequency by frequency. France’s revolutionary upheaval, a colonial military invasion, imperial administration, and the Paris Institute’s prize process all shaped Fourier’s working life and the route to publication. None of those facts proves that Fourier’s politics caused the series formula.
Where the frequency recipe works now
Heat and other diffusion problems. Fourier’s original method turns a starting temperature profile into sine and cosine modes. Each mode decays at its own rate, allowing a complicated cooling pattern to be calculated from elementary pieces.
Sound, communications, and electronics. Frequency components explain why two instruments playing the same note can sound different and how a filter changes a signal. MIT’s Signals and Systems materials use Fourier decomposition to show how a linear time-invariant system changes each harmonic’s amplitude and phase. A digital circuit’s near-square voltage contains the same odd-harmonic structure drawn above.
Images and magnetic resonance imaging. Two-dimensional Fourier methods encode spatial patterns as combinations of horizontal and vertical frequencies. The U.S. Food and Drug Administration’s magnetic resonance imaging test toolkit generates test data in the Fourier domain and reconstructs images from k-space with an inverse Fourier transform. Digital image processing uses the discrete version of the same frequency viewpoint; MIT’s discrete-time Fourier lecture connects the fast Fourier transform with image examples.
One idea to remember
A complicated periodic shape can be stored as a list of frequencies and weights. For the square wave, odd sine waves carry the entire recipe: frequency rises as , while amplitude falls as .
To continue, revisit how mathematics makes convergence exact or compare Fourier’s heat problem with the force balance behind a hanging chain. A later Reckoning can ask the next question: how does the Fourier transform extend the same idea from repeating signals to signals that never repeat?
Sources
- Joseph Fourier, Théorie analytique de la chaleur, Paris: Firmin Didot, 1822.
- University of St Andrews, “Joseph Fourier (1768–1830)”, MacTutor History of Mathematics, on Fourier’s mathematical, political, and administrative life.
- University of St Andrews, “Mathematicians and Music”, MacTutor History of Mathematics, on the vibrating-string debates preceding Fourier.
- Massachusetts Institute of Technology OpenCourseWare, “Fourier Series II”, 18.03 Differential Equations, Spring 2010.
- Massachusetts Institute of Technology OpenCourseWare, “Fourier Representations” and “Discrete-Time Fourier Representations”, 6.003 Signals and Systems, Fall 2011.
- U.S. Food and Drug Administration, “MRI-IQ-ETK: Digital MRI Test Phantoms and Automated Image Quality Evaluation Toolkit”, accessed September 14, 2026.