Maths WorkshopMaths problems with full solutions
Exercise 931Number theory › Divisibility and gcdL1Added 3 Nov 2026

Units modulo $n$

#units#invertible#Euler totient

Statement

Show that aˉ∈Z/nZ\bar a\in\mathbb{Z}/n\mathbb{Z} is invertible iff gcd⁡(a,n)=1\gcd(a,n)=1.

Hint

aˉ\bar a invertible means aˉbˉ=1ˉ\bar a\bar b=\bar1 for some bb, i.e. ab≡1(modn)ab\equiv1\pmod n.

Show solutionHide solution

Solution

If invertible. ab≡1(modn)ab\equiv1\pmod n means ab=1+knab=1+kn, so ab−kn=1ab-kn=1. Any common divisor of a,na,n divides 11, so gcd⁡(a,n)=1\gcd(a,n)=1.

If coprime. Bézout: au+nv=1au+nv=1, so au≡1(modn)au\equiv1\pmod n, i.e. aˉuˉ=1ˉ\bar a\bar u=\bar1.

Conclusion. The units of Z/nZ\mathbb{Z}/n\mathbb{Z} are exactly the classes of integers coprime to nn; there are φ(n)\varphi(n) of them.