Courses / Mathematics I
Arithmetic and Number Theory

Congruences and Applications

Mathematics I 276 words Free to read

Solving Congruences

Modular arithmetic powers check digits, hashing, calendars, and cryptography. A linear congruence has the form axb(modn)ax \equiv b \pmod{n}, solved for the unknown residue xx.

The key tool is the multiplicative inverse: a1a^{-1} is a residue satisfying aa11(modn)a \cdot a^{-1} \equiv 1 \pmod n. Multiplying both sides by it yields xa1bx \equiv a^{-1} b.

aa has an inverse mod nn if and only if gcd(a,n)=1\gcd(a, n) = 1 (coprime). Thus, axb(modn)ax \equiv b \pmod n has a unique solution when coprime; otherwise it yields several or none.

Modulus Casegcd(a,n)\gcd(a, n) ConditionSolution Outcome
Coprimegcd(a,n)=1\gcd(a, n) = 1Unique solution
Not Coprimegcd(a,n)>1\gcd(a, n) > 1None or several

Common pitfall: Never "divide by aa" when aa and nn are not coprime. The inverse a1a^{-1} only exists when gcd(a,n)=1\gcd(a, n) = 1.

Multiplying by $a$ mod $n$: a perfect shuffle when coprime, a pileup otherwise

Theorems & Applications

Two celebrated theorems make modular computation easy and powerful:

Applications are everywhere:

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

10practice questions
2interactive scenes

Arithmetic and Number Theory