Linear Congruences and the Chinese Remainder Theorem
Theorem. The congruence is solvable if and only if . When solvable, there are exactly incongruent solutions modulo .
Method. Let . Dividing through by reduces to
whose solution is with the inverse from the extended Euclidean algorithm. Modulo the full solution set is , .
Worked example. Solve .
and , so there are 3 solutions modulo 21. Divide: . Since , the inverse of 2 is 4: . Modulo 21 the solutions are .
5.2 The Chinese Remainder Theorem
Section titled “5.2 The Chinese Remainder Theorem”Theorem (CRT). Let be coprime. Then the system
has a unique solution modulo .
Proof. Existence: set , , . Since , let be the inverse of modulo (extended Euclid). Then
satisfies both congruences: modulo , every term containing vanishes and ; modulo symmetrically.
Uniqueness: if modulo both and then (coprimality).
Worked example. Solve , , (Sunzi’s original problem, ~4th century CE).
. , , . Inverses: , ; , inverse 1; , inverse 1.
5.3 General Systems
Section titled “5.3 General Systems”For non-coprime moduli the CRT condition becomes: the system , is solvable iff , and solutions are unique modulo . Combine pairwise, replacing a pair by its single lcm-form congruence.
5.4 Applications
Section titled “5.4 Applications”- Calendar cycles (Sunzi’s original use), and the Zeller-type day-of-week congruences.
- Residue number systems: represent a large integer by its residues modulo pairwise coprime moduli; addition and multiplication act componentwise with no carries; the hardware basis of RNS arithmetic.
- Exponent reduction on composite moduli: to compute , split into mod 5 and mod 11 (Fermat on each prime factor), solve by CRT. This “split through the prime factors” workflow is the standard exam technique.
5.5 Common Pitfalls
Section titled “5.5 Common Pitfalls”- The CRT uniqueness is modulo the product; infinitely many integer solutions exist (all congruent modulo ).
- The reconstruction formula requires the inverses of modulo ; a common slip is inverting instead.
- Non-coprime moduli: check first, otherwise the system has no solution at all (students often “solve” impossible systems).
See Also
Section titled “See Also”5.x A Non-Coprime System Example
Section titled “5.x A Non-Coprime System Example”Solve , : and , so solutions exist. Combine into , i.e.
The reconstruction formula is worth memorising as a pattern, not as symbols: take the product of the other moduli, multiply by its inverse modulo your modulus, multiply by your residue, and sum over congruences. A worked three-modulus example with appears on this page; recompute it end-to-end as revision. Always finish with the residue class statement: solutions are classes modulo the product, and writing the found value makes the answer unambiguous for the marker.
5.x A Second Reconstruction
Section titled “5.x A Second Reconstruction”Alternatively solve by substitution: from into gives , , so ; substituting into gives and ; the same class as the CRT formula.