Login
📚 Differential Equations, Interactive Edition
Chapters ▾
⇩ Download ▾

3.2 Square-Wave Forcing

Throw the switch on and off forever and you get the simplest periodic forcing there is: the square wave. With period 2π, let sq(t) equal π/4 on the first half-period and π/4 on the second. (The odd-looking amplitude π/4 is chosen to make every coefficient below a clean unit fraction.) In the language of the last section it is an infinite train of switches,

s q ( t ) = π 4 ( 1 2 u π ( t ) + 2 u 2 π ( t ) 2 u 3 π ( t ) + ) ,

and its transform costs one geometric series: each delayed switch contributes its exponential tag, and

{ s q } ( s ) = π 4 s ( 1 2 e π s + 2 e 2 π s ) = π 4 s · 1 e π s 1 + e π s ,

a closed form paying for infinitely many switches at once. That is the time ledger: the wave described by when it flips.

There is a second ledger — not when the wave switches but which frequencies it contains:

s q ( t ) = sin t + sin 3 t 3 + sin 5 t 5 + sin 7 t 7 + ,

its Fourier series. Only odd multiples of the fundamental frequency 1 appear, and the nth harmonic arrives with amplitude 1/n. The claim looks implausible — smooth waves summing to a jump? — and deserves to be watched happening. The figure plots the first three partial sums: S1=sint, then S2 adds 13sin3t, then S3 adds 15sin5t.

Three blue waves of increasing darkness drawn over the same two periods: a dashed pale sine wave, a dashed medium curve whose crests have begun to flatten, and a solid dark curve with flatter tops, steeper crossings, and a small ripple. Toggling the curves' visibility shows each added odd harmonic pushing the shape closer to a square wave of height about 0.785.Explore in 3D (opens in a new tab)
The first three Fourier partial sums of the square wave of height π/40.785, drawn over nearly two periods: the pale dashed S1=sint, the medium dashed S2=S1+13sin3t, and the solid dark S3=S2+15sin5t, its tops flatter and its crossings steeper. Toggle each curve's visibility to replay the convergence one harmonic at a time.

Explore

  1. Observe. Hide S2 and S3. Alone, S1 is a plain sine of height 1 — the right period and the right sign pattern already, but round-topped and, at its crest, taller than the plateau π/40.785 it is aiming for.
  2. Predict. At the center of the plateau, t=π/2, the next term contributes 13sin(3π/2)=13. Will revealing S2 raise or lower the middle of the crest? Decide, then toggle it on.
  3. Verify. Read the three center heights at t=π/2: they are 1, then 1130.67, then 113+150.87 — the partial sums of the alternating series 113+15, whose limit is exactly π/4. The plateau height is that famous series, straddled from above and below.
  4. Observe. Count the ripples riding the solid curve's plateau: three crests, at t=π/6, π/2, and 5π/6. Each harmonic added contributes one more ripple and shrinks them all.
  5. Predict, then verify. The solid curve's tallest crests are the ones nearest the jumps — at t=π/6 and 5π/6, height 12+13+110=14150.93 — not the one at the center. Predict where the tallest crest of S4 would sit, then check your reasoning against the pattern from S1 to S3. (That stubborn spike beside each jump is the Gibbs phenomenon: it narrows as terms are added but never shrinks below about 9 of the jump.)

Connect

Why take the wave apart at all? Because for a linear equation, superposition turns the series into a term-by-term to-do list. Drive an undamped oscillator with the square wave,

x + ω 0 2 x = s q ( t ) ,

and each harmonic 1nsinnt produces its own steady response 1n(ω02n2)sinnt, exactly as in the beats section — provided ω0n. The denominators tell the story: the response is dominated by whichever harmonic sits closest to the natural frequency. And if ω0 equals an odd integer, that single term resonates and grows without bound while every other term stays politely small.

This is the treacherous fact about periodic switching. A pure sinusoid resonates at exactly one frequency; a square wave carries the frequencies 1,3,5,7, all at once and can resonate a system tuned to any of them. Matching the forcing period to the natural period is the resonance you expect. A square wave that switches three or five times slower than the system's natural oscillation excites a resonance you may not expect — the energy arrives through an overtone. Switched machinery must be designed against the whole ladder of frequencies, not a single rung.

An original work of XYZ Homework, built around interactive XYZ 3D figures, following the standard first-course sequence (first-order equations through systems and the phase plane). Distinct from the LibreTexts-sourced Differential Equations for Engineers (Lebl) edition, which has its own attribution. License: CC-BY-NC-SA-4.0.