MathLabs
TheoremProved

Cancellation law and the existence of modular inverses

Statement

If gcd⁡(c,m)=1\gcd(c,m)=1, then ac≡bc(modm), gcd⁡(c,m)=1  ⟹  a≡b(modm)ac\equiv bc \pmod m,\ \gcd(c,m)=1 \implies a\equiv b \pmod m. Equivalently, cc has a multiplicative inverse modulo mm: an integer uu with cu≡1(modm)cu\equiv 1\pmod m.

Why is it true?

Ordinary "division" is really multiplication by an inverse, and this theorem tells us exactly when that inverse exists modulo mm: precisely when cc shares no common factor with mm. Without this condition cancellation genuinely fails (see the last row of the table above), which is why every later result about powers modulo mm — Fermat's little theorem, Euler's theorem, the Chinese remainder theorem — is built on top of this single algebraic fact.

Proof sketch

Since gcd⁡(c,m)=1\gcd(c,m)=1, Bézout's identity (a consequence of the Euclidean algorithm) guarantees ∃ u,v∈Z: cu+mv=1\exists\, u,v \in \mathbb{Z}:\ cu+mv=1: there exist integers u,vu,v with cu+mv=1cu+mv=1.

Multiply both sides of ac≡bc(modm)ac\equiv bc\pmod m by uu: acu≡bcu(modm)acu\equiv bcu\pmod m. Now substitute cu=1−mvcu=1-mv: the left side becomes a(1−mv)=a−amva(1-mv)=a-amv, and since amvamv is a multiple of mm, a(1−mv)≡a(modm)a(1-mv)\equiv a\pmod m; likewise the right side b(1−mv)≡b(modm)b(1-mv)\equiv b\pmod m. Hence a≡b(modm)a\equiv b\pmod m, proving cancellation.

Moreover, taking a=1,b=0,c=ca=1,b=0,c=c is not needed — directly, cu=1−mv≡1(modm)cu = 1-mv \equiv 1 \pmod m by the same substitution, so uu itself is the multiplicative inverse of cc modulo mm: this is exactly the object whose existence Theorem statement claims.

The hypothesis gcd⁡(c,m)=1\gcd(c,m)=1 is essential: take c=4, m=6c=4,\ m=6 (so gcd⁡(4,6)=2≠1\gcd(4,6)=2\neq1). Then 4×2=8≡2(mod6)4\times 2=8\equiv 2\pmod 6 and 4×5=20≡2(mod6)4\times 5=20\equiv 2\pmod 6, so 4×2≡4×5(mod6)4\times2\equiv 4\times5\pmod 6, yet 2≢5(mod6)2\not\equiv 5\pmod 6 — cancellation genuinely fails once the coprimality hypothesis is dropped.

Topics that use this theorem

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Carl Friedrich Gauss (1801). Disquisitiones Arithmeticae
  2. Jung Hee Cheon, Andrey Kim, Miran Kim, Yongsoo Song (2017). Homomorphic Encryption for Arithmetic of Approximate Numbers · DOI:10.1007/978-3-319-70694-8_15