Question: I was looking back at my notes on number theory and I came across this question.

Let $a$, $b$ be positive integers such that $\gcd(a, b) = 3$. What are the possible values for $\gcd(a^2, b)$?

I know it has to do with their prime factorization decomposition, but where do I go from here?

Answer: 
If $p$ is a prime, and $p|a^2$, then $p|a$; thus, if $p|a^2$ and $p|b$, then $p|a$ and $p|b$, hence $p|\gcd(a,b) = 3$. So $\gcd(a^2,b)$ must be a power of $3$.

Also, $3|a^2$ and $3|b$, so $3|\gcd(a^2,b)$; so $\gcd(a^2,b)$ is a multiple of $3$.

If $3^{2k}|a^2$, then $3^k|a$ (you can use prime factorization here); so if $3^{2k}|\gcd(a^2,b)$, then $3^k|\gcd(a,b) = 3$. Thus, $k\leq 1$. That is, no power of $3$ greater than $3^2$ can divide $\gcd(a^2,b)$.

In summary: $\gcd(a^2,b)$ must be a power of $3$, must be a multiple of $3$, and cannot be divisible by $3^3=27$. What's left? Now give examples to show all of those possibilities can occur.
**Hint** $\rm\: \ (a,b)\ |\ (a^2,b)\ |\ (a,b)^2\ $ since $\rm\ (a^2,b)\ |\ a^2,ab,b^2\ \Rightarrow\ (a^2,b)\ |\ (a^2,ab,b^2) = (a,b)^2 $

Therefore $\rm\:3\ |\ (a^2,b)\ |\ 9\:$ when $\rm\:(a,b) = 3\ \ $ **QED**

Or: $\:$ let $\rm\:a = 3^K A,\:\ b = 3^N B,\ \ 3\nmid A,B.\ \ $ $\rm(a,b)=3\ \Rightarrow \ (A,B) = 1\:$ and $\rm\:\min(K,N) = 1.\:$ Thus

$$\rm (a^2,b) = (3^{2K} A^2, 3^N B) = (3^{2K},3^N)(A^2,B) = (3^{2K},3^N) = 3\: \ if\: \ N\! =\! 1\: \ else \ 9\ ( N \ge 2\Rightarrow K = 1)$$