Section 4.5 The Chinese Remainder Theorem
Objectives
- State the Chinese Remainder Theorem and use it to solve systems of congruences and related problems.
Exploration 4.5.1. Sun Zi's Problem.
Sun Zi (ๅญๅญ) was a Chinese mathematician who in his text Sunzi Suanjingใๅญๅญ็ฎ็ปใ (3rd to 5th century AD) is said to have written the earliest known reference to systems of linear congruences. In it he writes:
โไปๆ็ฉ๏ผไธ็ฅๅ ถๆฐใไธใไธๆฐไน๏ผๅฉไบ๏ผไบใไบๆฐไน๏ผๅฉไธ๏ผไธใไธๆฐไน๏ผๅฉไบใ้ฎ็ฉๅ ไฝ๏ผโ
โๅญๅญใใๅญๅญ็ฎ็ปใใ
โA number is repeatedly divided by 3, the remainder is 2; divided by 5, the remainder is 3; and by 7, the remainder is 2. What will the number be?โ
โSun Zi, Sunzi Suanjing, Vol. 3, Problem 26 (as cited in [5])
We follow Sun Zi's method of solving this system.
(a)
The first condition in Sun Zi's problem can be written as
Write all three conditions as a system of linear congruences.
(b)
Since the integers 3, 5, and 7 are pairwise relatively prime, then
Similarly, compute
(c)
Explain why each of the following congruences hold:
(d)
Explain why we can conclude that
is a solution to the original system of congruences, and using your answers from (b) simplify this expression to get an answer modulo 105.
Finally, verify that the answer satisfies all three conditions.
Checkpoint 4.5.1. Two Congruences.
Find a natural number \(x\) that leaves a remainder of 3 when divided by 5, and a remainder of 1 when divided by 7.
What are the numbers that satisfy the first condition? Among these, find one satisfying the second as well.
Theorem 4.5.2. Solution to a system of two congruences.
Let
Perform the following steps:
- Find the multiplicative inverse of
modulo call it - Find the multiplicative inverse of
modulo call it
A solution to the given system is
and this is unique modulo
Checkpoint 4.5.3. Two Congruences, again.
Solve Checkpoint 4.5.1 by writing its two conditions as a system of two congruences and apply the method in Theorem 4.5.2.
Checkpoint 4.5.4. Theorem 4.5.2, existence.
Prove that \(x \equiv atm_2 + bsm_1 \Mod{m_1m_2}\) satisfies both congruences in the given system.
Checkpoint 4.5.5. Theorem 4.5.2, uniqueness.
Prove that \(x \equiv atm_2 + bsm_1 \Mod{m_1m_2}\) is the only solution to the given system modulo \(m_1m_2\text{.}\)
Theorem 4.5.6. Solution to a general system of congruences.
Let
Perform the following steps:
- Let
-
For each
- Define
(the product of all moduli other than ). - Find the multiplicative inverse of
modulo call it
- Define
A solution to the given system is
and this is unique modulo
Checkpoint 4.5.7. Sun Zi's System.
Verify that the method outlined in Theorem 4.5.6 produces the same steps and answer as in Exploration 4.5.1.
Checkpoint 4.5.8. Practice.
Solve the system of congruences
using the method in Theorem 4.5.6.
Example 4.5.9. From to .
Let \(x \equiv 1 \Mod{2}\) and \(x \equiv 2 \Mod{5}\text{.}\) Then Theorem 4.5.6 tells us that the solution \(x \equiv 7 \Mod{10}\) is unique.
In fact for any pair of remainders modulo 2 and 5, we get a unique congruence class modulo 10 as a solution to the system
Verify that we have a bijection between \(\mathbb{Z}_2 \times \mathbb{Z}_5\) and \(\mathbb{Z}_{10}\text{:}\)
\(\mathbb{Z}_2 \times \mathbb{Z}_5\) | \(\mathbb{Z}_{10}\) |
\((0,0)\) | \(0\) |
\((0,1)\) | \(6\) |
\((0,2)\) | \(2\) |
\((0,3)\) | \(8\) |
\((0,4)\) | \(4\) |
\(\mathbb{Z}_2 \times \mathbb{Z}_5\) | \(\mathbb{Z}_{10}\) |
\((1,0)\) | \(5\) |
\((1,1)\) | \(1\) |
\((1,2)\) | \(7\) |
\((1,3)\) | \(3\) |
\((1,4)\) | \(9\) |
Checkpoint 4.5.10. Computing large powers.
Verify that 19 is a solution to the system
Then, use this fact to compute \(19^{20} \mmod{21}\text{.}\)
Instead of computing large powers of 19, compute large powers of 1 and 5 (with respective moduli) then use Theorem 4.5.2.