Prove that $\gcd(a^2, b^2) = \gcd(a, b)^2$ [duplicate]

Solution 1:

If $d=\gcd(a,b)$, then $a=da_1$ and $b=db_1$ for some $a_1,b_1$ relatively prime.

Then $a^2=d^2a_1^2$ and $b^2=d^2b_1^2$.

Assume there is a prime $p$ which divides $a_1^2$ and $b_1^2$. Since $p$ is prime, $p\mid a_1$ and $p\mid b_1$ (if a prime divides a power, then it divides the number - basic property of primes). Contradiction, because $a_1,b_1$ relatively prime.

Hence $d^2$ is the GCD of $a^2$ and $b^2$.

To have a general proof, just replace the exponent "2" with "n".