Exercises
August 25, 20266 min readbeginner
Let q = 97 and n = 8. Does F_97 contain a primitive 16th root of unity? Find one if so.
1. Does support a length-8 transform?
Let and . Does contain a primitive th root of unity? Find one if so.
Answer. The condition from Roots of Unity in a Finite Field is . Here , and divides it. So yes.
To find one, take a generator of and raise it to the power . The element is a generator, and .
Check the order of : , and . Since , the order is exactly .
So works, and the eight evaluation points for a negacyclic transform are its odd powers modulo : . Each raised to the eighth power gives , confirming they are the roots of .
02.2. ML-KEM's evaluation points
For , , , describe the evaluation points of ML-KEM's length-128 transform and explain why there are half as many as a length-256 transform would use.
Answer. has order exactly , not , because has only eight factors of two.
A complete length-256 negacyclic transform would need a primitive th root and would evaluate at its odd powers. No such root exists here.
What is available is the points , the odd powers of a th root. Each satisfies , so they are the roots of .
Evaluating at points splits the degree-255 polynomial into pieces of degree less than , not pieces of degree less than . That is the incomplete transform, and the missing level is exactly the one the absent factor of two would have provided.
03.3. Run the butterflies
Run the Cooley-Tukey forward transform on over with , then bit-reverse and check against direct evaluation.
Answer. Worked in full in The Butterfly and Bit Reversal. Level one uses twiddle and pairs entries two apart, giving . Level two uses twiddles and on adjacent pairs, giving .
Bit-reversing two-bit indices swaps positions 1 and 2, turning into , which is the direct evaluation from The Negacyclic NTT.
Four butterflies, four multiplications, against sixteen for direct evaluation. At that is a tie once the twiddle setup is counted, which is the honest caveat from the overview.
04.4. Invert the transform
Apply the inverse transform to and confirm it gives .
Answer. The inverse from The Negacyclic NTT is
Here and .
Carrying out the four sums gives , which is computed directly in in that same note.
The prefactor is what distinguishes this from an ordinary inverse DFT. Dropping it produces a cyclic rather than negacyclic result, and the symptom is that the answer is right in its first half and wrong in its second.
05.5. The negacyclic circulant
Write out the negacyclic circulant of in and verify it against the polynomial product with .
Answer. Built in Ring-LWE:
Multiplying by and reducing modulo gives , which is exactly computed as a polynomial product with .
The sign pattern is the reduction rule showing up as matrix structure. Each column is the previous one shifted down with the wrapped entry negated.
06.6. How many equations does one Module-LWE sample carry?
Show that Module-LWE with rank and degree gives scalar equations per sample, and compare with plain LWE.
Answer. A Module-LWE sample is with a single polynomial. Each of its coefficients is one scalar equation in the unknown coefficients of , of which there are . So one sample yields equations in unknowns.
Note this is equations per sample, not . The enters as the number of unknowns, so roughly samples are needed before the system is determined.
Compare the storage. Plain LWE producing equations in unknowns needs separate vectors of length , so stored values. Module-LWE needs , which is polynomials, so values. A factor of , which is the compression from Ring-LWE.
07.7. Butterfly gate count
Estimate the two-input XOR gates in one radix-2 butterfly over with , given an external multiplier.
Answer. With the multiplication provided, the butterfly is and , so what remains is one modular addition and one modular subtraction on 23-bit values, plus the reduction.
A 23-bit ripple-carry adder is 23 full adders, and a full adder is two XORs plus supporting gates, so about XOR gates per adder. Subtraction is an addition with an inverted operand, so another plus the inversion.
Modular addition needs a conditional subtraction of , which is a second adder plus a select, roughly doubling it. So the order of magnitude is to two-input XOR gates per butterfly, exclusive of the multiplier and its reduction.
The figure is an estimate rather than a synthesis result, and the point of computing it is the ratio rather than the number: the multiplier and its reduction dominate, which is why Chapter 7 is about reduction and not about adders.