ISEGORIA / MATH ENCYCLOPEDIA
Wavelets: zooming in on a signal
Fourier analysis tells you which frequencies a signal contains and nothing about when. Wavelets trade a little of that frequency precision for position, with short probes for high frequencies and long ones for low. A scalogram that follows a chirp and pins down a click, the Haar and Daubechies ladders of ever finer approximations, and the thresholding that makes wavelets the natural basis for compressing and cleaning signals with jumps.
Before you begin: Fourier analysis and inner product spaces
Predict, manipulate, then check your reasoning against the example and question. Graphs illustrate the mathematics; they do not replace a proof.
1. Time and frequency at once
The continuous wavelet transform compares a signal with shifted and stretched copies of one oscillating bump, the Morlet wavelet: a complex sinusoid under a Gaussian envelope. Shifting by b asks “when?”, stretching by s asks “at what frequency?”, and the squared modulus |W(s, b)|² paints the scalogram. Because the wavelet is stretched rather than refilled, it always holds the same number of cycles: at high frequency it is short, so a click is located sharply in time, and at low frequency it is long, so slow tones are resolved finely in frequency. Switch to the short-time Fourier transform to see the alternative, one window for every frequency, and drag the probe to see the atom it measures with.
Worked example. With \(\omega_0=6\) the Fourier period of the wavelet is \(\lambda=1.033\,s\), so a tone of 52 cycles per unit is picked up at scale \(s=1/(52\times1.033)=0.0186\). The envelope \(e^{-t^2/2s^2}\) has \(\sigma_t=s/\sqrt2=0.0132\) of the record and the frequency spread is \(\sigma_\omega=1/(\sqrt2 s)=38\) radians, \(6.0\) cycles. At 8 cycles per unit the box is \(6.5\) times longer and \(6.5\) times narrower: \(\sigma_t=0.086\), \(\sigma_f=0.93\). The product \(\sigma_t\sigma_\omega=1/2\) is the smallest that any signal allows, and only Gaussians attain it.
Watch out. The Morlet wavelet with the Fourier transform used here is analytic (no negative frequencies) and, for \(\omega_0\ge5\), admissible to within a part in \(10^5\); for smaller \(\omega_0\) it has a small nonzero mean and is not strictly a wavelet. The transform is computed with the FFT, which treats the record as periodic, so near the ends the scalogram mixes the beginning with the end: trust only the region inside the cone of influence. The scalogram is divided by \(s\) so that equal-amplitude tones appear equally bright; without that rectification \(|W|^2\) is biased toward large scales.
Why can no transform give perfect time and perfect frequency resolution together?
Because each coefficient is an inner product with an atom, and an atom cannot be concentrated in both time and frequency: if \(g\) has spread \(\sigma_t\) in time and its Fourier transform has spread \(\sigma_\omega\), then \(\sigma_t\sigma_\omega\ge1/2\). This is the same inequality as Heisenberg’s, since position and momentum wavefunctions are Fourier transforms of each other. A transform can only choose how to tile the time-frequency plane with boxes of area at least \(1/2\): the short-time Fourier transform uses one shape everywhere, the wavelet transform uses boxes whose aspect ratio follows the frequency.
2. The multiresolution ladder
An orthonormal wavelet basis is built as a ladder of approximation spaces V₀ ⊂ V₁ ⊂ V₂ ⊂ …, each one twice as fine as the last. The scaling function φ spans the coarsest rung; the wavelet ψ, shifted and halved again and again, carries exactly the detail that is lost when you step down a rung. One pair of filters, a lowpass h and a highpass g, does the whole job: convolve and keep every second sample, and the signal splits into a half-length average and a half-length detail. Repeat on the average and you have the fast wavelet transform, N numbers in, N numbers out, in O(N) operations. Drag the handle to keep more levels, or press Play to watch the approximation sharpen one rung at a time.
Worked example. Haar takes \(h=(1,1)/\sqrt2\) and \(g=(1,-1)/\sqrt2\): the averages and differences of neighbouring pairs. On the samples \((4,6,10,12)\) one step gives \(a=(10,22)/\sqrt2\) and \(d=(-2,-2)/\sqrt2\), and the energies agree: \(16+36+100+144=296=(100+484+4+4)/2\). Daubechies-4 has four taps, \(h=(0.483,0.837,0.224,-0.129)\), chosen so that \(g\) is orthogonal to both constants and straight lines. A linear ramp therefore produces zero detail at every level, apart from the wrap-around coefficient where the periodic signal jumps from its last sample back to its first.
Watch out. The transform here is periodic: the signal is treated as wrapping around, so a signal whose ends do not match acquires a spurious jump at the boundary, visible as large coefficients at the right edge of every row. Boundary-adapted wavelets avoid this at the cost of special filters near the ends. The Daubechies scaling function is not smooth: \(\varphi^{\rm D4}\) is continuous but only Hölder of exponent about 0.55, and the jagged shape drawn by the cascade is the real function, not a sampling artefact.
Why do the detail coefficients of a smooth signal shrink at fine levels, while those of a jump do not?
A wavelet with \(p\) vanishing moments is orthogonal to every polynomial of degree below \(p\). Expand a smooth \(x\) in a Taylor series over the short support of \(\psi_{l,k}\), of width about \(2^{-l}\): the polynomial part is invisible, and the remainder is of order \(2^{-lp}\), so after normalisation \(|d_{l,k}|\sim2^{-l(p+1/2)}\) and the coefficients die off geometrically. A jump is not a polynomial on any interval that contains it, so the one wavelet straddling it at each level sees a fixed step, and its coefficient decays only like \(2^{-l/2}\). That is why the large coefficients line up in a column above the jump.
3. Keep the big coefficients
In a good basis most coefficients of a signal are tiny, and throwing them away costs almost nothing. Piecewise-smooth signals are sparse in a wavelet basis, because only the few wavelets that straddle a jump see it, while in the Fourier basis a single jump spreads over every frequency. Sort the coefficients by size and keep those above a threshold λ: that is compression. Add noise and the same operation removes it, because white noise stays white in any orthonormal basis, spread thinly over all N coefficients, while the signal is concentrated in a few. Donoho and Johnstone’s universal threshold σ√(2 ln N) sits just above the largest noise coefficient you should expect. Drag the threshold and compare with Fourier truncation using exactly as many terms.
Worked example. For \(N=512\) samples and noise \(\sigma=0.1\), \(\lambda_U=0.1\sqrt{2\ln512}=0.353\). Each of the 512 noise coefficients is a Gaussian with standard deviation \(0.1\), and the chance that a given one exceeds \(3.53\sigma\) is \(4\times10^{-4}\), so on average a fifth of one noise coefficient survives. Blocks (eleven jumps, scaled to unit variance) is exactly sparse for Haar: 56 coefficients reproduce it perfectly, while the 56 largest Fourier coefficients leave an RMS error of \(0.25\). With the noise added, hard thresholding at \(\lambda_U\) brings the error in the default figure from \(0.104\) down to \(0.042\), with 57 coefficients kept.
Watch out. The universal threshold is designed to remove essentially all the noise, so it also removes small genuine features: it errs toward smoothness, and other rules (SURE, cross-validation) choose smaller thresholds that keep more detail. As is usual, the coarsest 16 coefficients (the average and the first four detail levels) are never thresholded. The noise level \(\sigma\) is known here; in practice it is estimated from the finest detail level, for instance as the median absolute coefficient divided by \(0.6745\). Soft thresholding shrinks every surviving coefficient by \(\lambda\), which is why it gives smoother but slightly flattened reconstructions; hard thresholding keeps them intact and is the right choice for pure compression.
Why does an orthonormal transform leave white noise white, and why does that make thresholding work?
If the noise vector \(z\) has independent \(N(0,\sigma^2)\) entries, its covariance is \(\sigma^2I\), and an orthonormal matrix \(W\) gives \(\operatorname{cov}(Wz)=W\sigma^2IW^{\mathsf T}=\sigma^2I\): the transformed noise has the same independent \(N(0,\sigma^2)\) entries. So in the wavelet domain the noise is spread evenly at level \(\sigma\) across all \(N\) coefficients, while a piecewise-smooth signal puts its energy into a few large ones. A threshold slightly above the noise maximum, \(\sigma\sqrt{2\ln N}\), then separates the two populations almost perfectly.