Congruence Modulo Equation Solver Calculator

Solve congruence equations across custom moduli. Review gcd logic, normalized forms, residues, and solution classes. Download clean reports and explore residue behavior visually today.

Calculator

This solver handles a·x + c ≡ b (mod m).

Example Data Table

Equation Observation Solution Pattern
3·x + 1 ≡ 7 (mod 10) gcd(3, 10) = 1 x ≡ 2 (mod 10)
4·x + 5 ≡ 9 (mod 14) gcd(4, 14) = 2 divides 4 x ≡ 1, 8 (mod 14)
6·x + 3 ≡ 8 (mod 15) gcd(6, 15) = 3 does not divide 5 No solution
0·x + 11 ≡ 11 (mod 17) Both sides share one residue Every integer works
14·x + 5 ≡ 9 (mod 23) gcd(14, 23) = 1 x ≡ 18 (mod 23)

Formula Used

The calculator solves the linear congruence a·x + c ≡ b (mod m).

First move the constant term: a·x ≡ b − c (mod m).

Let d = gcd(a, m). A solution exists only when d divides b − c.

If d divides b − c, divide the whole congruence by d.

The reduced form becomes (a/d)·x ≡ (b − c)/d (mod m/d).

Now gcd(a/d, m/d) = 1, so an inverse exists.

Multiply both sides by the inverse of a/d modulo m/d.

This gives one base solution modulo m/d.

Lift that base solution into d residue classes modulo m.

How to Use This Calculator

  1. Enter the coefficient a from the x term.
  2. Enter the constant c that appears on the left side.
  3. Enter the target value b on the right side.
  4. Enter a positive modulus m.
  5. Choose a sample range to list integer solutions.
  6. Choose a graph range to inspect residue behavior.
  7. Press Solve Congruence to view the result summary.
  8. Use the CSV or PDF buttons to save the output.

FAQs

1. What does a congruence equation mean?

A congruence equation states that two expressions leave the same remainder after division by a modulus. It compares residues instead of ordinary equality.

2. When does a linear congruence have a solution?

A solution exists when gcd(a, m) divides b − c. If that divisibility test fails, no integer x can satisfy the congruence.

3. Why can one problem have several solution classes?

If gcd(a, m) is greater than one and divides b − c, the congruence produces several distinct residue classes modulo m.

4. Why does the calculator normalize negative values?

Negative coefficients and targets are valid in modular arithmetic. Normalization converts them into standard residues between 0 and m − 1.

5. What does the base solution represent?

The base solution is the first residue found after reducing the congruence. Other valid classes are generated from it using the reduced modulus.

6. What does the graph show?

The graph plots residues of a·x + c and compares them with the target residue b. Matching points indicate valid solutions inside the graph range.

7. Why might the sample table show only part of the solutions?

Large ranges can contain many valid integers. The table shows an initial portion for readability while the total count still appears above it.

8. Can this calculator solve equations with a = 0?

Yes. In that case the left side is constant. Either every integer works or no solution exists, depending on the resulting residue.

Related Calculators

congruence equation solvercatalan numbers calculatorabsorbing markov chain steady statelinear recurrence relation solvergraph theory calculation of latency

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.