Recall from Modular Arithmetic that the whole of integer modular arithmetic grew out of a single result: the Division Theorem, which says that any integer a can be written uniquely as a=qn+r with 0≤r<n. Everything after that (congruence classes, Zn, linear congruences, the CRT) was really just bookkeeping around remainders.
Now that Polynomial Rings has handed us a Division Theorem for F[x] over any field F, we can run the entire story again with polynomials playing the part of integers. This lecture is the polynomial mirror of Topics 3 and 4, and almost every statement in it will look familiar; the only real change is that the size condition "0≤r<n" gets replaced by the degree condition "deg(r)<deg(m)".
Note
Notation
The mod operator returns the remainder when one polynomial is divided by another in F[x], for any field F. That is, given polynomials f(x),g(x)∈F[x] with g(x)=0, we have
f(x)modg(x)=r(x),
where deg(r(x))<deg(g(x)) and f(x)=q(x)g(x)+r(x) for some polynomials q(x),r(x)∈F[x].
Basically, f(x)modg(x) is just "do the long division and throw the quotient away". The Division Theorem is what makes this a legitimate operator: it guarantees that the pair q(x),r(x) exists and is unique, so there is exactly one possible answer. Notice that the remainder is allowed to be the zero polynomial, which is exactly the statement g(x)∣f(x).
The coefficients must live in a field, and every coefficient has to be reduced inside that field before you read off your answer. This is the single most common slip when the field is Zp; a coefficient of −4 in Z3[x] is not a coefficient of −4, it is a coefficient of 2, and writing it the wrong way will make a perfectly correct division look wrong.
Example. In Q[x], find (x2+x+1)mod(x2+1).
The two polynomials have the same degree, so the quotient is just the constant 1;
x2+x+1=1⋅(x2+1)+x,
and deg(x)=1<2=deg(x2+1), so the division has finished. Therefore, (x2+x+1)mod(x2+1)=x.
Example. In Z3[x], find (x2−4)mod(x+1).
First reduce the coefficients in Z3: since −4=−4+6=2 in Z3, the polynomial being divided is really x2+2. Dividing,
x2+2=(x−1)(x+1)+3=(x+2)(x+1)+0 in Z3[x],
since 3=0 in Z3. Therefore, (x2−4)mod(x+1)=0; equivalently, (x+1)∣(x2−4) in Z3[x].
The Remainder Theorem from Polynomial Rings gets this instantly and with no long division at all: dividing by x−a leaves remainder f(a), and here a=−1, so
f(−1)=(−1)2−4=−3=0 in Z3.
Whenever the divisor is linear, use the Remainder Theorem; long division by x−a is wasted effort. Notice also that this answer is genuinely field-dependent: over Q the same computation gives f(−1)=−3=0, so (x2−4)mod(x+1)=−3 in Q[x]. The polynomial did not change, the field did.
Example. In Z3[x], find (x4+2x3+x+1)mod(x2+2).
Long division, remembering that every coefficient is reduced mod 3 as we go:
With a mod operator in hand, congruence is defined exactly as it was for integers.
Note
Notation
Given polynomials f(x),g(x),m(x)∈F[x], we say that f(x) and g(x) are congruent modulom(x), and write
f(x)≡g(x)(modm(x)),
to mean that f(x)modm(x)=g(x)modm(x), or equivalently that m(x)∣f(x)−g(x).
Basically, two polynomials are congruent when they leave the same remainder, which is the same as saying their difference is a multiple of the modulus. These are the same two descriptions we had for integers in Modular Arithmetic, and in practice you pick whichever is cheaper: computing two remainders, or subtracting and doing one divisibility check.
There is a third description that we will make official in the next section, and it is the one that gets used most: f(x) and g(x) are congruent mod m(x) exactly when they are equal as elements of the quotient system F[x]/⟨m(x)⟩. So there are three equivalent formulations to keep straight:
f(x)modm(x)=g(x)modm(x) (equal remainders),
m(x)∣f(x)−g(x) (the difference is a multiple of the modulus),
f(x)=g(x) in F[x]/⟨m(x)⟩ (equal in the quotient).
Example. In Z3[x], verify that x3+2x+1≡x+1(modx2+1) using both of the first two formulations.
For the remainder version, divide each side by x2+1. Since x2≡−1, we get x3=x⋅x2≡−x=2x, so
x3+2x+1≡2x+2x+1=4x+1=x+1 in Z3[x],
while x+1 already has degree 1<2 and so is its own remainder. Both sides leave remainder x+1.
For the divisibility version, subtract:
(x3+2x+1)−(x+1)=x3+x=x(x2+1),
which is visibly a multiple of x2+1. Therefore, the congruence holds, and the two tests agree as the mod operator promises they must.
For integers, the set of remainders modulo n was packaged into the ring Zn (see Modular Rings and Units). The polynomial version does exactly the same thing with the set of possible remainders modulo m(x).
Note
Definition 7.11
Given any polynomial m(x)∈F[x] with degree n, the set of polynomials modulom(x) is denoted F[x]/⟨m(x)⟩, and is the algebraic system with elements
{a0+a1x+a2x2+⋯+an−1xn−1:ai∈F}
and addition and multiplication operations the same as in F[x], except always reduced to the remainder with smallest degree modulo m(x).
Basically, the elements are exactly the possible remainders on division by m(x); every polynomial of degree less than n, and nothing else. You add and multiply as normal polynomials and then reduce mod m(x) at the end, in the same way that arithmetic in Zn is ordinary integer arithmetic followed by taking a remainder.
Note
Notation
We may write "f(x)=g(x) in F[x]/⟨m(x)⟩" (or similarly) to mean the same thing as f(x)≡g(x)(modm(x)).
This matches the habit from earlier topics of writing "=4 in Z15" rather than "≡4(mod15)"; the ≡ notation emphasises the relation, the = notation emphasises that we are working inside a fixed finite system where the reduced form is the element.
Counting is easy: an element is determined by its n coefficients a0,…,an−1, each chosen freely from F. So if F is finite,
∣F[x]/⟨m(x)⟩∣=∣F∣n,where n=deg(m(x)).
The count depends only on the degree of m(x), not on which polynomial of that degree you chose. Whether m(x) factors or not changes the structure enormously (that is the subject of Irreducible Polynomials), but never the number of elements.
Example. List the elements of Z3[x]/⟨x2+1⟩.
Here F=Z3 and deg(x2+1)=2, so the elements are all a0+a1x with a0,a1∈{0,1,2}, and there are ∣F∣n=32=9 of them:
Z3[x]/⟨x2+1⟩={0,1,2,x,x+1,x+2,2x,2x+1,2x+2}.
Therefore, there are exactly 9 elements. Notice that this is notZ9; it has nine elements, but the arithmetic is completely different, as the next example shows.
Example. In Z3[x]/⟨x2+1⟩, compute (x+2)+(2x+2) and (2x+1)(x+2).
Addition never needs reducing, since the sum of two polynomials of degree <2 still has degree <2:
(x+2)+(2x+2)=3x+4=0x+1=1.
Multiplication does need reducing. The key relation is x2+1=0, i.e.
x2=−1=2 in Z3[x]/⟨x2+1⟩,
so every x2 that appears can be swapped for −1 on sight:
Therefore, (x+2)+(2x+2)=1 and (2x+1)(x+2)=2x in Z3[x]/⟨x2+1⟩. Substituting x2=−1 is the same operation as dividing by x2+1 and keeping the remainder; it is just far faster, and you should always reach for it once the modulus is fixed.
Example. List the elements of Z2[x]/⟨x2+x+1⟩ and write down its multiplication table.
Here ∣F∣n=22=4, so the elements are 0,1,x,x+1. The relation x2+x+1=0 gives
Therefore, Z2[x]/⟨x2+x+1⟩ has four elements and the multiplication table above. Notice that every nonzero row contains a 1, so every nonzero element has a multiplicative inverse; by the definition in Rings and Fields this system is a field with four elements, which is something Zn can never give us (there is no Z4 that is a field). This is exactly why polynomial quotients matter, and it happens here because x2+x+1 has no roots in Z2; more on that in Irreducible Polynomials.
Computing a high power of x inside F[x]/⟨m(x)⟩ is the polynomial version of computing ak in Zn, and there are the same two ways to do it: grind out the division, or find a small power of x that collapses to something trivial and exploit it. The second way is almost always faster, and it is the direct analogue of reducing an exponent modulo the order in Order and Primitive Elements.
Example. Find x5+1 in Z3[x]/⟨x2+1⟩.
By long division, taking one quotient term at a time:
x5+1−x3(x2+1)−x3+1+x(x2+1)=−x3+1,=x+1,
and deg(x+1)=1<2, so we stop. Collecting the quotient terms,
x5+1=(x3−x)(x2+1)+(x+1),
so the remainder is x+1.
Alternatively, and much faster, use the relation x2=−1 directly:
x4x5x5+1=(x2)2=(−1)2=1,=x4⋅x=x,=x+1.
Therefore, x5+1=x+1 in Z3[x]/⟨x2+1⟩. Notice how x4=1 means the powers of x cycle with period 4; this is precisely an order calculation, with x playing the role of a unit.
Example. Find x5+1 in Z2[x]/⟨x2+x+1⟩.
By long division, remembering that in Z2 subtracting is the same as adding:
Alternatively, use x2=x+1 from the previous section, which gives
x3=x⋅x2=x(x+1)=x2+x=(x+1)+x=1,
so the powers of x cycle with period 3 and
x5x5+1=x3⋅x2=1⋅(x+1)=x+1,=x+1+1=x.
Therefore, x5+1=x in Z2[x]/⟨x2+x+1⟩; both routes agree, and the second one took three lines.
Example. Find x100 in Z2[x]/⟨x2+x+1⟩, and find x10+x7 in Z3[x]/⟨x2+1⟩.
Nobody is doing these by long division. From the previous examples, x3=1 in the first system and x4=1 in the second, so in each case we reduce the exponent modulo that period:
100x100=3×33+1,=(x3)33⋅x=x in Z2[x]/⟨x2+x+1⟩.
For the second, 10=4×2+2 and 7=4×1+3, so
x10x7x10+x7=(x4)2⋅x2=x2=−1=2,=(x4)⋅x3=x⋅x2=−x=2x,=2x+2 in Z3[x]/⟨x2+1⟩.
Therefore, x100=x and x10+x7=2x+2. Reduce the exponent modulo the period of x, never modulo the degree of m(x); the degree tells you how big the remainders are allowed to be, not how the powers repeat.
Solving Linear Congruences with Polynomial Moduli#
for the unknown polynomial a(x). Compare this with ax≡c(modn): the method is word-for-word the same, with gcd of polynomials (from the polynomial Euclidean algorithm in Polynomial Rings) replacing gcd of integers.
Find d(x)=gcd(f(x),m(x)). If d(x)∤g(x), there is no solution; stop.
Find polynomials p(x),q(x)∈F[x] such that d(x)=f(x)p(x)+m(x)q(x), e.g. via the Euclidean algorithm and working backwards.
The general solution is then
a(x)≡d(x)g(x)p(x)(modd(x)m(x)).
Basically, p(x) is playing the role of an inverse: the Bézout identity says f(x)p(x)≡d(x)(modm(x)), so multiplying the congruence through by p(x) converts the left-hand side from f(x)a(x) into d(x)a(x), and then everything divides by d(x). The divisibility condition d(x)∣g(x) appears for exactly the same reason as d∣c did for integers; the reachable values of f(x)a(x)+m(x)b(x) are precisely the multiples of the gcd.
The modulus shrinks from m(x) to d(x)m(x), and forgetting this is the classic mistake. In the integer case a single class mod dn split into d separate classes mod n; here a single class mod d(x)m(x) splits into ∣F∣degd separate classes mod m(x), by the count of elements in the quotient when F is finite. If a question asks for the answer modulo the originalm(x), you have to list all of them by repeatedly adding d(x)m(x).
In Z2[x], subtraction is identical to addition, because −1=1; so signs never matter and you may freely replace every minus with a plus. This is a genuine convenience when back-substituting through the Euclidean algorithm (no sign bookkeeping at all), but it is also the single most common source of confusion in this topic, because the same manipulation in Z3[x] or Q[x] absolutely does need its signs. Always know which field you are in before you start cancelling.
Example. Solve (x3+x2+1)a(x)≡x2(modx4+1) in Z2[x].
First run the Euclidean algorithm on m(x)=x4+1 and f(x)=x3+x2+1. Dividing,
so the last nonzero remainder is d(x)=1. (It is worth checking the first line: (x+1)(x3+x2+1)=x4+x3+x+x3+x2+1=x4+x2+x+1, and adding x2+x gives x4+1 as required.) Since 1 divides everything, a solution exists.
Now work backwards from the second line to build the Bézout identity:
using x4=−1=1 in Z2[x]/⟨x4+1⟩. Checking the answer by multiplying out, and using the fact that squaring in Z2[x] kills all the cross terms,
(x3+x2+1)(x3+x2+1)=x6+x4+1=x2(x4)+x4+1=x2+1+1=x2 in Z2[x]/⟨x4+1⟩.✓
Therefore, the solution is a(x)≡x3+x2+1(modx4+1). Amusingly the answer is f(x) itself, i.e. f(x) happens to be its own "square root of x2" here; that is a coincidence of this example, not a general phenomenon.
Example. In Z2[x], solve (a) (x2+1)a(x)≡x(modx3+1), and (b) (x2+1)a(x)≡x2+x(modx3+1).
Both parts need the same gcd, so compute it once. In Z2[x],
x3+1x2+1=x(x2+1)+(x+1),=(x+1)(x+1)+0,
so d(x)=x+1. (Both lines are just the factorisations x3+1=(x+1)(x2+x+1) and x2+1=(x+1)2 in disguise.)
(a) Does x+1 divide g(x)=x? By the Remainder Theorem the remainder is the value at x=1, namely 1=0; so no. Therefore, part (a) has no solutions.
(b) Here g(x)=x2+x=x(x+1), which is divisible by x+1, so solutions exist. From the first division line,
using x2=x+1 in Z2[x]/⟨x2+x+1⟩ as before. Checking with a(x)=x+1,
(x2+1)(x+1)=x3+x2+x+1=1+x2+x+1=x2+x in Z2[x]/⟨x3+1⟩,✓
since x3=−1=1. Therefore, the solution to (b) is a(x)≡x+1(modx2+x+1). Notice the modulus really did shrink, from degree 3 down to degree 2; modulo the original x3+1 there are ∣F∣degd=21=2 solutions, namely a(x)=x+1 and a(x)=(x+1)+(x2+x+1)=x2, and indeed (x2+1)x2=x4+x2=x+x2 in Z2[x]/⟨x3+1⟩ as well.
Example. Solve (x2+1)a(x)≡x+2(modx3+2x+1) in Z3[x].
This one is over Z3, so signs matter again; recall −1=2 and −2=1 in Z3. Running the Euclidean algorithm,
where the middle line uses (x+2)(x+1)=x2+3x+2=x2+2, so the remainder is (x2+1)−(x2+2)=−1=2. The last nonzero remainder is the constant 2, whose monic form is 1; so d(x)=1 and a solution exists.
Everything from Simultaneous Congruences and the CRT carries over as well, with the same pairwise-coprime hypothesis and the same uniqueness statement.
Note
Theorem 7.12 (Chinese Remainder Theorem) Suppose that f(x),gi(x),mi(x)∈F[x], and that for the system of congruences
all the moduli are pairwise coprime (that is, gcd(mi(x),mj(x))=1 for all i=j). Then the system of congruences has a solution, and the solution is unique modulo m1(x)m2(x)⋯mt(x).
The proof is analogous to the integer case from Simultaneous Congruences and the CRT, so the lecture only sketches it; the substitution argument below is constructive anyway, which is really all we need in practice.
Pairwise coprime means coprime in pairs, not "no factor common to all of them". Exactly as with integers, gcd(m1,m2,m3)=1 is not enough; you must check every pair separately. Notice also that "coprime" here means the gcd is the constant polynomial 1, i.e. the two moduli share no common factor of degree ≥1.
To solve a system, we use the same substitution method as in the integer case:
Solve the first congruence and write f(x) in terms of some polynomial k1(x)∈F[x].
Substitute this into the second congruence and solve for k1(x) in terms of some new polynomial k2(x)∈F[x].
Rewrite f(x) in terms of k2(x), substitute into the third congruence, and so on.
The final expression for f(x), with kt(x) ranging over all of F[x], describes every solution.
Basically, each congruence narrows the family of possible f(x) down further, and the parameter ki(x) keeps track of whatever freedom is left. Since the final answer is unique modulo the product of the moduli, the degree of the product is a free sanity check: the reduced answer must have degree less than deg(m1)+⋯+deg(mt).
Example. Solve the following system of polynomial congruences in Z2[x]:
f(x)f(x)≡x+1(modx2+x+1),≡x(modx3).
First check the hypothesis: x2+x+1 has constant term 1, so it is not divisible by x, and the only factor of x3 of positive degree is x; hence gcd(x2+x+1,x3)=1 and the CRT applies. The answer will be unique modulo
using −1=1 in Z2. So k(x) must be the inverse of x2+x+1 modulo x3; and the gcd is 1, so an inverse exists. Rather than run the full Euclidean algorithm, notice that
Checking both congruences with f(x)=x3+x: modulo x3 we have x3≡0, so f(x)≡x; and modulo x2+x+1 we showed earlier that x3=1, so f(x)≡1+x=x+1. Both hold. ✓ Therefore, the general solution is
f(x)≡x3+x(modx5+x4+x3),
and its degree 3 is comfortably below 5, as the uniqueness statement requires.
Example. Solve f(x)≡1(modx+1) and f(x)≡x(modx2+1) in Z3[x].
Coprimality first: by the Remainder Theorem, x+1 divides x2+1 only if (−1)2+1=2 were 0 in Z3, which it is not; so the moduli are coprime and the answer is unique modulo
(x+1)(x2+1)=x3+x2+x+1.
From the first congruence, f(x)=1+(x+1)k(x). Substituting into the second,
1+(x+1)k(x)(x+1)k(x)≡x(modx2+1)≡x−1(modx2+1).
We need the inverse of x+1 modulo x2+1. Using x2≡−1,
Checking: at x=−1 we get f(−1)=1−1+1=1, so f(x)≡1(modx+1); and modulo x2+1 we have x2≡−1, so f(x)≡−1+x+1=x. Both hold. ✓ Therefore,
f(x)≡x2+x+1(modx3+x2+x+1).
So the whole of Topics 3 and 4 transfers across intact: remainders, congruence classes, a finite quotient system, linear congruences solved by Bézout, and simultaneous congruences solved by substitution. The only things you have to keep watch over are which field the coefficients live in (because −1=1 in Z2 but not in Z3), and the fact that "size" now means degree; once those two habits are in place, every method here is one you have already used on integers.