Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Chapter 4.3.

The Chinese Remainder


Theorem
Find a number that leaves a remainder of 2 when
divided by 3, leaves a remainder of 3 when divided by
5, and leaves a remainder of 2 when divided by 7.

-Sun Tzu
In terms of congruences, this means
𝑥 ≡ 2 (mod 3), 𝑥 ≡ 3 (mod 5), 𝑥 ≡ 2 (mod 7).
Theorem 1: If 𝑚 and 𝑛 are relatively prime, then the
system of congruences
𝑥 ≡ 𝑎 (mod 𝑚) and 𝑥 ≡ 𝑏 (mod 𝑛)
has a unique solution mod 𝑚𝑛.
Proof. Because 𝑥 ≡ 𝑎 (mod 𝑚) , 𝑥 = 𝑎 + 𝑚𝑡 for some
integer 𝑡. But 𝑥 ≡ 𝑏(𝑚𝑜𝑑 𝑛) as well, so we can substitute
and get 𝑎 + 𝑚𝑡 ≡ 𝑏 (mod 𝑛). After subtracting 𝑎, we have
𝑚𝑡 ≡ 𝑏 − 𝑎 (mod 𝑛) , which we know has a unique
solution 𝑡0 (mod 𝑛) by Corollary 1 (in Chapter 4.2),
because gcd(𝑚, 𝑛) = 1. Clearly, 𝑥 = 𝑎 + 𝑚𝑡0 is a solution
to 𝑥 ≡ 𝑎(mod 𝑚) and 𝑎 + 𝑚𝑡0 ≡ 𝑎 + 𝑏 − 𝑎 = 𝑏 (mod 𝑛).
So that it is a solution to both linear congruences.
Chinese Remainder Theorem: Let 𝑛1 , 𝑛2 , … , 𝑛𝑟 be positive
integers such that gcd 𝑛𝑖 , 𝑛𝑗 = 1 for 𝑖 ≠ 𝑗. Then the
system of linear congruences
𝑥 ≡ 𝑎1 mod 𝑛1
𝑥 ≡ 𝑎2 mod 𝑛2

𝑥 ≡ 𝑎𝑟 mod 𝑛𝑟
has a is unique solution modulo the integer 𝑁 = 𝑛1 𝑛2 ⋯ 𝑛𝑟 .
Proof. We pair up our first two equations and since
gcd 𝑛1 , 𝑛2 = 1 , by Theorem 1, we have a unique
solution mod 𝑛1 𝑛2 , say
𝑥 ≡ 𝑏1 (mod 𝑛1 𝑛2 ).
Proof. (continued)
Next, we pair off the above linear congruence with the
third congruence,
𝑥 ≡ 𝑎3 (mod 𝑛3 ).
Because all the moduli are pairwise relatively prime,
𝑛3 and 𝑛1 𝑛2 have no common divisors, which allows
us to use Theorem 1 again and get a solution to the
first three congruences, say
𝑥 ≡ 𝑏2 (mod 𝑛1 𝑛2 𝑛3 ).
We can continue in this manner 𝑟 − 1 times to finally
arrive at a solution
𝑥 ≡ 𝑏𝑟−1 (mod 𝑛1 𝑛2 ⋯ 𝑛𝑟 )
Remark: The unique solution (modulo 𝑁 = 𝑛1 𝑛2 ⋯ 𝑛𝑟 ) to
the system of linear congruences
𝑥 ≡ 𝑎1 mod 𝑛1
𝑥 ≡ 𝑎2 mod 𝑛2

𝑥 ≡ 𝑎𝑟 mod 𝑛𝑟
where 𝑛1 , 𝑛2 , … , 𝑛𝑟 are positive integers and
gcd 𝑛𝑖 , 𝑛𝑗 = 1 for 𝑖 ≠ 𝑗 is given by
𝑥 ≡ 𝑎1 𝑁1 𝑌1 + 𝑎2 𝑁2 𝑌2 +. . . +𝑎𝑟 𝑁𝑟 𝑌𝑟 (mod 𝑁)
𝑁
where 𝑁𝑘 = = 𝑛1 ⋅ 𝑛2 ∙ ⋯ ∙ 𝑛𝑘−1 ∙ 𝑛𝑘+1 ∙ ⋯ ∙ 𝑛𝑟 , and 𝑌𝑘
𝑛𝑘
is a solution mod 𝑛𝑘 to 𝑁𝑘 𝑌𝑘 ≡ 1(mod 𝑛𝑘 ).
Examples:
1. Find the smallest number which leaves the remainders 2, 3,
and 2 when divided by 3, 5, and 7, respectively.
2. Solve the system of linear congruences
𝑥 ≡ 1(mod 5)
𝑥 ≡ 2 mod 6
𝑥 ≡ 3(mod 7)
3. Solve the linear congruence 17𝑥 ≡ 9(mod 276).
4. (Ancient Chinese Problem.) A band of 17 pirates stole a
sack of gold coins. When they tried to divide the fortune
into equal portions, 3 coins remained. In the ensuing brawl
over who should get the extra coins, one pirate was killed.
The wealth was redistributed, but this time an equal division
left 10 coins. Again, an argument developed in which
another pirate was killed. But now the total fortune was
evenly distributed among the survivors. What was the least
number of coins that could have been stolen?

You might also like