Linear Congruence Calculator
Solve linear congruences
Frequently Asked Questions
What is a linear congruence equation?
A linear congruence has the form ax ≡ b (mod m), meaning ax - b is divisible by m. For example, 3x ≡ 4 (mod 7) asks: what value of x makes 3x leave remainder 4 when divided by 7? Answer: x = 6 (since 18 mod 7 = 4).
When does a linear congruence have a solution?
ax ≡ b (mod m) has a solution if and only if GCD(a,m) divides b. If GCD(a,m) = d and d|b, there are exactly d solutions modulo m. If d does not divide b, no solution exists.
How is the modular inverse used to solve congruences?
If GCD(a,m) = 1, the solution is x ≡ a⁻¹ × b (mod m), where a⁻¹ is the modular inverse of a. The calculator finds the inverse using the extended Euclidean algorithm.
Where are linear congruences used?
They appear in cryptography (RSA algorithm), hash functions, random number generators, calendar calculations (day of week), and check digit algorithms (ISBN, credit card validation).
What is the Chinese Remainder Theorem?
The CRT solves systems of simultaneous congruences with coprime moduli. If x ≡ 2 (mod 3) and x ≡ 3 (mod 5), the unique solution modulo 15 is x ≡ 8. The calculator can solve systems of up to 5 simultaneous congruences.