Congruences · Definition
Euler's totient function
Before you start you need to know
It appears when studying invertible residues modulo n and is central to Euler's theorem. Its computation relies on the prime factorization of n.
Definition
Euler's totient function \(\varphi\) assigns to each positive integer \(n\) the number of integers between 1 and \(n\) that are coprime to \(n\).
If \(\gcd(m,n)=1\), then \(\varphi(mn)=\varphi(m)\varphi(n)\), and for a prime \(p\) we have \(\varphi(p^k)=p^{k-1}(p-1)\). These rules, together with \(\varphi(1)=1\), let us compute the function from the factorization of n. The multiplicative property is the most useful in practice.
For \(n=36=2^2\cdot 3^2\), apply the prime formula: \(\varphi(36)=36\cdot\frac{1}{2}\cdot\frac{2}{3}=12\). Alternatively, count: from the 36 integers, remove the even ones and the multiples of 3, which leaves 12 integers coprime to 36.
A common mistake is writing \(\varphi(n)=n-1\) for every \(n\), a formula that only holds when \(n\) is prime. For \(n=9\), the correct value is 6, not 8, because the 3 and the 6 must also be excluded since they share factors with 9.
Think about it
Why does φ(n)=n-1 hold only when n is prime?
Because only when n is prime are all integers from 1 to n-1 coprime to n; if n is composite, a prime divisor of n excludes some of them.
Exercises 10
- What is \(\varphi(7)\)?
- What is \(\varphi(9)\)?
- Which of these values can NEVER equal \(\varphi(n)\) for any \(n\ge 3\)?
- How many residues \(x\) from 0 to 9 have a multiplicative inverse modulo 10?
- For which of these \(n\) does \(\varphi(n)=n-1\) hold?
- What is \(\varphi(2)\cdot\varphi(4)\)?
- What is the sum of \(\varphi(d)\) over all positive divisors \(d\) of 6?
- For which of these \(n\) does \(\varphi(n)=\frac{n}{2}\) hold?
- Which of these numbers does NOT satisfy \(\varphi(n)=12\)?
- How many integers \(n\) with \(1\le n\le 30\) satisfy \(\varphi(n)=8\)?
What comes next
References
- David M. Burton, Elementary Number Theory, 7th edition, McGraw-Hill, 2011. cap. 7
- Ivan Niven, Herbert S. Zuckerman, Hugh L. Montgomery, An Introduction to the Theory of Numbers, 5th edition, Wiley, 1991. cap. 2