Congruence Equation Solver Calculator

Analyze modular equations with normalization, gcd, inverses. See reduced forms, families, and plotted residue graphs. Export clean reports and check every answer confidently today.

Calculator Form

Enter congruence values

Use the form below to solve a linear congruence of the form ax ≡ b (mod m).

This multiplies x in the congruence.
This is the target residue.
Use any non-zero integer modulus.
Starting x value for listed integers.
Ending x value for listed integers.
ax ≡ b (mod m)
The solver reduces and checks divisibility automatically.
Example Data Table

Sample congruence cases

These examples show how different gcd values affect solvability and the number of residue classes.

a b m gcd(a, m) Example solution summary
14 30 100 2 x ≡ 45 and 95 (mod 100)
3 7 11 1 x ≡ 6 (mod 11)
12 18 30 6 Six solution classes exist because 6 divides 18
8 5 12 4 No solution because 4 does not divide 5
Formula Used

How the solver works

Base congruence: ax ≡ b (mod m)

Step 1: Compute d = gcd(a, m).

Step 2: A solution exists only when d | b.

Step 3: Reduce the equation to (a/d)x ≡ (b/d) (mod m/d).

Step 4: Find the inverse of a/d modulo m/d.

Step 5: Compute the principal solution:

x₀ ≡ (a/d)-1(b/d) (mod m/d)

Step 6: Generate all residue solutions modulo m:

x ≡ x₀ + k(m/d), for k = 0, 1, ..., d − 1

How To Use

Using this calculator

  1. Enter the coefficient a, constant b, and modulus m.
  2. Set a search range to list integer solutions within your chosen interval.
  3. Click Solve Congruence to compute gcd, reduced form, inverse, and all valid classes.
  4. Read the result block above the form for the principal solution and general pattern.
  5. Use the verification table and Plotly graph to confirm which x values satisfy the congruence.
  6. Download CSV for spreadsheet work or PDF for a clean printable report.
FAQs

Frequently asked questions

1) What is a congruence equation?

A congruence equation states that two expressions give the same remainder when divided by a modulus. In ax ≡ b (mod m), you seek integers x that make both sides equivalent under modulus m.

2) When does a linear congruence have a solution?

A solution exists exactly when gcd(a, m) divides b. If that divisibility condition fails, no residue class can satisfy the equation, even if you test many integers manually.

3) Why can there be more than one answer?

When gcd(a, m) = d > 1, a solvable congruence produces d distinct residue classes modulo m. Those classes are evenly spaced by m/d.

4) What is a modular inverse?

A modular inverse of c modulo n is a value that makes c · c-1 ≡ 1 (mod n). It exists only when gcd(c, n) = 1.

5) Why does the solver normalize a and b first?

Normalization replaces a and b with equivalent residues between 0 and m−1. That keeps arithmetic cleaner while preserving the original congruence and the same full solution set.

6) What does the plotted graph represent?

The graph plots (ax − b) mod m across the chosen x range. Points touching zero are solutions, while other heights show how far each x is from satisfying the congruence.

7) Can I use negative numbers?

Yes. Negative coefficients, constants, and search ranges are supported. The solver converts equivalent values into standard residues internally, then reports answers in a clean modular format.

8) Why export CSV or PDF?

CSV is ideal for spreadsheets, audit trails, or coursework logs. PDF gives you a neat report for printing, sharing, or saving alongside your solved modular arithmetic examples.

Related Calculators

catalan numbers calculatorabsorbing markov chain steady statelinear recurrence relation solver

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.