Folioby Interconnected
Log InSign Up

Applications of Congruences and the Group of Units — The Structure of $(\mathbb{Z}/n\mathbb{Z})^*$

We investigate the group of units (Z/nZ)*, derive the formula for Euler's totient function phi(n), and prove Fermat's little theorem, Euler's theorem, and Wilson's theorem. We also introduce the order of an element and discuss primitive roots.

FO
Folio Official
March 1, 2026

1 The Group of Units

Definition 1 (Group of units).
For a positive integer n, the set of residue classes aˉ∈Z/nZ with gcd(a,n)=1 is denoted (Z/nZ)∗. Under multiplication it forms a group, called the group of units (or the group of reduced residue classes).
Proof.
Closure: If gcd(a,n)=1 and gcd(b,n)=1, then gcd(ab,n)=1. (Indeed, if a prime p divided both n and ab, then p∣a or p∣b, contradicting coprimality.) Associativity: inherited from integer multiplication. Identity:1ˉ. Inverses: Since gcd(a,n)=1, Béax+ny=1, i.e. ax≡1(modn), so xˉ is the inverse of aˉ. □

2 Euler's Totient Function

Definition 2 (Euler's totient function).
For a positive integer n, φ(n)=∣(Z/nZ)∗∣, the number of integers k with 1≤k≤n and gcd(k,n)=1, is called Euler's totient function.
Theorem 3 (Formula for the totient function).
If n=p1e1​​p2e2​​⋯pkek​​, then
φ(n)=np∣n∏​(1−p1​)=i=1∏k​piei​−1​(pi​−1).
Proof.
We first show φ(pe)=pe−pe−1=pe−1(p−1). Among the integers 1,2,…,pe, the multiples of p are p,2p,…,pe−1⋅p, numbering pe−1 in total. Hence φ(pe)=pe−pe−1. For general n, the Chinese remainder theorem (covered in Chapter 6) yields (Z/nZ)∗≅∏i​(Z/piei​​Z)∗, from which the multiplicativity of φ follows and the formula is obtained. □

3 Fermat's Little Theorem and Euler's Theorem

Theorem 4 (Euler's theorem).
If gcd(a,n)=1, then aφ(n)≡1(modn).
Proof.
Let (Z/nZ)∗={rˉ1​,rˉ2​,…,rˉφ(n)​}. Since gcd(a,n)=1, the map rˉi​↦aˉrˉi​ is a bijection on (Z/nZ)∗ (because aˉ is invertible). It follows that ∏i​aˉrˉi​=∏i​rˉi​, i.e. aˉφ(n)∏i​rˉi​=∏i​rˉi​. Since ∏i​rˉi​ is invertible, we can cancel it from both sides to obtain aˉφ(n)=1ˉ. □
Corollary 5 (Fermat's little theorem).
For a prime p and an integer a with p∤a, we have ap−1≡1(modp).
Proof.
Apply Euler's theorem with φ(p)=p−1. □

4 Wilson's Theorem

Theorem 6 (Wilson's theorem).
An integer p≥2 is prime if and only if (p−1)!≡−1(modp).
Proof.
(⇒) Since Z/pZ is a field, the equation x2≡1(modp) has only the solutions x≡±1. Among the elements of (Z/pZ)∗={1,2,…,p−1}, only 1 and p−1 are their own inverses; the remaining elements pair off into inverse pairs whose products are each 1. Therefore (p−1)!≡1⋅(p−1)⋅(product of pairs, each 1)≡p−1≡−1(modp).

(⇐) We show that (n−1)!≡−1(modn) when n is composite. Write n=ab with 1<a≤b<n. If a=b, then both a and b appear as factors in (n−1)!, so n∣(n−1)! and (n−1)!≡0≡−1. If a=b, then n=a2 with a≥2, so 2a≤n−1, meaning both a and 2a appear as factors in (n−1)!, and the same conclusion holds. □

5 The Order of an Element

Definition 7 (Order).
For gcd(a,n)=1, the smallest positive integer k satisfying ak≡1(modn) is called the order of a modulo n, and is denoted ordn​(a).
Theorem 8.
If am≡1(modn), then ordn​(a)∣m. In particular, ordn​(a)∣φ(n).
Proof.
Write m=ordn​(a)⋅q+r with 0≤r<ordn​(a). Then ar=am⋅(a−ordn​(a))q≡1. Since r<ordn​(a) and ordn​(a) is the smallest positive exponent giving 1, we must have r=0. □
Number TheoryAlgebraTextbookGroup of UnitsEuler Totient Function
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Number Theory TextbookPart 5 of 13
Previous
Primes and the Fundamental Theorem of Arithmetic — The Atomic Decomposition of Integers
Next
Primitive Roots and Discrete Logarithms — $(\mathbb{Z}/p\mathbb{Z})^*$ as a Cyclic Group

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 1, 2026

Introduction to Algebraic Integers — Extending the Notion of Integer

Using the Gaussian integers Z[i] and the Eisenstein integers Z[omega] as concrete examples, we introduce rings of algebraic integers. We demonstrate the failure of unique factorization in Z[sqrt(-5)] and show how ideals and prime ideal factorization restore uniqueness. We define the class number and discuss its significance.

Number TheoryAlgebraTextbook
2
Folio Official·March 1, 2026

Arithmetic Functions and Multiplicative Functions — Functions on the Integers

We systematically define the principal multiplicative functions (phi, sigma, mu, d), develop the ring structure of Dirichlet convolution, and give a rigorous proof of the Moebius inversion formula. We also clarify the connection to the inclusion-exclusion principle.

Number TheoryAlgebraTextbook
Folio Official·March 1, 2026

Primes and the Fundamental Theorem of Arithmetic — The Atomic Decomposition of Integers

We define prime numbers and establish their basic properties, including Euclid's proof of the infinitude of primes. We then give a rigorous proof of the fundamental theorem of arithmetic (existence and uniqueness of prime factorization), and discuss the sieve of Eratosthenes and the Miller--Rabin primality test.

Number TheoryAlgebraTextbook
Folio Official·March 1, 2026

Chebyshev's Estimates: 0.92 x/ln x < π(x) < 1.11 x/ln x and the Prime Number Theorem

Chebyshev proved that 0.92 x/ln x < π(x) < 1.11 x/ln x for sufficiently large x. This article gives a complete proof via binomial coefficients and the Chebyshev functions θ(x) and ψ(x), then traces the path to the prime number theorem π(x) ~ x/ln x.

Number TheoryAlgebraTextbook