Explanation about reduced residue system theorem
Theorem 3-8 from Leveque's Elementary Theorem of Numbers:
$$\varphi(m)=m\prod_{p|m}(1-1/p)$$ where the notation indicates product over all distinct primes which divide $m$.
Proof: By reduced residue system theorem 3-7, if
$$m=\prod_{i=1}^{r}p_i^{a_i}$$
then
$$\varphi(m)=\prod_{i=1}^{r}\varphi(p_i^{a_i})$$
But we can easily evaluate $\varphi(p^a)$ directly: all the positive integer not exceeding $p^a$ are prime to $p^a$ except the multiples of p, and there are just $p^{a-1}$ of these, so that
$$\varphi(p_i^{a_i})=p_i^{a_i}-p_i^{a_1-1}=p_i^{a_i}(1-1/p_i)$$
Thus
$$\varphi(m)=\prod_{i=1}^{r}p_i^{a_i}(1-1/p_i)=\prod_{i=1}^{r}p_i^{a_i}*\prod_{i=1}^{r}(1-1/p_i)$$
$$=m\prod_{p|m}(1-1/p)$$
This proof lacks a lot of explanation as well. I don't even understand what is going on here, What is $a_i$. Why is it taking such weird arguments?. How does m follow from theorem 3-7?. The proof is very short , so I hope someone can give me a better insight.