Math July 13, 2026 · 8 Min Read

Chinese Remainder Theorem Calculator – Guide & Formulas

Solve systems of simultaneous congruences using the Chinese Remainder Theorem. Find the smallest non-negative solution with step-by-step verification.

Try the free calculator

Put these formulas into practice with our instant, step-by-step Chinese Remainder Theorem Calculator.

Open Calculator ›

Solve systems of simultaneous congruences using the Chinese Remainder Theorem. Enter your remainders and moduli to find the smallest non-negative integer satisfying all conditions.

Key Takeaway

Use the free Chinese Remainder Theorem Calculator to solve systems of simultaneous congruences using the chinese remainder theorem. find the smallest non-negative solution with step-by-step verification. Get instant results with step-by-step explanations.

How to Use the Chinese Remainder Theorem Calculator

  1. Enter the number of congruences in your system (2 or more).
  2. For each congruence, enter the remainder (aᵢ) and the modulus (nᵢ).
  3. Ensure all moduli are pairwise coprime (GCD of any two moduli = 1) for a unique solution.
  4. Review the solution x, the step-by-step computation, and the verification showing x ≡ aᵢ (mod nᵢ) for each equation.

The Formula

Given pairwise coprime moduli n₁, n₂, ..., nₖ and remainders a₁, a₂, ..., aₖ, the solution is x = Σ(aᵢ × Mᵢ × yᵢ) mod N, where N = n₁ × n₂ × ... × nₖ, Mᵢ = N/nᵢ, and yᵢ = Mᵢ⁻¹ (mod nᵢ) is the modular inverse.

Variable Definitions

  • aᵢ: The remainder for the i-th congruence
  • nᵢ: The modulus for the i-th congruence (must be pairwise coprime)
  • N: The product of all moduli: N = n₁ × n₂ × ... × nₖ
  • Mᵢ: The partial product: Mᵢ = N / nᵢ
  • yᵢ: The modular inverse of Mᵢ modulo nᵢ, satisfying Mᵢ × yᵢ ≡ 1 (mod nᵢ)

Solving x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7)

Find the smallest non-negative x satisfying all three congruences.

  1. Step 1: Identify N = 3 × 5 × 7 = 105.
  2. Step 2: Compute partial products: M₁ = 105/3 = 35, M₂ = 105/5 = 21, M₃ = 105/7 = 15.
  3. Step 3: Find modular inverses: 35⁻¹ mod 3 = 2 (since 35×2=70≡1 mod 3), 21⁻¹ mod 5 = 1 (since 21×1=21≡1 mod 5), 15⁻¹ mod 7 = 1 (since 15×1=15≡1 mod 7).
  4. Step 4: Compute x = (2×35×2 + 3×21×1 + 2×15×1) mod 105 = (140 + 63 + 30) mod 105 = 233 mod 105 = 23.
  5. Step 5: Verify: 23 mod 3 = 2 —, 23 mod 5 = 3 —, 23 mod 7 = 2 —. The solution is x = 23.

Frequently Asked Questions