Module 4 : Modular Arithmetic

Lecture 3 : Chinese Remainder Theorem

Around A.D. 100, the Chinese mathematician Sun-Tsu posed the following problem:

Problem 1: Determine the numbers that leave remainders 2, 3 and 2 when divided by 3, 5 and 7 respectively.

One solution to the above problem is 23. The general solution is 23+105k for arbitrary integer k.

A system of two or more linear congruence need not have solution. Consider the system of congruence x ≡ 0 mod 2 and x ≡ 1 mod 4. This system is clearly unsolvable. Since the second congruence implies x is of the form 4k + 1 which makes it indivisible by 2 and thereby making the first congruence infeasible.

But the above argument doesn’t hold when the system of congruence have pair-wise relatively prime moduli ( for example 3, 5 and 7 ). We will prove that the system of congruence that can be solved individually can also be solved simultaneously provided they have pair-wise relatively prime moduli.

We will first prove the result for a system of 2 congruence relations and then generalize for arbitrary number of congruence relations.

Lemma 1: The system of congruence x ≡ a mod n1 and x ≡ b mod n2 has exactly one solution modulo the product n1n2 provided gcd (n1, n2) =1.

Proof: Since gcd (n1, n2) = 1 there are integers p and q such that pn1 + qn2 = 1. Thus pn1≡ 1 (mod n2) and qn2 ≡ 1 (mod n1). Let x' = bpn1 + apn2. Thus x' ≡ a mod n1 and x' ≡ b mod n2. Thus x' is a solution to our given system of congruence. Let x" denote another solution to the system. Thus x' ≡ x" (mod n1) and x' ≡ x" ( mod n2 ). Since gcd (n1, n2 ) = 1 we have x' ≡ x"(mod n) where n = n1n2.

Chinese Remainder Theorem (Generalized Version): Let n1, n2, …, nk be pair-wise relatively prime integers with gcd (ni, nj) = 1 where i ≠ j. Let a1, a2, …, ak be arbitrary integers. Then there exists exactly one solution x (mod n1x n2 x… x nk) to the system of congruence:


x ≡ a1 ( mod n1), x ≡ a2 (mod n2), …, x ≡ ak ( mod nk).