Math calculator

Congruence Calculator

Solve ax ≡ b (mod n) and list every distinct solution modulo n. The result panel keeps solution residues and its numerical trail together.

Congruence inputs

Provide the numbers

Follow one set of numbers

For 14x ≡ 30 mod 100, gcd(14,100)=2 divides 30. Reducing gives 7x ≡15 mod50, whose solutions modulo 100 are 45 and 95.

Practical meaning

Congruences model repeating schedules, divisibility constraints, cyclic positions, and modular equations. A related application of Congruence is remainder convention.

Mathematical foundation

A linear congruence has solutions when gcd(a,n) divides b. When it does, the number of distinct residues equals that GCF. Congruence also connects with coprime condition.

Reading solution residues correctly starts with the mathematical structure described here.

Where the shortcut stops

The modulus must be positive. If the GCF does not divide b, no integer x can satisfy the congruence.

Record the source conventions for Congruence; Congruence still requires the reader to validate the setup for congruence.

Calculating it by hand

Divide a, b, and n by their common divisor, invert the reduced coefficient, find one residue, then add steps of the reduced modulus. To continue from Congruence, try coefficient inverse.

What to record with the answer

Before entering coefficient a, target b and positive modulus, identify what each field represents. Its label determines how the congruence relationship interprets the entry. The browser cannot supply missing unit context, so preserve that context in your notes.

Adding n to any solution produces the same residue class. That behavior gives the congruence output a built-in reasonableness test.

A final answer should carry enough context to be reusable: name it solution residues, attach any applicable unit, and record the rounding point. If another person must reproduce the result, the supplied inputs in the fields and the displayed formula are more informative than the decimal alone.

A modular inverse solves the special coprime step; this page also handles multiple or absent solutions. Writing “Solution residues” beside the output prevents that mix-up.

A useful note for this result contains the supplied inputs (coefficient a, target b and positive modulus), the answer label, and the chosen precision. That record can be checked without recreating the entire page state.

Why several solutions appear

When g=gcd(a,n) divides b, reducing by g creates one solution modulo n/g. Viewed in the original modulus n, that solution repeats g times at intervals of n/g. Listing all standard residues prevents a correct but incomplete single answer from hiding the other classes.

Questions about Congruence

Can there be more than one residue?

Yes, when gcd(a,n)>1 divides b.

When is there no solution?

When gcd(a,n) does not divide b.

Why list residues only up to n−1?

Every other solution is congruent to one of them.