Chinese Remainder Theorem — Definition, Formula & Examples
The Chinese Remainder Theorem (CRT) states that if you have a system of congruences with pairwise coprime moduli, there is exactly one solution modulo the product of those moduli. In other words, knowing the remainders when a number is divided by several coprime divisors uniquely determines its remainder when divided by their product.
Let be pairwise coprime positive integers (i.e., for ), and let be arbitrary integers. Then the system for has a unique solution modulo .
Key Formula
Where:
- = Product of all moduli: $M = m_1 m_2 \cdots m_k$
- = Partial product $M / m_i$
- = Modular inverse of $M_i$ modulo $m_i$, so $M_i y_i \equiv 1 \pmod{m_i}$
- = The given remainder in the $i$-th congruence
How It Works
To solve a CRT system, compute . For each , let . Find such that (the modular inverse of mod ). The solution is then . Each term is constructed so that it contributes the correct remainder mod and contributes zero mod every other .
Worked Example
Problem: Find x such that x ≡ 2 (mod 3), x ≡ 3 (mod 5), and x ≡ 2 (mod 7).
Step 1: Compute the product of all moduli.
Step 2: Compute each partial product .
Step 3: Find the modular inverses. We need , so since . Similarly, gives , and gives since .
Step 4: Combine using the CRT formula.
Answer: . You can verify: , , and .
Why It Matters
CRT is foundational in cryptography — the RSA algorithm uses it to speed up decryption by working modulo smaller primes separately. It also appears in coding theory, computer science (e.g., efficient large-integer arithmetic), and abstract algebra when characterizing direct products of rings.
Common Mistakes
Mistake: Applying CRT when the moduli are not pairwise coprime.
Correction: The theorem requires for all . If moduli share a common factor, the system may have no solution or require a generalized version of CRT.
