Exercises
August 25, 20267 min readbeginner
Several notes in this chapter end with small checks of their own. These are the chapter-wide set, drawing on all nine notes.
Several notes in this chapter end with small checks of their own. These are the chapter-wide set, drawing on all nine notes.
01.1. Closure
For each of , , , and , decide closure under , , , and division by non-zero elements.
Answer.
as ordinary integers is closed under none of them. escapes, escapes, escapes, escapes. (Under arithmetic modulo 5 it is closed under all four, which is the point The Ring makes.)
is closed under , and , but not division: .
is closed under all four, which is what makes it a field.
is closed under all of , and , since sums and products of such fractions keep an odd denominator. Division fails: has an even denominator. So this is a ring but not a field, and a useful reminder that "contains fractions" and "is a field" are different claims.
02.2. Clock arithmetic
Compute and , and verify .
Answer. , so .
For : the representative in is found by adding multiples of 12 until non-negative. , so .
Checking the congruence: , a multiple of 12, so .
The sign convention matters and is a common source of bugs. Many programming languages return for -37 % 12, not . The mathematician's always lands in , which is the convention Modular Arithmetic uses throughout.
03.3. A field and a non-field
Find in . Then show is not a field.
Answer. In , try multiples of 3: . The fifth gives , so .
For , take the element . Its multiples are , cycling through five values and never reaching . So has no inverse and is not a field.
The reason is the criterion from The Ring : is composite, and any element sharing a factor with the modulus is a zero divisor rather than a unit. Here , so and multiply to zero without either being zero.
04.4. Extended Euclid
Find integers with , and conclude .
Answer. Run the Euclidean algorithm on and :
Back-substitute from the remainder :
So and .
Reducing modulo 17, , so .
This is the general method behind the trial-and-error of exercise 3, and it is what an implementation uses. It also computes the Montgomery constant in Chapter 7.
05.5. Polynomial multiplication modulo 7
Compute in .
Answer. Multiply first over the integers, pairing every term with every term:
Then reduce each coefficient modulo 7: , , , . So
Note there is no reduction in the exponent here. allows arbitrary degree, and only the coefficients live modulo 7. Cutting the degree down is the separate step that Quotient Rings and Ideals introduces.
06.6. Polynomial long division
Divide by over .
Answer. The quotient is and the remainder is .
Check by multiplying back:
So the division is exact, and holds trivially since . This is the factorisation that makes reducible, which matters when choosing a modulus polynomial: a reducible one would make the quotient ring have zero divisors.
07.7. Negacyclic reduction in general
In for any and , compute and then .
Answer. , and the defining rule of is . So the product is , a constant.
That is worth pausing on. Two polynomials of positive degree multiplied to give a constant, which cannot happen in . The quotient construction is what makes it possible.
For : write it as .
The general rule is that any exponent folds down to , and exponents beyond fold twice and come back positive.
8. A full product in
Compute in with .
Answer. Schoolbook first:
Then reduce with , so the term becomes and lands on the constant:
All coefficients are already in , so the modular step changes nothing.
The constant coefficient vanishing is the negacyclic flip doing exactly what it does in ML-KEM's toy example, where the same mechanism turned into .
09.9. Checking an ML-KEM parameter, and a correction
Verify that is prime, and check whether .
Answer. is prime. Trial division by every prime up to finds no factor.
The second claim is false, and the exercise is worth doing precisely because of that.
The manuscript this chapter was migrated from asserted and asked the reader to confirm it. It cannot be confirmed, because it is not true, and the falsehood is not incidental. The condition with is exactly the requirement for a length-256 negacyclic transform, and ML-KEM famously does not satisfy it. That is the quirk in Chapter 4, the reason the transform runs seven levels instead of eight.
What is true is the weaker statement
which is what gives ML-KEM its primitive th root of unity and its incomplete transform.
So the corrected exercise is: verify that is prime, that divides , and that does not. All three are checkable in a minute, and together they explain a design decision that echoes through the rest of the book.