2.2. Chinese remainder theorem.
Sometimes we need to solve a system of congruence
equations. The main result for this type of problems is the Chinese remainder theorem.
We will continue to work in Z but this theorem is valid in more general situations; see
Proposition 2.17 (2013) or Theorem 2.24 (2014) in Algebra 2B for two other versions.
Theorem 2.12. Suppose that m1 , m2 , , mk are pairwise coprime (i.e. hcf pmi , mj q 1
for i j) non-zero integers and m m1 m2 mk . Then the system of congruence
equations
x b1 pmod m1q,
x b2 pmod m2 q,
,
x bk pmod mk q.
has a solution, which is unique modulo m.
Proof. We prove it by induction on k. For k 1 there is nothing to prove.
For k 2, an integer solution to x b1 pmod m1 q is of the form x m1 q b1 . So we need
to have m1 q b1 b2 pmod m2 q, or m1 q b2 b1 pmod m2 q. Since hcf pm1 , m2 q 1,
by Proposition 2.5, it has a unique solution for q, say q q0 pmod m2 q. Or equivalently,
q m2 r q0 for any r P Z. Hence x m1 m2 r pm1 q0 b1 q for any r P Z, which is the
unique solution for x modulo m m1 m2 .
For general k, suppose we have proved the result for k 1. That is, the first k 1
congruence equations have a unique common solution x s pmod m1 q for some s, where
m1 m1 m2 mk1 . Then the problem reduces to a system of two congruences
x s pmod m1 q,
x bk pmod mk q.
By the case for k 2 above, there is a unique solution for x modulo m m1 mk . This
finishes the induction.
To use the theorem to make explicit computations, we just need to follow the proof. We
illustrate the idea using the following example.
Example 2.13. Consider the system
x 31 pmod 41q,
x 59 pmod 26q.
From the first equation we can write x 41q 31. We plug it into the second equation
and get 41q 31 59 pmod 26q. By removing multiples of 26 we reduce it to 15q 2
20
pmod 26q. By Euclidean algorithm, we have hcf p15, 26q 1 and 15 7 26 4 1,
which implies q 14 pmod 26q is the unique solution for q. If we write q 26r 14, then
x 41 26r p14 41 31q, i.e. x 605 pmod 1066q.
Remark 2.14. We explain what to do in slightly more complicated situations.
(1) If there are more than two equations in the system, we need to find the common
solution to the first two equations, then combine the result with the third equation
to find a solution to all three equations, etc. This procedure is reflected by the
inductive step in the proof.
(2) If the equations in the system are not in the form of x bi pmod mi q, we need to
solve (at least) one equation before using substitution. See Example 2.15.
(3) In case the mi ’s are not pairwise coprime, Theorem 2.12 does not apply any more.
Therefore the existence and uniqueness of solutions may not hold. However the
substitution method can still be used to solve the system. See Example 2.15.
Example 2.15. Consider the system
5x 7 pmod 12q,
7x 1 pmod 10q.
Notice that the coefficients in front of x are not 1. Moreover 12 and 10 are not coprime.
We can nevertheless solve it. Using the method in Example 2.7 we find the solution to
the first equation x 11 pmod 12q. Then we write x 12q 11 and substitute x in
the second equation. We get 7p12q 11q 1 pmod 10q, or 84q 76 pmod 10q. Using
the method in Example 2.7 again, we remove multiples of 10 on both sides and cancel
the common factor 2 to reduce the equation to 2q 2 pmod 5q, whose solution is q 1
pmod 5q. Write q 5r 1 to get x 12p5r 1q 11 60r 23. Hence the solution to
the original system is x 23 pmod 60q.
We wish to interpret the Chinese remainder theorem in the language of rings. We need
to recall the definition for the direct product of rings; see Definition on Page 27 (2013) or
Definition 2.22 (2014) in Algebra 2B.
Definition 2.16. Let R1 , R2 , , Rn be commutative rings with 1. The direct product is
the ring
(
R1 R2 Rn pa1 , a2 , , an q | ai P Ri for each i ,
in which addition and multiplication are given component-wise by
pa1, a2, , anq pb1, b2, , bnq pa1 b1, a2 b2, , an bn q ,
pa1, a2, , anq pb1, b2, , bnq pa1b1, a2b2, , anbnq.
Remark 2.17. We make the following observations.
21
(1) All the algebraic laws hold in R1 R2 Rn since they hold for every component.
Clearly the element p0R1 , 0R2 , , 0Rn q is the zero element, and the additive inverse
of pa1 , a2 , , an q is pa1 , a2 , , an q. The element p1R1 , 1R2 , , 1Rn q is the
multiplicative identity. Thus R1 R2 Rn is a commutative ring with 1.
(2) Notice that pa1 , a2 , , an q is a unit in R1 R2 Rn iff ai is a unit in Ri for
each i. We usually denote the group of units of a ring R by R , therefore we have
pR1 R2 Rnq R1 R2 Rn .
See Remark on Page 27 (2013) or Remark 2.23 (2014) in Algebra 2B.
Now we restate the Chinese remainder theorem as follows:
Corollary 2.18. Suppose that m1 , m2 , , mk are pairwise coprime non-zero integers
and m m1 m2 mk . Then there is a ring isomorphism
Zm Zm Zm Zm .
1 2 k
Proof. For each i there is a natural ring homomorphism ψi : Z Ñ Zmi which maps
every integer n to the congruence class modulo mi containing n. We construct a map
ψ : Z Ñ Zm1 Zm2 Zmk by ψ pnq pψ1 pnq, ψ2 pnq, , ψ pnqq. We can see ψ
respects additions and multiplications, because each component ψi does. Therefore ψ is
a ring homomorphism.
We apply Theorem 2.12. The existence of solutions shows that ψ is surjective; in other
words, im ψ Zm1 Zm2 Zmk . The uniqueness of solutions modulo m shows
that ker ψ pmq. By the fundamental isomorphism theorem of rings (Theorem 1.8
(2013) or Theorem 2.13 (2014) in Algebra 2B), ψ induces a ring isomorphism Z{pmq
Zm1 Zm2 Zmk . By Proposition 2.3, the left-hand side is precisely Zm .
We have the following immediate consequence concerning the groups of units.
Corollary 2.19. Suppose that m1 , m2 , , mk are pairwise coprime non-zero integers
and m m1 m2 mk . Then there is a group isomorphism
Zm Zm Zm Zm .
1 2 k
Proof. We apply Remark 2.17 and Corollary 2.18 and obtain
Zm pZm Zm Zm q Zm Zm Zm
1 2 k 1 2 k
as desired.
22
Remark 2.20. This result is very helpful in studying the group of units in Zm for an
arbitrary positive integer m. More precisely, let m 2a pa11 pa22 pal l be the prime decom-
position of m, where p1 , p2 , pl are distinct odd primes. Since 2a , pa11 , pa22 , , pal l are
pairwise coprime, we get
Zm Z2 Zp Zp Zp
a a1 a2 al .
1 2 l
Therefore, to understand the group structure of Zm for an arbitrary m, it suffices to
understand it for m being powers of primes. This is what we are going to study next.
23