The Negacyclic NTT
August 25, 20266 min readbeginner
Everything is now in place. This note states the transform, computes one completely by hand, and checks that it does what it is supposed to do.
Everything is now in place. This note states the transform, computes one completely by hand, and checks that it does what it is supposed to do.
01.The definition
Assume divides , and let be a primitive th root of unity in .
For in , the negacyclic NTT is
Read it as what it is: evaluate the polynomial at each of the odd powers of . Nothing more.
The inverse recovers the coefficients:
The factor out front is the fingerprint of the negacyclic version. An ordinary inverse DFT has only the and the sum. That extra twist is what undoes the odd-power evaluation grid.
02.A complete worked transform
Take , , , and the evaluation grid from Roots of Unity in a Finite Field.
Transform
At . Powers: , .
since .
At . Reduce the powers first: , and , since .
At . Easier as . Then and .
At . As : , and .
So
03.Checking that it multiplies
The claim to verify is that pointwise multiplication in the transformed domain corresponds to negacyclic multiplication in .
Take a second polynomial, , so . Evaluating at the same four points:
So .
Multiply pointwise modulo :
using and .
Now compute the same product the slow way, directly in :
The term must be reduced. In the rule is , so becomes , and it lands on the constant coefficient:
So the coefficient list is .
Transform that directly and see whether it agrees. Evaluating at :
since . That matches the first pointwise product. The remaining three match as well, giving both ways.
The transform is multiplicative. Applying the inverse to returns , which is the product.
04.The full multiplication procedure
Collecting it into the recipe an implementation follows:
- Transform . Cost: one NTT.
- Transform . Cost: one NTT.
- Multiply the two transforms pointwise. Cost: multiplications.
- Inverse-transform the result. Cost: one inverse NTT.
Three transforms and one cheap pointwise step, replacing coefficient multiplications.
There is a detail worth noting because it changes how real code is organised. Many quantities get multiplied repeatedly. In ML-KEM the public matrix is used in every operation, so it is stored already transformed and steps 1 through 4 shrink to steps 3 and 4 alone. FIPS 203 in fact specifies the public key in the transformed domain, so the transform never has to be applied to it at all. Keeping data in the NTT domain for as long as possible is one of the main structural optimisations in every implementation.
05.What this cost
Being honest about the running example: it saved nothing.
Direct evaluation at four points, with four coefficients each, is multiplications. Schoolbook multiplication of two length- polynomials is also . At the transform is a demonstration, not an improvement.
The saving requires two things that does not provide. The transform has to be computed by the fast recursive method rather than by direct evaluation, which is the next note. And has to be large enough for to beat by a worthwhile margin.
At it does. Schoolbook is multiplications. The three-transform route is about . That is the factor of twenty, and it only appears once the transform itself stops costing .