If we divide $15$ and $81$ by $(15, 81) = 3$, we obtain two relatively prime integers, $5$ and $27$. This is no surprise because we have removed all common factors. This illustrates the following theorem, which tells us that we obtain two relatively prime integers when we divide each of two original integers by their greatest common divisor.
Can anyone please help me understand how all the common factors are removed by dividing with their gcd?
Suppose we have two numbers: $$a=p_1^{x_1}p_2^{x_2}$$ and $$ b=p_1^{y_1}p_2^{y_2}$$ For the sake of this answer, I'm assuming only $2$ prime factors, but the idea can be easily generalized. When you take GCD, first you see if $x_1>y_1$ or not, if it is, the highest power of $p_1$ in GCD would be $y_1$, else it will be $x_1$. I shall be taking $x_1>y_1$. Now when you divide by GCD, represented by $h$, some power of $p_1$ would remain in $\frac ah$ but $\frac bh$ would have no power of $p_1$. Similarly, as we keep dividing by GCD, one of the numbers would have some power of the prime, while the other won't, hence creating relatively prime numbers.