Chinese Remainder Theorem
Jim Hefferon · Elementary Number Theory · Ch. 5
If moduli are pairwise coprime, a system of congruences has a unique solution mod their product. The Chinese Remainder Theorem gives a constructive algorithm to find it.
Overlapping cycles
Think of CRT as synchronizing clocks with different periods. A cycle of length 3 and a cycle of length 5 meet every 15 steps. The meeting point is the unique solution.
The algorithm
Given x ≡ a1 (mod n1), x ≡ a2 (mod n2), ..., with pairwise coprime ni: compute N = n1 n2 ... nk. For each i, let Ni = N/ni. Find yi such that Ni yi ≡ 1 (mod ni) using extended GCD. Then x ≡ sum of ai Ni yi (mod N).
Applications
CRT speeds up RSA by splitting computation mod p and mod q separately (smaller numbers, then recombine). It also explains why calendar cycles repeat: the day-of-week cycle (7) and day-of-month cycle interact via CRT.