What I would like to show you today is one very interesting property that Euler’s totient function satisfies, which was discovered by Gauss, so the theorem is kind of an Euler/Gauss team-up! As it turns out, if you sum ϕ(d)\phi(d) over every d|n,d\mid n, then you get back n.n. That is,

n=d|nϕ(d).n = \sum_{d\mid n}\phi(d).

Where d|n\sum_{d\mid n} means “sum over positive divisors, d,d, of nn .”

When I first saw this result, I was surprised, and I hope you feel the same! Why would summing ϕ\phi over divisors of nn total n?n? By the end of this article, we will know why!

We will go through two proofs. One is longer, but I think it has merit to learn because the proof does not rely on any special property of ϕ,\phi, only ϕs\phi's definition, whereas the second proof uses a few properties of ϕ.\phi. The second proof we will go through is a one-liner proof. Which is pretty nice.

Before we go through the proofs together, I recommend that you take some time to try to prove the theorem on your own before reading the proofs! Learning math(s) is always more fun when it’s hands-on! And the great thing is that this is only for fun! You’re not being tested or quizzed, so there is no time limit and no harm, no foul if you get stuck!

Just to make sure everyone is on the same page, here is the definition of Euler’s totient function, along with some of the properties we will need for the second proof. If you want to see a proof for the properties below, we proved these in Chapter 10 of Newbie at Number Theory, if you are interested!

Definition (Euler’s Totient Function): Let nn be a positive integer. Let the set Sϕ(n)S_{\phi(n)} contain all integers that are less than nn and relatively prime to n,n,

Sϕ(n)={m:gcd(n,m)=1and0<mn}.S_{\phi(n)} =\Big\{m \in \mathbb{Z}\;:\;\gcd{(n,m)} = 1\;\;\mathrm{and} \;\;0\lt m \leq n\Big\}.

Euler’s Totient Function ϕ\phi is defined as the number of elements in the set Sϕ(n)S_{\phi(n)},

ϕ(n)=#Sϕ(n).\phi(n) =\#S_{\phi(n)} .

That is, ϕ(n)\phi(n) equals the number of positive integers less than nn that are relatively prime to n.n.


Theorem (Euler’s Totient Function Properties): Euler’s totient function, ϕ,\phi, satisfies the following properties:

  1. ϕ(pk)=pk1(p1)\phi(p^k) = p^{k-1}(p-1) if pp is prime and kk is a positive integer,
  2. If gcd(n,m)=1\gcd{(n,m)}=1 then, ϕ(nm)=ϕ(n)ϕ(m).\phi(nm) = \phi(n)\phi(m) .
  3. If n=pakapbkbpmkm,n = p_a^{k_a}p_b^{k_b}\cdots p_m^{k_m}, then ϕ(n)=n(11pa)(11pb)(11pm).\phi(n) = n\left(1-\frac{1}{p_a}\right)\left(1-\frac{1}{p_b}\right)\cdots\left(1-\frac{1}{p_m}\right).
  4. An equivalent way to express 3. is the following,
ϕ(n)=(pakapaka1)(pmkmpmkm1)\phi(n) =\Big(p_a^{k_a} – p_a^{k_a-1}\Big)\cdots \Big(p_m^{k_m} – p_m^{k_m-1}\Big)

Examples of ϕ\phi:

Consider n=12.n=12. Then, Sϕ(12)={1,5,7,11}S_{\phi(12)} = \{1,5,7,11\} and therefore ϕ(12)=4.\phi(12) = 4. We could also use property 3 to calculate ϕ(12)\phi(12) as well. Since n=12=2231,n=12 = 2^2 \cdot3^1,

ϕ(12)=12(112)(113)=121223=4.\phi(12) = 12\left(1-\frac{1}{2}\right)\left(1-\frac{1}{3}\right)=12\cdot\frac{1}{2}\cdot\frac{2}{3} = 4.

