Differential Equations, Interactive EditionXYZ Homework Edition

⇩ 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π2\pi, let sq(t)\mathrm{sq}(t) equal π/4\pi/4 on the first half-period and −π/4-\pi/4 on the second. (The odd-looking amplitude π/4\pi/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 ) + ⋯ ) , \mathrm{sq}(t) = \frac{\pi}{4} \left( 1 - 2u_{\pi}(t) + 2u_{2\pi}(t) - 2u_{3\pi}(t) + \cdots \right),

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 , \mathcal{L}\{\mathrm{sq}\}(s) = \frac{\pi}{4s} \left( 1 - 2e^{-\pi s} + 2e^{-2\pi s} - \cdots \right) = \frac{\pi}{4s} \cdot \frac{1 - e^{-\pi s}}{1 + e^{-\pi 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 + ⋯ , \mathrm{sq}(t) = \sin t + \frac{\sin 3t}{3} + \frac{\sin 5t}{5} + \frac{\sin 7t}{7} + \cdots,

its Fourier series. Only odd multiples of the fundamental frequency 11 appear, and the nnth harmonic arrives with amplitude 1/n1/n. The claim looks implausible — smooth waves summing to a jump? — and deserves to be watched happening. The figure steps through the first three partial sums: S1=sintS_1 = \sin t, then S2S_2 adds 13sin3t\tfrac{1}{3}\sin 3t, then S3S_3 adds 15sin5t\tfrac{1}{5}\sin 5t.

A grey square wave on a time axis, flat at height about 0.785 and flipping sign at time pi, 2 pi and 3 pi, with an amber wave drawn over it. At the opening setting, with the slider k at 1, the amber wave is a plain sine wave of height 1: round-topped, overshooting the flat top of the square wave in the middle of each half-period. Moving k to 2 and then 3 adds the third and then the fifth harmonic: the amber tops flatten toward the square wave, the middle of each top dipping below it at k equal to 2 and rising back above it at k equal to 3, the crossings steepen, and small ripples appear along each top.Explore in 3D (opens in a new tab)

A grey square wave on a time axis, flat at height about 0.785 and flipping sign at time pi, 2 pi and 3 pi, with an amber wave drawn over it. At the opening setting, with the slider k at 1, the amber wave is a plain sine wave of height 1: round-topped, overshooting the flat top of the square wave in the middle of each half-period. Moving k to 2 and then 3 adds the third and then the fifth harmonic: the amber tops flatten toward the square wave, the middle of each top dipping below it at k equal to 2 and rising back above it at k equal to 3, the crossings steepen, and small ripples appear along each top.

The square wave of height π/4≈0.785\pi/4 \approx 0.785 (grey) and one of its Fourier partial sums (amber), drawn over nearly two periods with time tt along the horizontal axis. The slider kk sets how many harmonics the amber curve sums: k=1k = 1 draws S1=sintS_1 = \sin t, k=2k = 2 draws S2=S1+13sin3tS_2 = S_1 + \tfrac{1}{3}\sin 3t, and k=3k = 3 draws S3=S2+15sin5tS_3 = S_2 + \tfrac{1}{5}\sin 5t, its tops flatter and its crossings steeper. Drag kk from 11 to 33 to replay the convergence one harmonic at a time.

Explore

  1. Observe. Start at k=1k = 1, where the amber curve is S1S_1 alone. It is a plain sine of height 11 — the right period and the right sign pattern already, but round-topped and, at its crest, taller than the plateau π/4≈0.785\pi/4 \approx 0.785 it is aiming for.
  2. Predict. At the center of the plateau, t=π/2t = \pi/2, the next term contributes 13sin(3π/2)=−13\tfrac{1}{3}\sin(3\pi/2) = -\tfrac{1}{3}. Will moving to S2S_2 raise or lower the middle of the crest? Decide, then drag kk to 22.
  3. Verify. Step kk through 11, 22, 33 and watch the middle of the crest, at t=π/2t = \pi/2, against the grey plateau: above it, below it, above it again. The three center heights are 11, then 1−13≈0.671 - \tfrac{1}{3} \approx 0.67, then 1−13+15≈0.871 - \tfrac{1}{3} + \tfrac{1}{5} \approx 0.87 — the partial sums of the alternating series 1−13+15−⋯1 - \tfrac{1}{3} + \tfrac{1}{5} - \cdots, whose limit is exactly π/4\pi/4. The plateau height is that famous series, straddled from above and below.
  4. Observe. At k=3k = 3, count the ripples riding the amber curve's plateau: three crests, at t=π/6t = \pi/6, π/2\pi/2, and 5π/65\pi/6. Each harmonic added contributes one more ripple and shrinks them all.
  5. Predict, then verify. At k=3k = 3 the tallest crests are the ones nearest the jumps — at t=π/6t = \pi/6 and 5π/65\pi/6, height 12+13+110=1415≈0.93\tfrac{1}{2} + \tfrac{1}{3} + \tfrac{1}{10} = \tfrac{14}{15} \approx 0.93 — not the one at the center. Predict where the tallest crest of S4S_4 would sit, then check your reasoning against the pattern from S1S_1 to S3S_3. (That stubborn spike beside each jump is the Gibbs phenomenon: it narrows as terms are added but never shrinks below about 9%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 ) , x'' + \omega_0^2\, x = \mathrm{sq}(t),

and each harmonic 1nsinnt\tfrac{1}{n}\sin nt produces its own steady response 1n(ω02−n2)sinnt\frac{1}{n\,(\omega_0^2 - n^2)}\sin nt, exactly as in the beats section — provided ω0≠n\omega_0 \ne n. The denominators tell the story: the response is dominated by whichever harmonic sits closest to the natural frequency. And if ω0\omega_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,…1, 3, 5, 7, \ldots 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.

These eBooks are a prerelease and are not yet certified conformant with WCAG 2.1 AA or any other accessibility standard. Every page is built against an automated accessibility gate, and our target for the published editions is WCAG 2.2 Level AA. If something is unusable, please tell us.