Last lesson built vectors, matrices, and constraints out of dot products. This lesson meets one of the most important algorithms in ZK: the FFT, and its finite-field version, the NTT. Its job is simple to state — multiply polynomials fast — and it needs exactly the roots of unity from Topic 19 and the matrix-times-vector idea from Topic 22. One example carries the whole lesson: times , mod the prime .
The slow way
Before building something fast, it helps to see exactly what’s slow about the obvious method.
Multiplying two polynomials with coefficients each the schoolbook way takes multiplications — every coefficient of one against every coefficient of the other. For coefficients that’s multiplications; for , that’s a million. Real proofs work with polynomials far larger than that.
Values instead of coefficients
Here’s the key idea that makes everything else in this lesson possible: multiplying polynomials and multiplying their values at the same points are the same operation.
A degree- answer needs at least points to pin it down; — the th roots of unity — is the convenient choice, because they form a structured set. At each point, multiplying is a single multiplication, not a grid of pairs. The catch: finding the values in the first place still costs something. That’s what the next three sections fix.
The transform as a matrix
Evaluating a polynomial at every root of unity at once has a single formula — and it’s exactly a matrix times a vector, the operation from last lesson.
Row , column of this matrix holds , and multiplying it by the coefficient vector evaluates the polynomial at every root of unity simultaneously — each output entry is one row dotted with the coefficients. This matrix has a name, the DFT matrix, but computing times a vector directly still costs multiplications. The structure inside is what the next section exploits.
The fast trick
This is the heart of the FFT: split the polynomial into even and odd halves, notice that and square to the same value, and combine two half-size results with a plus and a minus.
Splitting into its even-power and odd-power terms gives two half-size polynomials, and . Because and have the same square, evaluating at a root and its negation only needs and at one shared point each — one addition and one subtraction recovers both values. Repeating this split on each half, recursively, turns work into about : for a million coefficients, roughly million steps instead of a trillion.
Coming back to coefficients
The round trip needs a way back: from values to coefficients. It turns out to be the exact same algorithm, run with the inverse root, then scaled down.
Running the transform with instead of , then multiplying every entry by , undoes the forward transform exactly — the same matrix structure, just with the inverse root and a final scaling. The full pipeline: transform both polynomials to values, multiply pointwise, transform back — and with the fast trick on both ends, every step is cheap.
Where this shows up
Three ideas: the slow cost that motivates everything, the fast trick that fixes it, and where fields with the right structure make this work at ZK scale.
Schoolbook multiplication costs ; splitting into even and odd parts brings that to about . This only works when the field has enough roots of unity to split all the way down — real proof systems choose their field so that is divisible by a large power of : BN254’s scalar field has roots of unity of order , and BLS12-381’s has order . So far every polynomial here has had one variable; the next lesson gives them several.
- Multiplying two polynomials the schoolbook way costs multiplications; multiplying their values at shared points instead costs only — one multiplication per point.
- Evaluating a polynomial at every root of unity at once is a matrix times its coefficient vector, where row , column holds .
- The FFT speeds this up by splitting into even and odd parts and using that and square to the same value, so each pair of points shares one dot product; repeating the split brings the cost to about .
- The inverse transform is the same algorithm run with instead of , followed by dividing every entry by .
- Real pairing-friendly curves are chosen so has a large power of as a factor, giving a field with enough roots of unity for the FFT to split all the way down.