How can I show that if $\gcd(a,b)=d$, then
$$ \phi(ab)= {\phi(a) \phi(b) d \over\phi(d)} $$
I know I have to use the fact that $$\phi(m)= m \cdot\prod_{p|m} (1-\frac1p),$$ where the $p$ ranges over all the distinct primes of $m$.
How can I show that if $\gcd(a,b)=d$, then
$$ \phi(ab)= {\phi(a) \phi(b) d \over\phi(d)} $$
I know I have to use the fact that $$\phi(m)= m \cdot\prod_{p|m} (1-\frac1p),$$ where the $p$ ranges over all the distinct primes of $m$.
Hint : If $a$ and $b$ are coprime, then there is no prime $p$ dividing both $a$ and $b$.
Consider the prime factors of $a\cdot b$ and locate the corresponding factors of $\phi(a\cdot b)$ (they either belong to $\phi(a)$ or to $\phi(b)$)