Let $n$ be a positive integer. Show that $n\phi(n)=\phi(n^2).$

elementary-number-theorymodular arithmetic

I'm currently working in the following Euler's theorem exercise:

Let $n$ be a positive integer. Show that $n\phi(n)=\phi(n^2).$

Here are my thoughts:

If $n$ is prime, then

$$\phi (n^2) = n^2-n = n(n-1) = n \phi (n).$$

If $n$ is not prime and $p$ and $q$ are prime factors of $n,$ then

$$\phi (n^2) = (p^2-p)*(q^2-q)$$
$$\phi (n^2) =p(p-1)*q(q-1)$$
$$\phi (n^2) =p\phi(p)*q\phi(q)$$
$$\phi (n^2) =pq \phi(pq)$$
$$\phi (n^2) = n \phi(n)$$

Is that enough proof? Is there a more general one? Am I missing something? Any hint will be really appreciated.

Best Answer

More generally, let $n=p_1^{k_1}p_2^{k_2}...p_r^{k_r}.$ Then $$n^2=p_1^{2k_1}p_2^{2k_2}...p_r^{2k_r},$$ $$ \phi(n)=n(1-1/p_1)(1-1/p_2)...(1-1/p_r),$$and $\phi(n^2)=n^2(1-1/p_1)(1-1/p_2)...(1-1/p_r) = n \phi(n)$.