The Dirac Delta
The Dirac delta is an idealized impulse: infinitely short, infinitely tall, with area 1. It is not a function in the ordinary sense, but it is indispensable: it is the input that reveals a system's impulse response, its transform is the constant 1 (all frequencies equally), and pure tones have deltas as spectra. Osgood treats it carefully as a distribution; this lesson builds the working intuition.
A limit of pulses
Take narrower and narrower pulses of area 1, such as or Gaussians . None converges to a function, but their effect on a smooth does converge:
This sifting property is the definition: the delta is the operation "evaluate at a point".
import numpy as np
dt = 1e-5
t = np.arange(-1, 1, dt)
g = np.cos(3 * t) + t ** 2 # g(0) = 1, g(0.2) = cos(0.6) + 0.04
for eps in (0.5, 0.1, 0.01, 0.001):
pulse = np.exp(-np.pi * (t / eps) ** 2) / eps # area 1
shifted = np.exp(-np.pi * ((t - 0.2) / eps) ** 2) / eps
print(f"eps={eps:6}: area {np.sum(pulse) * dt:.4f} integral with g {np.sum(pulse * g) * dt:.6f}"
f" shifted {np.sum(shifted * g) * dt:.6f}")
print("g(0) =", 1.0, " g(0.2) =", round(np.cos(0.6) + 0.04, 6))eps= 0.5: area 1.0000 integral with g 0.875853 shifted 0.769820
eps= 0.1: area 1.0000 integral with g 0.994455 shifted 0.861037
eps= 0.01: area 1.0000 integral with g 0.999944 shifted 0.865292
eps= 0.001: area 1.0000 integral with g 0.999999 shifted 0.865335
g(0) = 1.0 g(0.2) = 0.865336
Transforms involving the delta
Plugging into the transform integral with the sifting property:
An impulse contains every frequency with equal strength, and a pure tone lives at exactly two frequencies. The second pair follows from the first by duality, which is how Osgood justifies giving the constant function and sinusoids a Fourier transform at all.
The discrete delta is easy
In discrete time there is no difficulty: is 1 at and 0 elsewhere, and its DFT is all ones. A tone that fits the frame exactly gives a DFT with exactly two nonzero bins, the discrete counterpart of the two deltas:
import numpy as np
N = 16
d = np.zeros(N); d[0] = 1
print("DFT of delta[n]:", (np.round(np.fft.fft(d).real, 6) + 0.0).tolist())
d3 = np.zeros(N); d3[3] = 1
print("|DFT| of delta[n-3]:", np.round(np.abs(np.fft.fft(d3)), 6).tolist())
n = np.arange(N)
X = np.fft.fft(np.cos(2 * np.pi * 2 * n / N))
print("DFT of cos(2 pi 2n/N):", (np.round(X.real, 6) + 0.0).tolist())DFT of delta[n]: [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
|DFT| of delta[n-3]: [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
DFT of cos(2 pi 2n/N): [0.0, 0.0, 8.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 8.0, 0.0]
The shifted delta has the same magnitude spectrum, all ones; the delay only changes the phase.
Properties worth remembering
- Scaling: .
- Derivative of the step: , the "slope" of a jump.
- Convolution identity: and (Convolution).
In software
- Impulse responses of rooms are measured by playing a click (or a sweep that is processed into the equivalent of a click) and recording the result; convolution reverb then applies that room to any sound.
scipy.signal.unit_impulse(N, idx)builds a discrete delta.
Exercises
Exercise 1: Sifting
Compute .
Answer
.
Solution
The delta picks out the value of at .
Exercise 2: Transform of a pair of impulses
Find the Fourier transform of .
Answer
.
Solution
. By duality this is the mirror of the fact that a cosine's spectrum is two deltas.
Exercise 3: Scaling the delta (code)
Check numerically by integrating a narrow Gaussian pulse evaluated at against .
Answer
The integral is 0.5.
Solution
import numpy as np
dt = 1e-5
t = np.arange(-1, 1, dt)
eps = 0.01
pulse_at_2t = np.exp(-np.pi * (2 * t / eps) ** 2) / eps
print(round(np.sum(pulse_at_2t) * dt, 6))0.5
Compressing the pulse by 2 halves its area, and the delta inherits that factor.
Test yourself
The sifting property says
- 1
The Fourier transform of is…
- the constant 1
- 0
The spectrum of consists of…
- one delta at
- two deltas at , each with weight 1/2
- a sinc
- a constant