Chinese remainder theorem

The Chinese remainder theorem describes when simultaneous congruences determine a unique solution modulo a product of moduli. If the moduli are pairwise coprime, every choice of remainders has exactly one solution modulo their product. The result connects modular arithmetic with number theory and computer science and has applications in efficient computation and cryptography.

Last updated
30 October 2026
Confidence
High (98%)
Sources
4
Versions
1
This article was researched and drafted with AI assistance and checked by an automated review pass. It is not guaranteed to be accurate — verify important facts against the references below.

Statement

For pairwise coprime positive integers m₁, m₂, …, mₖ, and any integers a₁, a₂, …, aₖ, the system x ≡ aᵢ (mod mᵢ) for i = 1, …, k has a solution. Any two solutions differ by a multiple of M = m₁m₂⋯mₖ, so the solution is unique modulo M. Equivalently, there is exactly one representative x in the range 0 ≤ x < M. Pairwise coprime means that every two different moduli have greatest common divisor 1.

Example

Consider x ≡ 2 (mod 3), x ≡ 3 (mod 5), and x ≡ 2 (mod 7). The moduli are pairwise coprime and their product is 105. The number 23 satisfies all three conditions: dividing it by 3 leaves remainder 2, by 5 leaves remainder 3, and by 7 leaves remainder 2. The theorem guarantees that every integer satisfying the system is congruent to 23 modulo 105; thus 23 is the unique solution in the range from 0 to 104.

How a solution can be constructed

One construction sets M = m₁m₂⋯mₖ and Mᵢ = M/mᵢ. Because mᵢ is coprime to Mᵢ, the extended Euclidean algorithm finds an integer uᵢ with uᵢMᵢ ≡ 1 (mod mᵢ). Then x = Σᵢ aᵢuᵢMᵢ satisfies every congruence: modulo mᵢ, its own term reduces to aᵢ and the other terms reduce to zero. Reducing this x modulo M gives the unique representative between 0 and M−1.

When moduli are not pairwise coprime

Pairwise coprimality is a sufficient condition that ensures a solution for every choice of remainders; it is not necessary for every particular system to have a solution. For two congruences x ≡ a (mod m) and x ≡ b (mod n), a solution exists exactly when a and b agree modulo gcd(m,n), and any solutions are then unique modulo lcm(m,n). For example, x ≡ 1 (mod 4) and x ≡ 3 (mod 6) are compatible because both residues are 1 modulo 2; x = 9 is a solution, and solutions repeat modulo 12.

History and applications

A remainder problem that became associated with the theorem appears in the ancient Chinese mathematical text Sunzi Suanjing: find a number that leaves remainders 2, 3, and 2 upon division by 3, 5, and 7. This example has the solution 23 modulo 105. The general theorem is a broader mathematical result than that early problem. Today, the theorem is useful when a calculation involving a large integer can be split into smaller calculations modulo coprime numbers and then recombined. Applications include algorithms for large-integer arithmetic and methods in cryptography, including CRT-based techniques for RSA.

Key facts

Condition
The classical theorem assumes that the moduli are pairwise coprime.
Existence
For pairwise coprime moduli, every set of remainders gives a solution.
Uniqueness
The solution is unique modulo the product of the moduli.
Example
x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7) gives x ≡ 23 (mod 105).
Construction
The extended Euclidean algorithm can construct the required modular inverses and a solution.
Historical source
An early remainder problem appears in the Chinese mathematical work Sunzi Suanjing.
Applications
The theorem supports modular computation and has applications in computer science and cryptography.

Ask about this article

Answers use only “Chinese remainder theorem” and its references, with citations.

References

  1. 1.
    Elementary Number Theory and the Chinese Remainder Theorem

    University of Chicago Mathematics REU (John Gallagher) · other · reliability: unverified · retrieved 30 October 2026

    Supports: States and proves the Chinese remainder theorem for pairwise coprime moduli, including existence of a solution and uniqueness modulo their product.

  2. 2.
    The Chinese Remainder Theorem

    Governors State University OPUS (Carol S. Jackson, Mathematics Capstone Project, 2021) · other · reliability: unverified · retrieved 30 October 2026

    Supports: Discusses the classical theorem and its proof, the Sunzi Suanjing remainder problem, and applications including RSA and other cryptographic methods.

  3. 3.
    Number Theory in Cryptography

    University of Chicago Mathematics REU (Jason Jacobs, 2021) · other · reliability: unverified · retrieved 30 October 2026

    Supports: States the Chinese remainder theorem in congruence form and illustrates how it is used in the mathematical justification and an attack analysis of RSA.

  4. 4.
    Chinese remainder theorem

    Wikipedia · other · reliability: unverified · retrieved 30 October 2026

    Supports: Provides a reference overview of the theorem's formulations, the early Sunzi Suanjing remainder problem, and applications to large-integer computation.

References are suggested by the research engine and may be incomplete. Unverified URLs are omitted rather than guessed.

Article history

  1. Version 130 October 2026 · EditorCreated by Zapia