Chinese Remainder Theorem
Statement
Let and be coprime natural numbers (i.e. ). Then for any integers and there exists a unique modulo such that:
In algebraic terms this is a ring isomorphism:
Visualization
Worked example: solve and .
mod 3: ..., 2, 5, 8, 11, 14, 17, 20, 23, ... (2 mod 3)
mod 5: ..., 3, 8, 13, 18, 23, 28, 33, ... (3 mod 5)
↑ ↑
8 ≡ 2 (mod 3) and 8 ≡ 3 (mod 5) ✓
Unique solution: .
Construction via Bezout:
| Step | Action | Value |
|---|---|---|
| 1 | Find with | |
| 2 | ||
| 3 | ||
| 4 |
Bijection table for (all residues mod 6):
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 0 | 2 |
| 3 | 1 | 0 |
| 4 | 0 | 1 |
| 5 | 1 | 2 |
Every pair appears exactly once — the isomorphism is a bijection.
Proof Sketch
-
Existence. By Bezout's IdentityBezout's IdentityThe gcd of two integers is always an integer linear combination of those integersRead more → there exist with . Set . Then (and similarly for ).
-
Uniqueness. If and both satisfy both congruences then and . Since , we have , so .
-
Ring isomorphism. The map sending to is a ring homomorphism. Existence and uniqueness show it is bijective.
Connections
CRT is the modular-arithmetic analogue of product decomposition. It generalises to any finite collection of pairwise coprime moduli. It is the basis for fast arithmetic in cryptography (RSA uses it for efficient decryption) and connects to Euler's Totient FunctionEuler's Totient Functionφ(n) counts integers up to n coprime to n, and governs modular exponentiationRead more → via the multiplicativity for coprime . The structure mirrors Bezout's IdentityBezout's IdentityThe gcd of two integers is always an integer linear combination of those integersRead more → in action, and the coprimality assumption echoes the role of primes in the Fundamental Theorem of ArithmeticFundamental Theorem of ArithmeticEvery integer greater than 1 has a unique prime factorizationRead more →. The ring-theoretic generalization — Chinese Remainder Theorem (Rings) — states that for a ring and pairwise coprime ideals , the natural map is surjective with kernel .
Lean4 Proof
/-- **Chinese Remainder Theorem**: for coprime moduli `m` and `n`, the ring
`ZMod (m * n)` is isomorphic to `ZMod m × ZMod n`.
Mathlib provides the isomorphism as `ZMod.chineseRemainder`. -/
theorem crt {m n : ℕ} (h : Nat.Coprime m n) :
ZMod (m * n) ≃+* ZMod m × ZMod n :=
ZMod.chineseRemainder hReferenced by
- Diffie–HellmanCryptography
- RSA CorrectnessCryptography
- ElGamal EncryptionCryptography
- CRT for RingsRing Theory
- Pythagorean TriplesNumber Theory
- Bezout's IdentityNumber Theory
- Euclidean AlgorithmNumber Theory
- Carmichael NumbersNumber Theory
- Carmichael NumbersNumber Theory
- Euler's Totient FunctionNumber Theory
- Euler's Totient FunctionNumber Theory
- FTAG (Finite Abelian)Group Theory
- FTAG (Finite Abelian)Group Theory