Fast Fourier Transform
Multiplying two degree- polynomials by the schoolbook method costs . Evaluating them at the **-th roots of unity turns multiplication into pointwise products, and the Cooley–Tukey FFT** computes all those evaluations in by splitting even and odd coefficients.
╌╌╌╌
Karatsuba cut integer multiplication below quadratic by trading one multiplication for a few additions, reaching . This lesson goes further, to , with the Fast Fourier Transform. The route is indirect. The obstacle to fast multiplication is the coefficient representation of a polynomial, in which the product is a convolution costing . If instead we represent a polynomial by its values at enough points, the product is computed pointwise in linear time. The FFT converts between the two representations in , and the points it chooses — the complex roots of unity — are what make that conversion fast.
The problem: polynomial multiplication is convolution
A polynomial of degree is given by its coefficient vector , meaning . The product has coefficients
This sum is the convolution . Computed directly, each of the output coefficients is a sum over up to products, so the cost is — the schoolbook method, and exactly the cost of grade-school long multiplication when and are the digit vectors of two integers. Convolution is everywhere (signal filtering, string matching, probability of sums), so a faster algorithm pays off far beyond polynomials.
A polynomial is its values
A degree- polynomial is uniquely determined by its values at any distinct points — the interpolation fact that points fix a degree- curve (two points fix a line, three fix a parabola). So besides the coefficient vector there is a second, equally faithful description: the point-value representation, a list of pairs .
In this representation, multiplication is cheap. If and are both sampled at the same points , then the product is sampled there by a single multiply per point:
That is work, not . The catch is that the product has degree up to , so points are needed to determine it; we must therefore sample and at (at least) points up front, padding their coefficient vectors with zeros to length . The strategy is now a three-step detour:
Evaluate, multiply pointwise, interpolate. The middle step is linear, so the total cost depends on the two end steps: evaluating a polynomial at points, and recovering coefficients from values. Naively each is (evaluating at one point by Horner's rule is , times points), so a poor choice of points gains nothing. For one special set of points, both steps drop to .
The roots of unity
The special points are the -th roots of unity: the complex numbers with . They are equally spaced around the unit circle in the complex plane,
where is the principal -th root and its powers enumerate all of them. Geometrically, multiplying by rotates a point by radians; such rotations come full circle back to the start, which is the statement .
Two algebraic properties of these points make the FFT work.
The evaluation points, when squared, become only distinct points, and they pair up as of each other. These two facts turn one size- evaluation into two size- evaluations.
The DFT and the Cooley–Tukey split
Evaluating at all roots of unity is, by definition, the Discrete Fourier Transform of its coefficient vector.
Computed as written, that is evaluations of an -term sum: . The FFT computes the same vector in by a divide-and-conquer split on the parity of the coefficient index. Separate into its even- and odd-indexed coefficients and factor an out of the odd part:
where and are each polynomials of half the degree, in the variable . Repeating the split recursively builds a tree: at each level the input is sorted by parity into two halves, dark for the even indices and light for the odd, until single coefficients sit at the leaves.
Now evaluate at a root . By the halving lemma, , so
The right-hand side asks for and evaluated at the -th roots of unity — two DFTs of size . And here the pairing pays off: the point squares to the same , so the two half-size results serve both and at once, with only a sign flip on the odd part:
These paired equations are the butterfly: two outputs assembled from two inputs by one multiply ( times the odd value, the twiddle factor) and one add/subtract. A full level of butterflies combines two half-DFTs into one full DFT in work.
Recursing this split bottoms out at size- DFTs (a single coefficient evaluates to itself), and at every level above it does combining work, giving the recurrence
This is the mergesort recurrence. By the Master Theorem (, , , the balanced case ), it solves to
- 1
- 2if then returnsize-1 DFT is the identity
- 3even-indexed
- 4odd-indexed
- 5half-size DFT
- 6half-size DFT
- 7
- 8for to do
- 9twiddle the odd part
- 10butterfly: top output
- 11butterfly: bottom output
- 12advance to next root
- 13return
The algorithm requires to be a power of two so the halving is exact; pad the coefficient vector with zeros up to the next power of two (and to at least , for the product's degree) before transforming. A non-recursive, in-place variant first permutes the inputs into bit-reversed order and then runs the butterflies bottom-up, which is what production libraries implement, but the recursion above is the cleanest statement of why it is .
Inverting the transform
Evaluation is half the round trip; we still must turn the product values back into coefficients — the inverse DFT. The DFT is a linear map, multiplication of by the matrix with (a Vandermonde matrix at the roots of unity). Its inverse has a simple form.
The consequence is that the inverse transform is the same algorithm: replace by its conjugate , run unchanged, and divide every output by . We never invert a matrix or solve a linear system — interpolation at the roots of unity is just another FFT.
Putting it together: fast multiplication
The three-step plan now has an cost on every leg. Pad and to length , the next power of two ; transform both; multiply the two value vectors pointwise; inverse-transform. Three FFTs plus one linear pointwise multiply:
- 1next power of two
- 2pad with zeros to length
- 3evaluate at the -th roots
- 4
- 5for to do
- 6pointwise product
- 7inverse FFT (conjugate roots, /N)
- 8returnthe convolution
Worked example (a size- transform). Take , coefficient vector padded to length . The -th roots of unity are . Splitting by parity, gives (a constant evaluates to itself at both nd roots), and gives . The butterflies with twiddles and assemble
Check directly: , , , — the transform is exactly evaluated at the four roots. To square (compute ), multiply the transform pointwise — — then run the inverse FFT (conjugate roots, divide by ), recovering , the coefficients of .
This is the asymptotic payoff that beats both schoolbook and Karatsuba's . The application that started us off, big-integer multiplication, is the same algorithm: an -digit integer in base is the polynomial evaluated at , so multiplying two big integers is multiplying their digit polynomials, then carrying the over-large coefficients — the problem behind Multiply Strings, and at large enough sizes it is what bignum libraries do; the same FFT pipeline (with carries) is the route from Karatsuba's down toward the near-linear that the divide-and-conquer lesson flagged as the next rung. Add Two Numbers shares the carry mechanics on a per-digit scale.
The FFT beyond powers of two
Cooley and Tukey's 1965 paper is one of the most-cited in all of computing, and the ideas around it stretch from signal processing to the fastest multiplication algorithm known.
Not just powers of two. The recursion above needs to be a power of two. Real FFT libraries handle any length by mixed-radix splitting (factor and do transforms of size then of size ), and for a prime length they use Bluestein's algorithm, which re-expresses the size- DFT as a convolution and pads that to a convenient power of two.2 So the bound holds for every , not only the padded powers of two — a detail that matters when you cannot afford to round the transform size up.
The FFT was not new. Cooley and Tukey rediscovered and popularized the algorithm, but Gauss had written down the same even/odd recursion around 1805 to interpolate asteroid orbits — before Fourier's own work was published.3 The 1965 paper's real impact was timing: it arrived just as digital computers made spectral analysis suddenly practical, launching modern digital signal processing.
Toward optimal multiplication. FFT-based multiplication leads to the asymptotically fastest integer multiplication known. Schönhage–Strassen (1971) runs the transform over a ring of the form — no floating-point, no NTT-prime constraints — to multiply -bit integers in .4 The factor stood for nearly fifty years until Harvey and van der Hoeven (2021) reached the conjectured optimum .5 These are galactic algorithms — the crossover point is enormous — but Schönhage–Strassen is genuinely used by GMP for numbers beyond a few tens of thousands of digits.
Beyond multiplication. The same transform accelerates string matching (match a pattern against a text by convolving indicator vectors, catching wildcards), the computation of the autocorrelation and power spectrum of a signal, large-scale polynomial interpolation, and the multiplication step inside the Fiduccia/Kitamasa recurrence solver from the matrix-exponentiation lesson. All of these reduce to convolution, which the FFT makes cheap.
Takeaways
- Multiplying polynomials (or big integers) is convolution, in the coefficient representation; but in the point-value representation the product is a pointwise multiply at shared sample points.
- The bottleneck is converting between the two forms. Sampling at the -th roots of unity makes both conversions cheap because squaring halves the root set and the second half is the negation of the first.
- The DFT evaluates at all roots of unity; the Cooley–Tukey FFT splits on even/odd coefficient parity into two half-size DFTs combined by butterflies, giving by the Master Theorem.
- The inverse FFT is the same algorithm with conjugate roots and a scaling, because the DFT matrix's inverse is (a geometric-series argument).
- Three FFTs plus a pointwise multiply give polynomial and big-integer multiplication; the NTT does the same exactly modulo a prime.
Footnotes
- CLRS, Ch. 30 — Polynomials and the FFT: the coefficient and point-value representations, the recursive Cooley–Tukey FFT with the recurrence, the inverse DFT via , and polynomial multiplication. ↩
- L. Bluestein,
A linear filtering approach to the computation of discrete Fourier transform,
IEEE Trans. Audio and Electroacoustics 18(4), 1970; the chirp-z transform for arbitrary and prime lengths. ↩ - M. T. Heideman, D. H. Johnson, C. S. Burrus,
Gauss and the history of the fast Fourier transform,
IEEE ASSP Magazine 1(4), 1984 — tracing the algorithm to Gauss (c. 1805), before Cooley–Tukey (1965). ↩ - A. Schönhage and V. Strassen,
Schnelle Multiplikation großer Zahlen,
Computing 7, 1971 — integer multiplication in . ↩ - D. Harvey and J. van der Hoeven,
Integer multiplication in time ,
Annals of Mathematics 193(2), 2021. ↩
╌╌ END ╌╌