Now let n=45.n=45. Then, Sϕ(45)={1,2,4,7,8,11,13,14,16,17,19,21,22,23,26,28,29,31,32,34,37,38,41,43,44}S_{\phi(45)} = \{1,\;2,\;4,\;7,\;8,\;11,\;13,\;14,\;16,\;17,\;19,\;21,\;22,\;23,\;26,\;28,\;29,\;31,\;32,\;34,\;37,\;38,\;41,\;43,\;44\} and therefore ϕ(45)=24.\phi(45) = 24. Let’s use property 4 this time to check our work. Since n=45=325,n=45 = 3^2\cdot 5, we have

ϕ(n)=(32321)(51511)=(93)(51)=84=24.\phi(n) =\Big(3^{2} – 3^{2-1}\Big) \Big(5^{1} – 5^{1-1}\Big) = \Big(9-3\Big)\Big(5-1\Big) = 8\cdot 4 = 24.

Note that there are more efficient ways to calculate ϕ(n)\phi(n) and less efficient ways.

An Example of The Theorem

Before we go on to the proofs, let’s write out the statement and see an example.

Theorem (Gauss): Let ϕ\phi be Euler’s totient function and n.n\in \N. Then,

n=d|nϕ(d).n = \sum_{d\mid n}\phi(d).

Where d|n\sum_{d\mid n} means “sum over positive divisors dd of nn .”

Example: Let n=12.n = 12. The set of the divisors of 12 is equal to {1,2,3,4,6,12}. \{1,2,3,4,6,12\}. Thus,

d|12ϕ(d)=ϕ(1)+ϕ(2)+ϕ(3)+ϕ(4)+ϕ(6)+ϕ(12)=1+1+2+2+2+4=12.\begin{align} \qquad\qquad\qquad\qquad\qquad\qquad\;\;\;\;\;\;\sum_{d\mid 12}\phi(d) = \phi(1)+\phi(2)+\phi(3)+\phi(4)+\phi(6)+\phi(12)\\ \qquad\qquad\qquad\qquad=1 +1+2+2+2+4\\ =12. \end{align}

How remarkable! Even though I know this has to work out, since we’re about to prove it together, I still love how the result falls out so nicely! This theorem is one of those “little things in life” that bring me joy.

If you want to, you can check the case with n=45.n=45.

The Proofs

Proof #1: The Long Way Around

The advantage of this proof is that you only need to know the definition of ϕ\phi and not all the properties (1)-(3).

Click to see the Proof:

The key idea in this proof is to partition the set [n]={1,2,,n}[n]= \{1,2,\cdots,n\} into subsets that we can easily determine the size of. Since we’re summing over divisors of n,n, it makes sense that the relation we will use to set up our partitions will be divisor-related.

To get it out of the way, and for completeness, note that the statement holds for n=1.n=1. With that said, we now consider n2.n\geq 2.

Denote the set of all m[n]m\in [n] such that gcd(m,n)=d\gcd{(m,n)}=d by Sd.S_d. That is,

Sd:={m:gcd(n,m)=dand0<mn}[n].S_d:=\{m \in \mathbb{Z}\;:\;\gcd{(n,m)} = d\;\;\mathrm{and} \;\;0\lt m \leq n \}\subseteq[n].

In this way Sϕ(n)=S1.S_{\phi(n)} = S_1. We claim that as we let dd run over positive divisors of n,n, the sets SdS_{d} partition the set [n].[n]. To see that this is the case, we must show that every [n]\ell\in [n] is in one and only one sets Sd.S_{d}.

With the goal in mind, suppose that Sd1\ell\in S_{d_1} and Sd2.\ell\in S_{d_2}. It follows that d1=gcd(,n)=d2d_1 = \gcd{(\ell,n)} = d_2 and hence Sd1=Sd2.S_{d_1} = S_{d_2}. I’ll let you ponder why every [n]\ell\in [n] is in at least one set Sd.S_{d}. We conclude the family of sets {Sd:d|n}\{S_{d}\;:\;d\mid n\} partition the set [n].[n].

We now shift our attention to determining how many elements are in each of the sets Sd.S_{d}.

A key observation is that mSdm\in S_{d} if and only if gcd(md,nd)=1\gcd{\Big(\frac{m}{d}\;,\frac{n}{d}\Big)}=1 and 0<mdnd.0<\frac{m}{d} \leq \frac{n}{d}. Therefore, mSdm\in S_{d} is equivalent to mdSϕ(n/d).\frac{m}{d}\in S_{\phi(n/d)}.

