Chinese Remainder Theorem
Chinese Remainder Theorem (CRT): A system of simultaneous congruences with pairwise coprime moduli has a unique solution modulo the product of those moduli. In words: if you know a number's remainders upon division by several coprime numbers, you can reconstruct the number uniquely (up to the product). It applies in number theory, abstract algebra, cryptography, and computer arithmetic. Known to the Chinese mathematician Sun Tzu (c. 3rd–5th century CE) and fully formalized by Gauss in 1801.
Coprime moduli carry independent information. Knowing tells you nothing about when , so the remainders can be chosen freely and combined uniquely. The "gluing" of these independent pieces into one number is exactly a ring isomorphism, and it works precisely because coprimality lets you build "indicator" elements that are in one component and in the others.
Formal Statement
Let be positive integers and be integers. A system of simultaneous congruences is
Derivation hint: This is simply a list of independent divisibility constraints . Here is the unknown integer, each is the required residue modulo , and the moduli are said to be pairwise coprime if for all .
If the moduli are pairwise coprime and , then the system [1] has a solution , and this solution is unique modulo . That is, there is exactly one residue class satisfying all congruences. An explicit solution is given by
Derivation hint: is divisible by every with , so the -th term acts as a "selector" that is mod and mod the others.
If are pairwise coprime with product , the natural reduction map is a ring isomorphism:
Derivation hint: The map is well-defined and injective because pairwise coprimality forces from for all ; surjectivity follows by counting, since both sides have elements. Restricting to units gives the multiplicative version, useful for Euler's Totient Function:
Derivation hint: An element is a unit iff it is a unit in each component; multiplicativity of then follows from the cardinality of the right-hand product.
Why It Holds / Derivation
Step 1 — Build the selectors. For each , set . Since the are pairwise coprime, is coprime to (no with shares a factor with ). Therefore is invertible modulo , and there exists with
Derivation hint: guarantees an inverse by <a class="wiki-link" href="/wiki/math-numthy-bezout-identity">Bézout's Identity</a>; compute via the <span class="wiki-link-missing">Extended Euclidean Algorithm</span>.
Step 2 — Verify the candidate. Define . Fix an index . For , the term contains the factor (since ), so it vanishes mod . For ,
Derivation hint: Use [5] with to replace by modulo . Hence for every , so solves the system.
Step 3 — Uniqueness. Suppose and both solve [1]. Then for all . Because the are pairwise coprime, their product divides the difference:
Derivation hint: For pairwise coprime moduli, ; a number divisible by each coprime factor is divisible by their product. Thus , proving uniqueness modulo .
∎Step 3 requires pairwise coprimality, not merely that collectively. The moduli satisfy but are not pairwise coprime, and CRT in its clean form fails for them.
While the problem dates to ancient China, it was Gauss who gave the theorem its rigorous modern treatment in his 1801 masterwork Disquisitiones Arithmeticae. Gauss introduced the congruence notation still used today and systematically developed the theory of residues, placing the Chinese Remainder Theorem within a coherent algebraic framework. His viewpoint anticipated the ring-isomorphism formulation that abstract algebra would later make precise, and his constructive method for combining congruences is essentially the selector argument given above.
Building Intuition
Think of an odometer with several independent dials, each cycling at a different coprime period — one resets every clicks, one every , one every . Because the periods share no common factor, the dials only realign after clicks. During those steps, every combination of dial positions occurs exactly once. So specifying where each dial points pins down the click count uniquely within one full cycle. The CRT says reading the dials (the remainders) and reading the odometer (the number mod ) are two equivalent languages for the same information — and pairwise coprimality is precisely what makes the dials independent.
```svg
```
Worked Examples
Given: Find the smallest positive with
Step 1 — Product and selectors. . , , .
Step 2 — Inverses (the ). , need . . .
Step 3 — Combine via [2].
Step 4 — Reduce. .
Answer: (check: , , ✓).
Given: Solve and .
Step 1 — Parametrize the first. for integer .
Step 2 — Substitute into the second.
Step 3 — Invert mod . Since , multiply: .
Step 4 — Back-substitute. , so .
Answer: (check: , ✓). Note .
Common Misconceptions
A frequent error is to assume the moduli must be primes. They need only be pairwise coprime. For instance are pairwise coprime (and composite), and CRT applies perfectly with . Conversely, primality alone is not the issue — repeated primes like break coprimality.
Consider
Here . The first congruence forces odd; the second forces even (since means is even). These contradict, so no solution exists. A solution exists for non-coprime moduli only if the congruences agree on common factors: . When they do agree, the solution is unique modulo , not the product.
Connections
CRT sits at a crossroads of algebra and number theory. Its unit-group form [4] gives the multiplicativity of <a class="wiki-link" href="/wiki/eulers-totient-function">Euler's Totient Function</a>, for coprime . The constructive solution leans on the Extended Euclidean Algorithm and Bézout's Identity to compute inverses. The ring isomorphism [3] is the prototype of decomposing a Quotient Ring into a product, and it generalizes to comaximal ideals in any commutative ring — the same statement holds for when the ideals are pairwise comaximal. In the structure theory of finite abelian groups, CRT is what lets split into its primary components . It also underlies Fermat's Little Theorem applications when assembling results across prime factors.
Real-World Applications
Historical Development
Subtleties & Limits
While the CRT itself is fully proved, its applications touch open and hard questions. Reconstructing an integer from residues is trivial, but the inverse problem with errors — recovering a number from noisy or partially corrupted residues — leads to the CRT decoding problem, whose hardness underpins certain lattice-based and number-theoretic cryptosystems. In computational number theory, the efficiency of CRT-based algorithms depends on factoring or on knowing the moduli, and questions about the distribution of residues (e.g., how "random" CRT-reconstructed values behave) connect to deep conjectures in analytic number theory. Generalizing CRT to non-commutative rings and to module-theoretic settings is well understood, but the interplay between CRT and the difficulty of integer factorization keeps it at the heart of computational complexity questions.
See Also
Modular Arithmetic · Euler's Totient Function · Extended Euclidean Algorithm · RSA Cryptosystem · Quotient Ring · Fermat's Little Theorem · Structure Theorem for Finite Abelian Groups