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
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:
When the three positive moduli are pairwise coprime, their product gives the combined modulus:
The calculator forms , , and . It then finds modular inverses satisfying , and combines the results:
Finally, the calculated value is reduced to the least nonnegative solution between 0 and . For example, using the default inputs produces:
| Congruence | Condition |
|---|---|
| First | x ≡ 2 (mod 3) |
| Second | x ≡ 3 (mod 5) |
| Third | x ≡ 2 (mod 7) |
| Result | Least nonnegative solution = 23; combined modulus = 105 |
Thus, every valid solution has the form for an integer .
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.