Two ways to convolve
Take the echo h = [1, 0.5, 0.25] and the input x = [1, 2, 3]. Their ordinary, linear convolution is y = x ∗ h = [1, 2.5, 4.25, 2, 0.75]. That is 3 + 3 − 1 = 5 samples. Remember it.
The DFT turns convolution into multiplication. Take the 3-point DFTs X[k] and H[k], multiply them point by point, and take the inverse DFT. With the FFT this is fast for long lists. Do we get y back?
The inverse DFT gives back N = 3 numbers: c = [3, 3.25, 4.25]. Only the last one matches y. Multiplying N-point DFTs does not compute linear convolution. It computes circular convolution.
Convolution on a circle
An N-point DFT treats each list as one turn of a circle: index arithmetic wraps around, so with N = 3 index −1 is index 2. Flipped on the circle, h[(0 − k) mod 3] puts 1, 0.25, 0.5 under k = 0, 1, 2.
At n = 0 every input sample meets a weight: c[0] = 1·1 + 2·0.25 + 3·0.5 = 3. Linear convolution gave y[0] = 1. The extra 2 comes from the weights that wrapped around.
Rotate the weights one place right. The one that falls off the right end comes back on the left. c[1] = 1·0.5 + 2·1 + 3·0.25 = 3.25. On a circle, sliding becomes rotating: a circular shift.
c[2] = 1·0.25 + 2·0.5 + 3·1 = 4.25. One more rotation brings the weights back to n = 0, so c repeats every 3 samples. c = [3, 3.25, 4.25]: exactly what the DFT shortcut gave.
Wrap-around and the fix
Compare with linear y. Its last two samples, 2 and 0.75, have no room in 3 slots, so they wrap around and add onto the first two: 1 + 2 = 3, 2.5 + 0.75 = 3.25. This is time-domain aliasing.
The fix: give the result room. Append zeros so both lists have N ≥ 3 + 3 − 1 = 5 samples: x = [1, 2, 3, 0, 0] and h = [1, 0.5, 0.25, 0, 0]. Now the wrapped weights land on zeros.
Rotate through n = 0 to 4. Every product that wraps now meets a zero, so nothing folds back. c = [1, 2.5, 4.25, 2, 0.75]: the same five numbers as linear convolution.
In code
In Python 3 with numpy, fft(x, N) pads x with zeros to length N. Multiply the spectra, invert, keep the real part: [1, 2.5, 4.25, 2, 0.75]. scipy.signal.fftconvolve does all this for you.
The working
# step 1/11 · linear y[n] = Σ_k x[k]·h[n − k] x = [1, 2, 3] L = 3 h = [1, 0.5, 0.25] M = 3 y = [1, 2.5, 4.25, 2, 0.75] length L + M − 1 = 5 flip and slide in detail: see "Discrete convolution, step by step"
The echo h = [1, 0.5, 0.25] and the input x = [1, 2, 3] are chosen example values. Every number and stem in the figure is computed from the sums in this lesson's model; the tests check them against a direct DFT and against numpy's printed output. The DFT property behind the shortcut: the N-point DFT of a circular convolution is the product of the N-point DFTs (Oppenheim and Schafer, ch. 8). Inverting a product of N-point DFTs gives the linear convolution only when N ≥ L + M − 1; for a smaller N it gives, in general, the wrapped (circular) result.