Calculator Inputs
Use integers only. The modulus is converted to a positive value automatically.
Formula Used
a ≡ b (mod n) if and only if n divides (a − b).
a ≡ b (mod n) if and only if a − b = kn for some integer k.
r = a mod n, where 0 ≤ r < n.
[a] = { a + kn | k ∈ ℤ }.
a has an inverse modulo n only when gcd(a, n) = 1.
The calculator also checks addition, multiplication, and exponent comparisons after modular reduction. These extra checks help verify how the relation behaves under common algebraic operations.
How to Use This Calculator
- Enter integer A and integer B.
- Enter a non-zero modulus n.
- Optionally enter value C to test shifted and scaled comparisons.
- Enter exponent e to compare powers under the same modulus.
- Choose how many residue class sample values you want displayed.
- Press Calculate Congruence.
- Review the summary, detailed table, class samples, and graph.
- Use the CSV or PDF buttons to export the results.
Example Data Table
| A | B | n | A mod n | B mod n | Congruent? |
|---|---|---|---|---|---|
| 35 | 11 | 12 | 11 | 11 | Yes |
| 42 | 15 | 9 | 6 | 6 | Yes |
| 29 | 10 | 7 | 1 | 3 | No |
These examples show how equal residues imply congruence, while different residues place values into different equivalence classes.
FAQs
1) What does congruent modulo n mean?
It means two integers leave the same remainder after division by n. Equivalently, their difference is a multiple of the modulus.
2) Why must the modulus be non-zero?
Modulo zero is undefined because division by zero is undefined. A valid congruence relation needs a positive modulus size.
3) Can negative integers be used?
Yes. The calculator normalizes negative values into standard residues between 0 and n−1, so the comparison still works correctly.
4) What is a residue class?
A residue class is the full set of integers congruent to a chosen number under the same modulus. All members behave identically modulo n.
5) When does a modular inverse exist?
An inverse exists only when the number and the modulus are coprime. That means their greatest common divisor must equal 1.
6) Why test addition and multiplication with C?
These checks show how congruence behaves after shifting or scaling values. They are useful when studying modular arithmetic rules and proofs.
7) What does the quotient k represent?
If A − B = kn, then k is the integer multiplier proving divisibility. It exists only when the congruence statement is true.
8) What does the graph show?
It plots sample members from both residue classes. Matching classes overlap, while different classes stay separated by the modulus structure.