In ordinary arithmetic, dividing by 2 or 3 feels routine. In modular arithmetic, division is possible only when the number you want to divide by has an inverse.
What this post covers
- What a modular inverse is
- Why modular division is really inverse multiplication
- Why inverses exist exactly when two numbers are coprime
- How this helps solve linear congruences
Key terms
- modular inverse: a number that multiplies to 1 modulo
n - coprime: having gcd 1
- congruence: having the same remainder modulo
n - linear congruence: an equation of the form
ax \equiv b \pmod n
What is a modular inverse?
For an integer a, an integer x is called an inverse of a modulo n if
If such an x exists, dividing by a in the modular world can be replaced by multiplying by x. Any other integer congruent to x modulo n represents the same inverse class.
Example: the inverse of 3 modulo 7
We want
Testing small values shows
So 5 is an inverse of 3 modulo 7. Equivalently, 12, 19, and any number congruent to 5 modulo 7 represent the same inverse.
The existence condition
The key theorem is:
ahas an inverse modulonif and only ifgcd(a,n)=1.
So inverses exist exactly when a and n are coprime.
Why does the coprime condition matter?
If a and n have a common divisor d>1, then every product ax is divisible by d. But if
then ax-1 would have to be divisible by n, hence by d. That is impossible because ax is divisible by d while ax-1 is not.
Conversely, if gcd(a,n)=1, then Bézout's identity gives integers x and y such that
Reducing modulo n gives
so x is an inverse.
Example: why 2 has no inverse modulo 6
Since
2 and 6 are not coprime. Indeed, the products of 2 modulo 6 cycle through only 0,2,4, never 1.
Why is this useful?
Suppose we want to solve
Since 5 is an inverse of 3 modulo 7, multiply both sides by 5:
Common mistakes
1. Assuming every nonzero number has an inverse
That is true in a field, not in every modulus.
2. Forgetting to check gcd(a,n)=1
That is the main condition.
3. Thinking only one representative counts as the inverse
If 5 is an inverse modulo 7, then 12, 19, and any number congruent to 5 modulo 7 represent the same inverse class.
Wrap-up
A modular inverse exists exactly in the coprime case. That turns modular “division” into multiplication by an inverse.
Next we use this to solve linear congruences of the form ax \equiv b \pmod n.
💬 댓글
이 글에 대한 의견을 남겨주세요