Wave Functions
Add sine waves together, build square, sawtooth and triangle waves from their harmonics, and see how two close frequencies produce beats.
- Wave 1
- Wave 2
- Wave 3
- Sum
1 sin(2π·1t + 0°)
0.5 sin(2π·2t + 0°)
0.33 sin(2π·3t + 0°)
Adding waves together
A sine wave y = A sin(2πft + φ) has three dials: amplitude A (how tall), frequency f (cycles per second) and phase φ (where in its cycle it starts). When two waves meet, their values simply add at every instant. This is the principle of superposition.
Waves of the same frequency that are in phase reinforce each other (constructive interference). Shift one by 180° and they cancel (destructive interference). Two waves with slightly different frequencies drift in and out of phase, so the loudness of their sum rises and falls: these are beats.
Fourier showed that the idea also runs backwards: any reasonable periodic signal can be written as a sum of sines at whole-number multiples of its base frequency. A square wave, for example, uses only the odd harmonics with amplitudes 1, 1/3, 1/5, ... Near a jump, a finite sum always overshoots by about 9% of the jump, however many terms you take. This is the Gibbs phenomenon.
Key formulas
A single sine wave
y(t) = A sin(2πft + φ)
- A
- amplitude
- f
- frequency in hertz; the period is T = 1/f
- φ
- phase, the starting angle
Beats (sum-to-product)
sin(2πf₁t) + sin(2πf₂t) = 2 cos(π(f₁ − f₂)t) · sin(π(f₁ + f₂)t)
- |f₁ − f₂|
- beat frequency: how many loud-quiet cycles per second
Fourier series (period 1)
square(t) = (4/π) Σk odd sin(2πkt) / k
sawtooth(t) = (2/π) Σk ≥ 1 (−1)k+1 sin(2πkt) / k
triangle(t) = (8/π²) Σk odd (−1)(k−1)/2 sin(2πkt) / k²
How to use this visualizer
- 1Compose waves: switch each wave on or off and set its amplitude, frequency and phase. The thick black curve is their sum. Try the Constructive and Destructive presets.
- 2Fourier series: pick a target shape and raise N. Watch the partial sum hug the dashed target more closely, and the spectrum fill in.
- 3Look at the corners of the square or sawtooth wave as N grows. The overshoot gets narrower, but the overshoot percentage stays near 9%.
- 4Beats: set f₁ and f₂ a little apart. The dashed envelope pulses at |f₁ − f₂| times per second; make them equal and the beating stops.
Where this shows up
Music and sound
Tuning by beats
Signal processing
Noise cancellation
Practice problems
Problem 1: Beats from two tuning forks
Show solutionHide solution
Beat frequency = |f₁ − f₂| = |440 − 444| = 4 Hz
The sum oscillates at the average frequency (f₁ + f₂)/2 = (440 + 444)/2 = 442 Hz
4 beats per second, heard at a pitch of 442 Hz
Problem 2: Square-wave harmonics
Show solutionHide solution
Only odd harmonics k = 1, 3, 5 appear, each with amplitude 4/(πk).
k = 1: 50 Hz, amplitude 4/π ≈ 1.273
k = 3: 150 Hz, amplitude 4/(3π) ≈ 0.424
k = 5: 250 Hz, amplitude 4/(5π) ≈ 0.255
50, 150 and 250 Hz with amplitudes 1.273, 0.424 and 0.255
Discussion
Questions, ideas or a different approach? Join the conversation.