[Math] a good way to introduce Euler’s totient function

big-listeducationelementary-number-theorymotivationtotient-function

I was thinking of this question and when I googled I couldn't find any MSE results, but I found one from Reddit. I just wanted to ask the question here and post the answer as community wiki just so MSE could have some discussion. If you want this taken down, you can comment and I'll take it down.

The question from u/matqkks:

I need to introduce Euler's totient function but I don't want to start with the definition. What applications and impact does this function have? I need something which will can be used to hook students into why Euler's totient function is important.

If you have other ideas for good ways to teach this function, please add your answer!

Edit: another good tactic is if someone knows of some problem (that's natural enough to formulate) where we do stumble across the totient function early on, but in fact the problem is so "deep" that even though its "purpose" is to introduce the totient function (in terms of why/how a mathematician would come up with such a definition), it's also a good springboard into harder number theory questions, kind of like in this thread: Simple theorems that are instances of deep mathematics.

Best Answer

The answer from u/lurking_quietly:

What makes Euler's totient function important is that for all positive $n\geq 2$, $\varphi(n)$ counts the number of elements of $\mathbb Z/n\mathbb Z$ which admit multiplicative inverses (i.e., $\varphi(n)$ counts the number of distinct units in this ring.)

Rather than have your students compute $\varphi(n)$ with no motivation, you might first ask them to compute the size of the unit group, $|U(\mathbb Z/n\mathbb Z)|$ for various values of $n\geq2$. When you later define the totient function via $\varphi(1) := 1$ and

$$\varphi(n) := |\{ k : 1≤k≤n \text{ and } \gcd(k,n) = 1 \}|,$$

then your students might better appreciate that you're computing something with relevance by introducing this definition of the totient function. (Note: $n=1$ merits emphasis as a special case. The definition above does indeed recover $\varphi(1)=1$, as desired. But in general, the "correct" definition of the totient function would be $\varphi(n) = |U(\mathbb Z/n\mathbb Z)|$. For the case $n=1$, this might be potentially ambiguous if we require $0\neq 1$ in the quotient ring, something very common in the definition of fields, for example.)

$$\rule{100pt}{1pt}$$

You can also introduce the totient function in the context of something like the finite sequence

$$\frac 1n, \frac 2n, ..., \frac{n-1}{n}, \frac nn.$$

For a fixed positive integer $n\geq 2$, how many elements for this sequence of order n have denominator $k$ when the fraction $j/n$ expressed in lowest terms? Answer: if $k|n, \varphi(k)$; otherwise, zero. This is related to the divisor sum identity given on the Wikipedia page for the totient function. There are multiple ways to verify this, ranging from the direct to Möbius inversion.

There are other directions you can go, too. For example, if your students are familiar with a little bit of ring theory, then you can explore how not only is $\varphi$ a multiplicative function, but its multiplicativity is closely related to the Chinese Remainder Theorem over the integers. If $m, n$ are positive integers greater than $1$ and $\gcd(m,n)=1$, then not only do we have

$$\varphi(mn) = \varphi(m) \varphi(n),$$

but we have the stronger result that

$$\mathbb Z/mn\mathbb Z \cong \mathbb Z/m\mathbb Z × \mathbb Z/n\mathbb Z$$

which restricts to an isomorphism of the unit groups of the respective rings:

$$U(\mathbb Z/mn\mathbb Z) \cong U(\mathbb Z/m\mathbb Z) × U(\mathbb Z/n\mathbb Z).$$

Roughly speaking, this means that when $m, n$ are coprime, not only is the number of units modulo $mn$ the same as (the number of units modulo $m$)$\times$(the number of units modulo $n$), but we also have that a unit modulo $mn$ is expressible in a unique way as the product of a unit modulo $m$ and a unit modulo $n$.

If you're even more ambitious (and have enough time), you might even consider possible generalizations to the totient function, too. For example, what might something like "$\varphi(1+4i)$" mean? One natural idea would be to try to count the number of units $|U(\mathbb Z[i]/(1+4i)\mathbb Z[i]|$, or the number of units in the Gaussian integers modulo $1+4i$. Or, alternatively, say that $p$ is a positive integral prime, and consider the polynomial ring $\mathbb Z/p\mathbb Z[x]$. What might "$\varphi(p(x))$" mean in context? Suggestion: set $(p(x)) := |U(\mathbb Z/p\mathbb Z[x]/(p(x))|$, the size of the group of units for polynomials in one variable with coefficients in $\mathbb Z/p\mathbb Z$, all modulo the polynomial $p(x)$.

I hope something in the above proves useful. Good luck!

Related Question