Maths WorkshopMaths problems with full solutions
Exercise 1132Number theory › PrimesL1Added 3 Nov 2026

Totient and coprime residue classes

#totient#coprime#residue classes

Statement

Show that φ(n)\varphi(n) counts the integers 1≤k≤n1\le k\le n with gcd⁡(k,n)=1\gcd(k,n)=1, equivalently the units of Z/nZ\mathbb{Z}/n\mathbb{Z}.

Hint

Residues mod nn are in bijection with {1,…,n}\{1,\ldots,n\}; the class of kk is invertible iff gcd⁡(k,n)=1\gcd(k,n)=1.

Show solutionHide solution

Solution

Bijection. {1,…,n}→Z/nZ\{1,\ldots,n\}\to\mathbb{Z}/n\mathbb{Z}, k↦k mod nk\mapsto k\bmod n.

Units. kˉ\bar k is a unit iff gcd⁡(k,n)=1\gcd(k,n)=1.

Conclusion. φ(n)=∣{k∈{1,…,n}:gcd⁡(k,n)=1}∣=∣Z/nZ∗∣\varphi(n)=|\{k\in\{1,\ldots,n\}:\gcd(k,n)=1\}|=|\mathbb{Z}/n\mathbb{Z}^*|.