Last updated October 10, 2026 · Report an error
The Chinese Remainder Theorem solves systems of simultaneous modular equations — for example, finding a single number that leaves specific remainders when divided by several different, pairwise coprime numbers. This tool solves systems of 2 to 4 such congruences.
How it works
Given congruences x ≡ a_i (mod n_i) with pairwise coprime moduli, the theorem constructs the solution using N = the product of all moduli, N_i = N/n_i, and the modular inverse of each N_i mod n_i, then sums a_i × N_i × inverse_i and reduces modulo N.
- Enter remainder a₁.
- Enter modulus n₁.
- Enter remainder a₂.
- Enter modulus n₂.
- Enter remainder a₃ (optional).
- Enter modulus n₃ (optional).
- Enter remainder a₄ (optional).
- Enter modulus n₄ (optional).
- Click Calculate to see your results.
Examples
A classic textbook system
x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7) has the unique solution x = 23 (mod 105) — the smallest non-negative x satisfying all three congruences at once.
Who should use it
- Cryptography and number theory coursework.
- Scheduling problems involving repeating cycles of different, coprime lengths.
Industry applications
- Cryptography (RSA-related computations)
- Computer science (hashing, checksums)
- Mathematics education
Advantages
- Supports 2 to 4 simultaneous congruences.
- Shows the full N_i / modular-inverse construction, not just the final answer.
Limitations
- Requires pairwise coprime moduli — does not solve systems with shared-factor moduli (which may have no solution or require a modified approach).
Common mistakes to avoid
- Entering moduli that share a common factor, which violates the pairwise-coprime requirement the theorem depends on.
Best practices
- Always double check that all pairs of moduli are coprime before relying on the result — the tool validates this and will explain exactly which pair fails if not.
Tips
- If your moduli aren't coprime, check whether the system is even solvable first (compatible remainders on the shared factors) before looking for another approach.