The one-sentence version
If are coprime, then is a ring isomorphism: a number modulo and the pair "its remainder modulo , its remainder modulo " are the same thing. So a large problem can be split into several small ones, computed separately and combined again. RSA speedups, the Pohlig–Hellman attack, the RNS representation in fully homomorphic encryption and NTT fast multiplication all rest on it.
This article has three layers:
- The intuition: General Han Xin counts his soldiers
- Real-world use: five places the CRT appears in cryptography
- The mathematics: the ring isomorphism, a constructive proof, the polynomial version and a worked example
Layer 1: The Intuition
1.1 Han Xin counts his soldiers
A problem from the Sunzi Suanjing (around the 4th century):
There is an unknown number of things. Counted by threes, two remain; counted by fives, three remain; counted by sevens, two remain. How many things are there?
The answer is . A popular story tells it as "Han Xin counting soldiers": have the soldiers line up in rows of three, five and seven, hear only how many are left over each time, and you can deduce the total (uniquely, below ).
1.2 One number, two "ID cards"
Each number from to is uniquely identified by the pair "remainder when divided by 3, remainder when divided by 5":
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 2 | 0 | 1 | 2 | 0 | 1 | 2 | 0 | 1 | 2 | 0 | 1 | 2 | |
| 0 | 1 | 2 | 3 | 4 | 0 | 1 | 2 | 3 | 4 | 0 | 1 | 2 | 3 | 4 |
15 numbers, 15 different remainder pairs, in one-to-one correspondence. Better still: addition and multiplication can be done separately on each side. For example ; with remainder pairs:
and the table shows that is exactly .
1.3 Why this is useful
The cost of big-number arithmetic grows quickly with size (multiplication costs roughly the square of the number of digits). Splitting a 2048-bit number into two 1024-bit remainders makes each side's multiplication 4 times cheaper, and the two sides can run in parallel. This is divide and conquer.
Layer 2: Real-World Use
| Where it appears | What the CRT does | Article |
|---|---|---|
| RSA decryption / signing speedup | Splits exponentiation modulo into modulo and modulo , 3 to 4 times faster | Why RSA Decrypts Correctly |
| The Pohlig–Hellman attack | When the group order has small factors, breaks the discrete logarithm into pieces, solves each, and recombines | Diffie–Hellman and the Discrete Logarithm |
| Håstad's broadcast attack | The same message sent to three people with : the CRT combines three ciphertexts into the integer | Why RSA Decrypts Correctly |
| The RNS representation in FHE | A modulus of hundreds of bits, , splits into a chain of 64-bit primes, each computed directly in machine words; modulus switching just "drops one prime" | Homomorphic Encryption |
| NTT fast polynomial multiplication | The polynomial CRT: | Post-Quantum Cryptography |
In addition, the analysis of Carmichael numbers in "Where Primes Come From" and the Lagrange interpolation in "Shamir's Secret Sharing" follow the same idea (Lagrange interpolation is itself the CRT over a polynomial ring).
Splitting also brings risk
If RSA-CRT makes a computation error in just one half, an attacker can factor the modulus with a single (the Bellcore fault attack).
Layer 3: The Mathematics
3.1 The theorem
Let be pairwise coprime and . Then the map
is a ring isomorphism.
Proof sketch (the standard abstract algebra approach):
- First consider , which is clearly a ring homomorphism (each component is a reduction homomorphism);
- Its kernel is "the numbers divisible by every ", which by pairwise coprimality is ;
- By the first isomorphism theorem, ;
- Both sides have elements, so injective means surjective, and it is an isomorphism.
A more general version: in a commutative ring , pairwise coprime ideals (with ) satisfy .
3.2 How to combine again (constructing the inverse)
Let and find (coprimality guarantees it exists; use the extended Euclidean algorithm). Then
The reason: is " modulo and modulo every other ", so it is the "unit vector" of the -th component. This is exactly the same idea as the Lagrange basis polynomial in "Shamir's Secret Sharing".
3.3 A worked example: Han Xin's soldiers
, ,
.
| 1 | 3 | 35 | 2 | 2 () | 70 |
| 2 | 5 | 21 | 1 | 1 | 21 |
| 3 | 7 | 15 | 1 | 1 | 15 |
Check: . ✓
In the Sunzi Suanjing mnemonic, "Three walking together, seventy is rare; five plum trees, twenty-one sprigs; seven reunited, exactly half a month; take away one hundred and five and you will know", the numbers , and are exactly the in the table. (Checked with Python.)
3.4 The polynomial version
Replace with and coprime integers with coprime polynomials, and the theorem still holds. If with the pairwise distinct, then
Multiplication on the left is polynomial multiplication (convolution, slow); on the right it is pointwise (fast). This is the algebraic essence of the FFT / NTT: when the are roots of unity, both directions can be done by divide and conquer in .
Summary
| Layer | Key points |
|---|---|
| Intuition | One number = a set of remainders; compute separately, then combine |
| Algebra | , from the first isomorphism theorem |
| Construction | Find the "unit vectors" , the same idea as Lagrange interpolation |
| Applications | RSA speedups, Pohlig–Hellman, Håstad, RNS, NTT |