A Lecture 04
A Lecture 04
Congruences
We first recall the notion of congruence, then study how to solve linear congruence equa-
tions. The Chinese remainder theorem is important in solving simultaneous equations.
2.1. Congruences and linear equations. We recall the following definition from Dis-
crete Mathematics and Programming:
Remark 2.2. Although the notion of congruence is still well-defined for any non-zero
integer m, we are usually only interested in positive values of m, as congruences modulo
m and m coincide.
Proposition 2.3. For any non-zero integer m, the set Zm has the structure of a commu-
tative ring with 1. In fact, it is the quotient ring Z{pmq where pmq is the principal ideal
of Z generated by m.
Proof. See Example (1) on Page 10 (2013) or Examples 1.20 and 1.35 (2014) in Algebra
2B.
The cancellation law for congruences will be handy for solving congruence equations.
Now we turn to look at congruence equations. In general a congruence equation has the
form
f pxq 0 pmod mq,
where f pxq is a polynomial with integer coefficients and m is a non-zero integer. We are
only interested in solutions modulo m; i.e. solutions in Zm . The number of solutions is
the number of congruence classes in Zm which satisfy the given equation.
17
Proposition 2.5. For any a, b, m P Z, a 0, m 0, assume hcf pa, mq d, then the
congruence equation ax b pmod mq has solutions iff d b. In this case there are exactly
d solutions in Zm . If x0 is a solution, then the complete set of solutions is given by the
congruence classes of x0 , x0 m1 , x0 2m1 , , x0 pd 1qm1 , where m1 md .
Proof. If x0 is a solution, then ax0 b my0 for some integer y0 . Thus ax0 my0 b.
Since d divides ax0 my0 , we must have d b.
Conversely, suppose that d b then b cd for some c P Z. Since hcf pa, mq d, there
exist integers x10 and y01 such that ax10 my01 d. Multiply both sides of the equation by
c. Then apx10 cq mpy01 cq b. Let x0 x10 c. Then ax0 b pmod mq.
Suppose that x0 and x1 are solutions. ax0 b pmod mq and ax1 b pmod mq imply that
ax1 ax0 pmod mq. By Proposotion 2.4, it is equivalent to x1 x0 pmod m1 q, hence
x1 is a solution iff x1 x0 km1 for some integer k. Moreover, for each k P Z there are
integers r and s such that k rd s and 0 ¤ s d. Thus x1 x0 sm1 rm, or
equivalently, x1 x0 sm1 pmod mq. These solutions are in d distinct congruence classes
modulo m. This completes the proof.
Corollary 2.6. If hcf pa, mq 1, then ax b pmod mq has exactly one solution. In
particular, if p is a prime and p a, then ax b pmod pq has exactly one solution.
In practice, we can solve such equations by cancellations and the Euclidean algorithm.
From 3x 2 pmod 5q we can also try to add multiples of 5 to 2 until we can cancel
the coefficient 3. In this case we have 3x 2 5 2 pmod 5q. By Proposition 2.4 we
still get x 4 pmod 5q. Hence the solutions to the original equation are x 4, 9, or 14
pmod 15q.
18
Proposition 2.5 can also be used to solve linear Diophantine equations of the form ax by
c, where a, b, c P Z. We explain it by the following example.
Example 2.8. We want to find all integer solutions to the equation 9x 15y 6. We
solve it by considering the congruence equation 9x 6 pmod 15q. The computation above
has showed that the solution is given by x 4 pmod 5q, i.e. x 5k 4 for any k P Z.
By substitution we have 9p5k 4q 15y 6, so y 3k 2. Therefore all solutions are
given by x 5k 4, y 3k 2 where k is an arbitrary integer.
Now we apply Proposition 2.5 to study the group of units in the ring Zm .
Proposition 2.9. Let m be a positive integer. An element a P Zm is a unit iff hcf pa, mq
1. There are exactly φpmq units in Zm . Zm is a field iff m is a prime.
The number of units is precisely the number of such a’s with 1 ¤ a ¤ m and hcf pa, mq 1.
By Definition 1.27, there are precisely φpmq units in Zm .
We immediately obtain the following corollaries, both of which have their own names:
Corollary 2.10 (Euler’s Theorem). If hcf pa, mq 1, then we have aφpmq 1 pmod mq.
Proof. The units in Zm form a group of order φpmq. If a and m are coprime, a is a unit.
Thus aφpmq 1, or equivalently, aφpmq 1 pmod mq.
Proof. If p a, then a are p are relatively prime. Thus aφppq 1 pmod pq. The result
follows, since for a prime p, we have φppq p 1.
19