Transforms · Part 1
Fourier Is the Eigenbasis of Convolution
Blur an image through the FFT and structures from the right border turn up on the left side. You never picked a border mode, so who picked wrap?
The left edge knows the right edge
Say you want to blur an image sideways, the way a camera smears a scene that moves during the exposure. The kernel is nothing fancy, a row of 81 equal weights. And there is a fast way to do it: the convolution theorem turns convolution into multiplication, so you Fourier transform the image and the kernel, multiply the two, and transform back. The star comes out the way a moving star should. But at the left edge, where the image was dark, a strip of teal, orange and magenta has appeared, in the same order as the bands that leave the picture on the right.
the image
blurred by FFT ✗
blurred pixel by pixel ✓
Convolve pixel by pixel and you have to decide what lies beyond the edge. The filter functions you know all take a border mode: constant, replicate, reflect, wrap. The Fourier route asked you nothing, and it picked wrap anyway. The standard advice is to pad the image with zeros first. That makes the strip go away, but it does not tell you who put it there.
So who glued the right edge to the left? The FFT algorithm, the theorem, or something you asked for without noticing?
To answer that, we have to step back from the picture for a while. The trail leads through a list you already know, and the picture comes back as soon as we know where that list comes from.
The list everyone knows
You know the Fourier transform by what it does. Somewhere in a course or a textbook you met a table like this one, and you have used most of its lines since.
| In the signal | In the spectrum |
|---|---|
| Convolve with a kernel | Multiply by its spectrum |
| Shift | Multiply by a phase |
| Differentiate | Multiply by the frequency |
| Filter a sine wave | Same frequency comes out |
| Sum the squares | Same sum (Parseval) |
| Take N samples | They repeat with period N |
In most textbooks each line comes with its own proof. An integral is rearranged, a variable substituted, two sums swapped, the 2π parked wherever your textbook keeps it, and the line is done. The next line gets a new proof with a new trick, and nothing in those proofs connects one line to the next.
That is a lot of luck for one transform.
The six lines share a single cause. To find it, we ask convolution which signals it only stretches.
Stop describing, start diagonalizing
A matrix is easiest to understand through its eigenvectors, the directions it only stretches:
Measure a vector along those directions instead of along the usual axes, and the matrix becomes harmless. It stretches each coordinate by its own number, and the coordinates never mix. That is all a diagonal matrix is: separate multiplications.
So we go looking for the same thing in convolution: a signal that comes out the same shape it went in, just at a different height. Fig. 2 blurs two candidates with the same box kernel, half a period long.
The search is shorter than it looks, because a convolution does the same thing everywhere on the signal. That is written right in the integral:
Read it as a recipe. Shift by every , weight each copy by , add them up. A convolution is a weighted sum of shifts, so whatever survives every shift in shape survives every convolution too.
So ask the shift. A signal survives a shift by in shape if, for some factor and for every ,
Differentiate with respect to at and this becomes with , whose solutions are up to a constant factor. For a signal that does not blow up in either direction, must be imaginary, . What survives every shift is the complex exponential , and nothing else. The whole argument rested on one thing: , for every and every . On the real line that value always exists.
Now put into the convolution:
The exponential comes out as itself, times the number in brackets. That number is the Fourier transform of the kernel, , written exactly as the textbook defines it. Call the exponential and the result reads like the matrix line above:
is an eigenvector of every convolution, and is its eigenvalue.
A spectrum is a list of eigenvalues.
The Fourier transform is the same move we made on the vector: it measures the signal along the exponentials. Every reasonable signal can be put together from them, and putting it back together is the inverse transform's job. Side by side, the matrix version and the signal version:
Read the right one from the inside out. takes the signal into the eigenbasis, multiplies each coordinate by its own eigenvalue, brings it back. It is the recipe you used on the star in Fig. 1, and it is line 1 of the list: convolve in the signal, multiply in the spectrum. The rest of the list goes just as fast.
The list, one line at a time
Convolution becomes multiplication. Already done. Apply to both sides of the diagonalization:
A shift becomes a phase. A shift by is a convolution too: its kernel is a single unit spike sitting at , zero everywhere else. Its spectrum costs nothing, because the integral only sees the one point where the spike sits:
By the line above, a shift multiplies each coordinate of the spectrum by : the shift's eigenvalues, all of magnitude one. A shift makes nothing louder or quieter; it only turns each frequency by an angle. That is the phase.
A derivative becomes a multiplication by the frequency. The difference quotient is a difference of two shifts, and both shifts return as a multiple of itself, so the quotient does too, for every . Which multiple the limit lands on is plain differentiation:
A sine wave comes out as a sine wave. Fig. 2 showed it. A cosine is two exponentials, , and each comes out scaled by its own eigenvalue. For a real kernel the two eigenvalues are complex conjugates, so the sum is a cosine again, scaled by and shifted by the angle of . For the box in Fig. 2 that angle is zero and , which is the 64%.
Energy stays the same. A shift moves a signal without changing its energy. For an operator like that, eigenvectors with different eigenvalues are orthogonal, just as the eigenvectors of a symmetric matrix are. Switching to an orthogonal basis is a rotation, and a rotation keeps lengths. With :
The in front is the parked 2π, turning up again.
Five lines, one fact.
| Convolve with a kernel | Multiply by its spectrum | ✓ |
| Shift | Multiply by a phase | ✓ |
| Differentiate | Multiply by the frequency | ✓ |
| Filter a sine wave | Same frequency comes out | ✓ |
| Sum the squares | Same sum (Parseval) | ✓ |
| Take N samples | They repeat with period N | ? |
Every line of the list has fallen out of the eigenbasis. All but the last.
Theory or algorithm?
Back to the star in Fig. 1, and to the three suspects. The FFT goes first, and it is cleared at once: it is a fast way to compute the discrete Fourier transform, the DFT, and nothing more. Compute the DFT the slow way, straight from its definition, and the colored strip turns up at the left edge all the same, down to rounding.
So the FFT is innocent. The theorem is next. A reader who knows the DFT has two answers ready, and both are true.
“The basis functions repeat.” The DFT builds every signal from , each of those repeats after samples, so anything built from them repeats too. Correct, and it moves the question one level down. On the real line, the derivation found an eigenvector for every frequency , a continuum of them. On samples the DFT offers exactly , the frequencies . Step through one of those sample by sample and after steps you are back at the start: the walk closes into a circle. For every other it never closes. Why exactly those?
“The convolution theorem only holds for cyclic convolution.” Textbooks that state the discrete theorem say so. Also correct, and it moves the question down as well: why only there, and not for the clamped border that the pixel-by-pixel blur in Fig. 1 used?
Both answers describe the circle. Neither says why the eigenbasis needs one. To find out, go back to the one step in the derivation that leaned on the real line: for every and every . On samples, that is the first thing to break.
Eight samples and a shift
Take eight samples and do what the derivation did: assume the exponentials survive the shift, and see what that demands. Write into positions 0 to 7 and shift everything one place to the right. Positions 1 to 7 are no problem. Each receives its left neighbor:
So the factor is fixed at . But position 0 has no left neighbor, the neighbor the real line always provided. Someone has to put a value there, and that someone is the border mode. For the exponential to survive, it must be , the value one step before the start.
Constant offers 0, and an exponential is never 0. Replicate and reflect offer , which matches only for : the one exponential left is the flat line. Wrap offers , which matches when
Eight frequencies on eight samples: a full basis, and exactly the one the DFT uses. Asking for the exponentials leaves one border mode standing, and it brings the DFT’s frequencies with it.
The same goes for every convolution, because the shift is one of them, with a single spike as its kernel. The discrete convolution theorem needs the eigenbasis, and the eigenbasis needs wrap. That is why the theorem only holds for cyclic convolution.
So it was you. Multiplying in the Fourier domain means asking for the eigenbasis, and of the border modes on offer, only the circle keeps the exponentials. The right edge was glued to the left the moment you chose the Fourier route. In two dimensions the same argument runs down the columns, so the top is glued to the bottom as well. The image you blurred in Fig. 1 was a donut.
The bill for the circle
Each of the standard remedies is a way of living on the circle.
Padding makes the circle larger than the image. Pad each row by at least half the kernel, blur through the FFT, crop, and the wrap happens in the padding, where nobody looks. What you pad with is the border mode. Pad with the edge values and the result matches the pixel-by-pixel blur of Fig. 1. The zero padding from the forums is the constant mode.
by FFT, no padding ✗
by FFT, padded with the edge values ✓
Windowing pays the same bill in spectral analysis. The DFT reads a stretch of signal as one period of a circle. If the two ends do not meet, the circle has a jump at the seam, and a jump takes exponentials at every frequency to build. That spread is leakage. A window tapers both ends towards zero so the seam closes, and reflect padding mirrors the signal so the seam has no jump at all.
Five lines of the list were one fact, and the sixth was its price. One consequence of the first line is still waiting. If convolution becomes a multiplication, then deconvolution obviously becomes a division.
Case closed?
The argument, the outline and the final wording are mine, argued out sentence by sentence. AI assistance wrote the drafts in between, built the figures and recomputed the numbers.