Quotient Rings and Ideals
August 25, 202611 min readbeginner
The previous note ended with a problem: polynomial multiplication in Z_q[X] keeps growing the degree, but cryptography needs the elements to live in a fixed-size space.
The previous note ended with a problem: polynomial multiplication in keeps growing the degree, but cryptography needs the elements to live in a fixed-size space. The fix is the same trick we already used for integers, just lifted to polynomials. With integers we picked a modulus and worked modulo . With polynomials we pick a polynomial modulus and work modulo . This note builds that construction up, names the pieces formally (ideals, quotient rings), and shows the worked-example version that the next note will turn into the cryptographic ring .
01.Polynomial long division
To reduce one polynomial modulo another we need a notion of "remainder" for polynomials. The algorithm is long division, the same idea you saw for integers in school, but with polynomials in instead of digits.
A worked example over first, before we add the modular twist. Divide by .
Step 1. The leading term of the dividend is , and the leading term of the divisor is . The quotient term needed to kill is . So the first quotient term is .
Step 2. Multiply the divisor by this quotient term and subtract:
Step 3. The remaining polynomial has degree , which is strictly less than the divisor's degree . The division terminates.
We have written
The quotient is and the remainder is . Just like integer division: , with the remainder strictly smaller (in degree) than the divisor.
This is the polynomial division algorithm in a nutshell. As long as you are dividing in a ring where the leading coefficient of the divisor is invertible (always true if the divisor is monic, meaning its leading coefficient is ), the procedure terminates and produces a unique quotient and remainder with .
For our cryptographic application we will only ever divide by polynomials of the form . The leading coefficient is , so the division always works and the remainder always has degree strictly less than .
02.Reducing modulo a polynomial
Once we have polynomial division, we have the operation "reduce modulo ". For a polynomial and a polynomial modulus , the reduction is the remainder when is divided by using the long-division algorithm.
A small worked example over . Reduce modulo .
Step 1. Leading term of dividend , leading term of divisor . Quotient term: .
Subtract: .
Step 2. Leading term of remaining , divisor still . Quotient term: .
Subtract: .
The remainder is . So in . (You can check this by noting that , which is divisible by .)
A second example, where the remainder is non-zero. Reduce modulo in .
Quotient term: . Subtract: .
So the remainder is here too. Try one more: reduce modulo in .
Quotient term: . Subtract: .
Now the remaining polynomial is , same degree as the divisor. Quotient term: . Subtract: .
So as well. (Why? Because , and the divisor cleanly divides it.)
For an example with a non-zero remainder, reduce modulo in .
Quotient term: . Subtract: .
The remainder is , of degree , strictly less than the divisor's degree . Done.
The point of these examples is to show that no matter how big the dividend's degree is, the remainder always has degree strictly less than the divisor's. So if our divisor is , every remainder has degree at most , and the polynomial fits in coefficient slots.
A faster way to reduce modulo
Doing long division by hand every time is tedious. There is a much cleaner shortcut for the specific divisor .
The equation rearranges to . So when reducing modulo , every occurrence of can be replaced by . Higher powers follow the same rule: , , and so on. In general,
The pattern is "every multiple of flips sign and starts over." This is called a negacyclic reduction rule, because the wrap-around is accompanied by a sign flip.
Re-do the example modulo using the rule .
. So . Same answer as long division gave us, in two lines instead of three.
A second example, with . Reduce modulo .
, so , and . The polynomial becomes . So .
The negacyclic rule turns the reduction into pure book-keeping: collect every term whose exponent is at least , subtract from the exponent, flip the sign. This is the rule that the cryptographic NTT hardware will eventually implement.
04.Equivalence classes of polynomials
Two polynomials and in are congruent modulo , written
if their difference is divisible by . The set of all polynomials congruent to a fixed is called the equivalence class of modulo . Each class has many polynomial representatives, but exactly one of degree strictly less than , namely the remainder .
This mirrors the integer case. In , two integers are congruent modulo if their difference is divisible by . In , two polynomials are congruent modulo if their difference is divisible by . The residue classes modulo each had a unique representative in . The residue classes modulo each have a unique representative of degree strictly less than .
The set of equivalence classes, with the natural addition and multiplication inherited from , is a ring in its own right. That ring is what we are about to give a formal name to.
05.Ideals: the kernel of "divisible by"
The mathematical machinery that makes this construction precise is called an ideal. Defining ideals is short. An ideal of a ring is a non-empty subset such that
- If , then .
- If and , then .
The first rule says is closed under addition. The second is the strong condition: absorbs multiplication by anything in , not just by elements of .
The key example for us is the principal ideal generated by , written , which is the set of all multiples of :
Closure under addition is clear: , still a multiple of . Absorption: , still a multiple of . So is an ideal of .
Why does this matter? Because the equivalence relation "" is exactly "." The ideal is the set of polynomials we are deciding to call "zero." Two polynomials are equivalent if their difference is in the ideal.
The quotient ring
For any ring and ideal , the quotient ring is the set of equivalence classes of under the relation " if ." Addition and multiplication of classes are defined by picking a representative from each class, doing the operation in , and taking the class of the result.
The two ideal axioms are exactly what is needed to make this well-defined. Closure under addition makes "the sum of two classes is the class of their sum" well-defined. Absorption under multiplication does the same for multiplication. Without those properties, you could pick different representatives and get different answers, and the construction would not produce a ring.
Specialised to our case: is the ring of equivalence classes of polynomials modulo . Its elements are best represented by their unique low-degree representative: the polynomial of degree strictly less than . Addition and multiplication are computed by doing the operation in and then reducing the result modulo .
For the choice , every element is represented by a polynomial of degree at most . There are exactly such polynomials (each of the coefficient slots is a residue in ). So is a finite ring, with exactly elements. That is the final win: a ring large enough to be cryptographically useful, but small enough that every element fits in a fixed-size object.
Putting it together: the recipe for
The construction in three sentences. Start with , the ring of integers modulo . Lift it to , the polynomial ring in one variable . Quotient by the ideal , which means working modulo on every product. The resulting ring is
The next note unpacks in detail: how to add and multiply inside it, what the negacyclic reduction rule looks like in practice, and what specific values of and Kyber and Dilithium use.
08.A short exercise
Compute the following modulo in , using the negacyclic shortcut .
- . Replace . So the polynomial reduces to .
- . Replace . So the polynomial reduces to .
- . Replace . And . So . The polynomial is divisible by .
The negacyclic rule is the engine that the cryptographic NTT will run inside hardware. Doing a few of these by hand is the right preparation for understanding why the hardware looks the way it does.