TExcelTAD
Home › Fourier Analysis & Signals › The Convolution Theorem

The Convolution Theorem

The most useful fact in this course: convolution in time is multiplication in frequency. A filter that would take a long sum per output sample becomes a pointwise product of spectra. This turns filtering into "turn some frequency knobs down", explains why blurs remove detail, and makes the FFT the fastest way to convolve long signals.

The theorem

F(f∗g)=f^ g^,F(fg)=f^∗g^\mathcal{F}(f * g) = \hat{f}\, \hat{g}, \qquad \mathcal{F}(f g) = \hat{f} * \hat{g}

Proof sketch: write out ∫ ⁣ ⁣∫f(τ)g(t−τ)e−2πist dτ dt\int\!\!\int f(\tau) g(t - \tau) e^{-2\pi i s t}\, d\tau\, dt, substitute u=t−τu = t - \tau, and the double integral splits into ∫f(τ)e−2πisτdτ⋅∫g(u)e−2πisudu\int f(\tau) e^{-2\pi i s \tau} d\tau \cdot \int g(u) e^{-2\pi i s u} du. The exponential's property ea+b=eaebe^{a + b} = e^a e^b does all the work.

python · try it yourself
import numpy as np

dt = 0.002
t = np.arange(-10, 10, dt)
box = (np.abs(t) < 0.5).astype(float)
tri = np.convolve(box, box, mode="same") * dt       # Pi * Pi = Lambda

ft = lambda f, s: np.sum(f * np.exp(-2j * np.pi * s * t)) * dt
for s in (0.0, 0.3, 0.7, 1.5):
    lhs = ft(tri, s)
    rhs = ft(box, s) ** 2
    print(f"s={s}: F(box*box) = {lhs.real:+.5f}   F(box)^2 = {rhs.real:+.5f}   sinc^2 = {np.sinc(s) ** 2:+.5f}")
s=0.0: F(box*box) = +1.00000   F(box)^2 = +1.00000   sinc^2 = +1.00000
s=0.3: F(box*box) = +0.73684   F(box)^2 = +0.73684   sinc^2 = +0.73684
s=0.7: F(box*box) = +0.13534   F(box)^2 = +0.13533   sinc^2 = +0.13534
s=1.5: F(box*box) = +0.04503   F(box)^2 = +0.04502   sinc^2 = +0.04503

So Λ^=sinc⁡2\hat{\Lambda} = \operatorname{sinc}^2, the pair from The Fourier Transform, without computing any integral.

Filtering seen in frequency

A blur with a Gaussian kernel multiplies the spectrum by a Gaussian: high frequencies (fine detail, noise) are scaled down, low frequencies kept. Convolving two Gaussians gives a wider Gaussian, because the product of their spectra is a narrower Gaussian: variances add.

python · try it yourself
import numpy as np

N = 512
n = np.arange(N)
rng = np.random.default_rng(4)
x = np.sin(2 * np.pi * 5 * n / N) + 0.5 * rng.normal(size=N)

k = np.arange(-20, 21)
kernel = np.exp(-0.5 * (k / 4.0) ** 2); kernel /= kernel.sum()
padded = np.zeros(N); padded[k % N] = kernel                 # kernel centered at index 0, circularly
y_time = np.real(np.fft.ifft(np.fft.fft(x) * np.fft.fft(padded)))   # multiply spectra
y_conv = np.array([np.sum(x[(i - k) % N] * kernel) for i in range(N)])  # circular convolution sum
print("frequency-domain result equals direct convolution:", np.allclose(y_time, y_conv))

H = np.abs(np.fft.fft(padded))
print("filter gain at bins 0, 5, 20, 60, 128:", np.round(H[[0, 5, 20, 60, 128]], 4).tolist())
print("noise power before / after:", round(np.var(x - np.sin(2 * np.pi * 5 * n / N)), 3),
      round(np.var(y_time - np.sin(2 * np.pi * 5 * n / N)), 3))
frequency-domain result equals direct convolution: True
filter gain at bins 0, 5, 20, 60, 128: [1.0, 0.9703, 0.6176, 0.0131, 0.0]
noise power before / after: 0.251 0.022

The gain is nearly 1 at the signal's frequency (bin 5) and tiny at high frequencies, so most of the white noise is removed while the sine survives.

The other direction: windowing

Multiplying in time convolves in frequency. Cutting a signal to a finite window (multiplying by Π\Pi) convolves its spectrum with a sinc, smearing every sharp spectral line into a sinc shape. That is spectral leakage, the subject of Spectral Leakage.

In software

  • scipy.signal.fftconvolve and oaconvolve implement convolution via the theorem; cuDNN picks FFT-based convolution for large kernels.
  • Deconvolution (deblurring, removing a known echo) divides spectra, which is unstable where g^\hat{g} is near 0; Wiener filtering regularizes that division.

Exercises

Exercise 1: Convolution of Gaussians

What is e−πt2∗e−πt2e^{-\pi t^2} * e^{-\pi t^2}?

Answer

12e−πt2/2\frac{1}{\sqrt{2}} e^{-\pi t^2 / 2}.

Solution

The transform is e−πs2⋅e−πs2=e−2πs2=e−π(2s)2e^{-\pi s^2} \cdot e^{-\pi s^2} = e^{-2\pi s^2} = e^{-\pi (\sqrt{2} s)^2}. By the scaling rule this is the transform of 12e−π(t/2)2\frac{1}{\sqrt{2}} e^{-\pi (t/\sqrt{2})^2}.

Exercise 2: Which frequencies survive?

A signal contains 10 Hz and 50 Hz components. It is convolved with a kernel whose spectrum is 1 below 30 Hz and 0 above. What comes out?

Answer

Only the 10 Hz component.

Solution

The output spectrum is the product: the 10 Hz line is multiplied by 1 and the 50 Hz line by 0. This is an ideal low-pass filter.

Exercise 3: Check with sequences (code)

Verify the discrete theorem: for x=[1,2,3,0,0]x = [1, 2, 3, 0, 0] and h=[1,−1,0,0,0]h = [1, -1, 0, 0, 0], compare the inverse DFT of XHX H with np.convolve(x, h).

Answer

Both give [1,1,1,−3,0][1, 1, 1, -3, 0] when the arrays are padded long enough.

Solution
python · try it yourself
import numpy as np
x = np.array([1, 2, 3, 0, 0], dtype=float)
h = np.array([1, -1, 0, 0, 0], dtype=float)
via_fft = np.real(np.fft.ifft(np.fft.fft(x) * np.fft.fft(h)))
print((np.round(via_fft, 10) + 0.0).tolist(), np.convolve(x[:3], h[:2]).tolist())
[1.0, 1.0, 1.0, -3.0, 0.0] [1.0, 1.0, 1.0, -3.0]

The zeros at the end make room for the full linear convolution; without them the DFT computes a circular convolution that wraps around.

Test yourself

The Fourier transform of f∗gf * g is…

  1. f^+g^\hat{f} + \hat{g}
  2. f^g^\hat{f} \hat{g}
  3. f^∗g^\hat{f} * \hat{g}
  4. f^/g^\hat{f}/\hat{g}

Multiplying a signal by a window in time…

  1. multiplies the spectrum by the window
  2. convolves the spectrum with the window's transform
  3. has no effect on the spectrum
  4. shifts the spectrum

Why is deconvolution numerically hard?

  1. it needs complex numbers
  2. it divides by the kernel's spectrum, which may be near zero
  3. convolution is not linear
  4. the FFT cannot be inverted