Chinese Remainder Theorem Calculator

Calculate the least nonnegative solution and combined modulus from three simultaneous congruences. Chinese Remainder Theorem Calculator helps students, mathematicians, programmers, and engineers solve modular arithmetic problems efficiently.

Highlights

  • Solves three simultaneous congruences quickly.
  • Finds the least nonnegative solution.
  • Calculates the combined modulus and solution interval.
  • Supports large positive or negative remainders.
  • Useful for students, programmers, mathematicians, and engineers.

Table of Contents

  1. How Chinese Remainder Theorem Calculator Works?
  2. Practical Use Cases
  3. Accuracy and Limitations
  4. Quick Examples
  5. Frequently Asked Questions (FAQs)
  6. Cite This Calculator

How Chinese Remainder Theorem Calculator Works?

The Chinese Remainder Theorem (CRT) finds the smallest nonnegative integer that satisfies three congruences at the same time. The calculator uses the form:

x≡r1(modm1),x≡r2(modm2),x≡r3(modm3)

When the three positive moduli are pairwise coprime, their product gives the combined modulus:

M=m1m2m3

The calculator forms M1=M/m1, M2=M/m2, and M3=M/m3. It then finds modular inverses yi satisfying Miyi≡1(modmi), and combines the results:

x≡r1M1y1+r2M2y2+r3M3y3(modM)

Finally, the calculated value is reduced to the least nonnegative solution between 0 and M−1. For example, using the default inputs produces:


CongruenceCondition
Firstx ≡ 2 (mod 3)
Secondx ≡ 3 (mod 5)
Thirdx ≡ 2 (mod 7)
ResultLeast nonnegative solution = 23; combined modulus = 105

Thus, every valid solution has the form x=23+105k for an integer k.

Practical Use Cases

Students can use the calculator to check homework involving simultaneous congruences, modular inverses, and applications of the Chinese Remainder Theorem without performing every intermediate multiplication manually.

Mathematicians can quickly test examples in number theory, verify residue-class calculations, and identify the least representative and repeating modulus of a system.

Programmers can apply CRT to reconstruct an integer from several remainders, a technique used in modular algorithms, cyclic scheduling, and some cryptographic implementations.

Engineers can model repeating events or signals that operate on different integer cycles, then find the first point at which the specified cycle conditions occur simultaneously.

Educators can demonstrate how separate remainder conditions combine into one repeating solution pattern using concrete three-congruence examples.

Accuracy and Limitations

The calculator performs an exact integer CRT calculation for three congruences, with remainders from -1,000,000,000 to 1,000,000,000 and positive moduli from 2 to 1,000,000,000. The standard result requires the moduli to be pairwise coprime; if two moduli share a factor, a common solution may not exist or the repeating interval may require the generalized CRT rather than the simple product formula. The combined modulus can be as large as the product of the three entered moduli, so extremely large intermediate values may exceed the exact-integer range of some software environments even though the mathematical result is well defined. The output is a unitless least nonnegative solution together with its combined modulus, not all individual solutions.

Quick Examples

Example #1: Basic Coprime Congruences

Solves a simple system of three pairwise coprime congruences using small positive remainders.

Example #2: Scheduling Repeating Events

Finds the earliest time when three events with different repeating schedules occur at specified offsets.

Example #3: Congruences with Negative Remainders

Demonstrates that negative remainders can be used to find the least nonnegative simultaneous solution.

Frequently Asked Questions

It states that a system of congruences with pairwise coprime moduli has exactly one solution modulo the product of those moduli.

For pairwise coprime moduli, a solution always exists. When moduli share factors, the remainders must satisfy compatible congruence conditions.

It is the smallest integer greater than or equal to zero that satisfies every congruence in the system.

Yes. A negative remainder can be replaced by its equivalent nonnegative remainder, such as −1 modulo 5 being equivalent to 4 modulo 5.

If one solution is x₀ and the combined modulus is M, then every solution has the form x = x₀ + kM, where k is any integer.

Cite This Calculator