mSdmdSϕ(n/d).m\in S_{d} \;\;\;\iff\;\;\; \frac{m}{d}\in S_{\phi(n/d)}.

This is great! We know by definition that ϕ(n/d)=#Sϕ(n/d).\phi(n/d) = \# S_{\phi(n/d)}. Therefore, ϕ(n/d)=#Sd.\phi(n/d) = \#S_{d}.

We have almost everything we need in place to finish up this proof! Our last claim needs proving is that summing over positive dd such that d|nd\mid n is the same as summing over positive nd\frac{n}{d} such that nd|n.\frac{n}{d}\mid n. Can you see why? It has to do with the fact that nd\frac{n}{d} will run through all the divisors of nn just as dd does.1

Altogether, we are able to make the following deduction,

d|nϕ(d)=d|nϕ(nd)=d|n#Sϕ(n/d)=d|n#Sd=n.\sum_{d\mid n}\phi(d) = \sum_{d\mid n}\phi\Big(\frac{n}{d}\Big) = \sum_{d\mid n}\#S_{\phi(n/d)} =\sum_{d\mid n}\#S_{d}= n.

The final equality follows from the fact that the sets SdS_{d} partition the set [n].[n].

This concludes the proof.

Proof #2: Short and Sweet

Click for the Proof:

The one-liner version of the proof is the following:

Letn=m=1kpmam.Thend|nϕ(d)=m=1ki=1amϕ(pmi)=m=1ki=1am(pmipmi1)=m=1kpmam=n.\mathrm{Let}\;n = \prod_{m=1}^k p_m^{a_m}. \;\;\mathrm{Then}\;\; \sum_{d\mid n} \phi(d) = \prod_{m=1}^k\sum_{i=1}^{a_m}\phi(p_m^{i}) = \prod_{m=1}^k\sum_{i=1}^{a_m}\Big(p_m^{i}-p_m^{i-1} \Big) = \prod_{m=1}^kp_m^{a_m} =n.

However, let’s explain what’s happening.


This proof relies on the fact that ϕ\phi is multiplicative, i.e., has the property that ϕ(mn)=ϕ(m)ϕ(n)\phi(mn) = \phi(m)\phi(n) whenever gcd(m,n)=1.\gcd{(m,n)}=1. Let’s begin!

To get it out of the way, and for completeness, note that the statement holds for n=1.n=1. With that said, we now consider n2.n\geq 2.

Let n=p1a1p2a2pkak.n = p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k}. The key step is to note that each of the divisors of n=p1a1p2a2pkakn = p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k} shows up as a term in the following sum once expanded,2

🔑(1+p1+p12++p1a1)(1+p2+p22++p2a2)(1+pk+pk2++pkak).🔑 \char"1F511\qquad \Big(1+p_1+p_1^2+ \cdots + p_1^{a_1}\Big)\Big(1+p_2+p_2^2+ \cdots + p_2^{a_2}\Big)\cdots \Big(1+p_k+p_k^2+ \cdots + p_k^{a_k}\Big). \qquad \char"1F511

Therefore, using the fact that ϕ\phi is multiplicative, all we need to do is evaluate ϕ\phi on all the terms in the sum. We deduce that

d|nϕ(d)=(ϕ(1)+ϕ(p1)+ϕ(p12)++ϕ(p1a1))(ϕ(1)+ϕ(pk)+ϕ(pk2)++ϕ(pkak))\sum_{d\mid n} \phi(d) = \Big(\phi(1)+\phi(p_1)+\phi(p_1^2)+ \cdots + \phi(p_1^{a_1})\Big)\cdots \Big(\phi(1)+\phi(p_k)+\phi(p_k^2)+ \cdots + \phi(p_k^{a_k})\Big)

