Why the number of elements of $ Z$ of order $d$ is $\varphi (d)$?

47 Views Asked by At

I was trying to understand this problem solution:

Let $\varphi$ denote Euler's $\phi$-function. Prove the identity $\sum_{d|n} \phi(d) = n,$ where the sum is extended over all the divisors $d$ of $n.$

The solution is given here:

Prove the identity $\Sigma_{d|n}\phi(d) = n$, where the sum is extended over all the divisors $d$ of $n$.

I am wondering why the following statement in the solution is true: "the number of elements of $ Z$ of order $d$ is $\varphi (d)$" is not the multiplicative group $(\mathbb Z/12Z)^\times$ is a counterexample to it as it has 3 ( 5, 7,11) elements of order 2 while $\varphi (2)$ is just 1?