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).