As a check, notice that every term we get when we expand the product on the right-hand side is of the form ϕ(p1r1)ϕ(p2r2)ϕ(pkrk)=ϕ(p1r1p2r2pkrk).\phi(p_1^{r_1})\phi(p_2^{r_2})\cdots \phi(p_k^{r_k} ) = \phi(p_1^{r_1} p_2^{r_2}\cdots p_k^{r_k}). And, since we already know that the expanded sum in our (🔑)(\char"1F511) gives every divisor of n,n, we know that the above product does indeed equal d|nϕ(d).\sum_{d\mid n} \phi(d).

Next, we use property (4.) to write the above product as a product of telescoping sums,

=(1+(p11)+(p12p1)++(p1a1p1a11))(1+(pk1)+(pk2pk)++(pkakpkak1)).= \Big(1+(p_1-1)+(p_1^2 – p_1)+ \cdots + (p_1^{a_1}- p_1^{a_1-1})\Big)\cdots \Big(1+(p_k-1)+(p_k^2 – p_k)+ \cdots + (p_k^{a_k}- p_k^{a_k-1})\Big).

The great thing about telescoping sums is that we get lots of cancellations. Once done, we arrive at

d|nϕ(d)=(p1a1)(pkak)=n.\sum_{d\mid n} \phi(d) = \Big( p_1^{a_1}\Big)\cdots \Big( p_k^{a_k}\Big) = n.

Just like that, we’re done!

Closing Thoughts

I find both proofs fun for different reasons. The first is more intuitive and really shows you why the theorem is true. The second hides some of what’s happening with its slickness. But the second proof foreshadows methods that are useful for more advanced problems in number theory. For instance, we used the fact that ϕ\phi is multiplicative to be able to use (🔑)(\char"1F511) to rewrite our sum d|nϕ(d)\sum_{d\mid n}\phi(d) as a product of sums m=1aiϕ(pim),\sum_{m=1}^{a_i}\phi(p_i^{m}), one for each prime divisor. This was useful because each of the sums m=1aiϕ(pim)\sum_{m=1}^{a_i}\phi(p_i^{m}) were easier to handle than the original sum. For those who are interested in learning more about these types of sums, you can search for arithmetic functions, Dirichlet convolution, and the Möbius inversion formula.

A Gift for You!

I would like to leave you with your own problem to solve. Let σ(n)\sigma(n) denote the sum of the divisors of n.n. That is,

Definition (Euler’s Sigma Function): Let nn be a positive integer. Euler’s sigma function σ\sigma is defined as,

σ(n):=d|nd.\sigma(n):= \sum_{d\mid n}d.

Note that σ(n)\sigma(n) equals the sum of positive divisors of n.n.

As the name suggests (but does not guarantee), σ(n)\sigma(n) is another function that was invented (or discovered) by Euler. As an example, let n=12.n = 12. Then,

σ(12):=d|12d=1+2+3+4+6+12=28.\sigma(12):= \sum_{d\mid 12}d = 1+2+3+4+6+12 = 28.

Your challenge to prove the following: Let n=p1a1p2a2pkak.n = p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k}. Then,

σ(n)=i=1kpiai+11pi1.\sigma(n)= \prod_{i=1}^{k} \frac{p_i^{a_i+1}-1}{p_i-1} .

With all this said, thank you for taking the time to read this little article. I hope you found it helpful. I would appreciate it if you found that any part of this could have been explained better, and if there were any mistakes/typos to mention them in the comments.


Footnotes:

  1. An easier way to think about this might be found by noticing the following two sets are equal:

    {d[n]:d|n}={nd[n]:d|n}\Big\{d\in [n]\;:\;d\mid n\Big\} = \Big\{\frac{n}{d}\in [n]\;:\;d\mid n\Big\} ↩︎
  2. For example, let’s take n=2352=200.n=2^3 \cdot 5^2 = 200.

    (1+2+22+23)(1+5+52)=1+2+22+23+25+225+2352+252+2252+2352(1+2+2^2+2^3)(1+5+5^2) = 1 + 2 + 2^2+2^3+2\cdot 5+2^2\cdot 5+2^3\cdot 5^2+2\cdot 5^2+2^2\cdot 5^2+2^3\cdot 5^2Notice how the sum contains all the divisors of 200, which I leave you to verify. ↩︎

Posted in

Leave a Reply

Discover more from billy-wehring.com

Subscribe now to keep reading and get access to the full archive.

Continue reading