If $a\mid b^2$ and $\gcd(a,b) = 1$, how can I prove that $a\mid b$? Let $a$, $b$ be positive integers. Clearly if $a\mid b^2$, $ak = b*b$ for some $k$ in $\mathbb{Z}$. Intuitively, $a$ will be the gcd so it must be $1$. But how can I show this? Is there a more appropriate way to phrase this or maybe some mathematical simplification or steps I can see? 
Thanks! 
Also, when I get to $a = 1$, how can I show that $b$ also must be $1$? 
 A: Suppose that $p\mid a$.  Since $a\mid b^2$, it follows that $p\mid b^2$.  Then, it follows that $p\mid b$.  This, however, is impossible since $a$ and $b$ are relatively prime.  Therefore, there can be no primes dividing $a$.  Therefore, $a=\pm 1$.  Since $\pm 1$ divides everything, $a\mid b$ (and $b$ can be any integer).
The proof of if $p\mid b^2$ then $p\mid b$ is the same as the proof that if $2\mid b^2$, then $2\mid b$ (this shows up in the contradiction proof of $\sqrt{2}$ being irrational).
In this case, the proof that if $p\mid b^2$ then $p\mid b$ requires unique factorization.  If we prime factorize $b^2$, then since $p\mid b^2$, $p$ must be one of the prime factors of $b^2$.  However, since the prime factors of $b^2$ are just the prime factors of $b$ with twice their multiplicity, it follows that $p$ must be a prime factor of $b$ and so $p\mid b$.  (Or see the alternative proof in the comments below).
A: You are saying that all the primes in $a$ are in $b^2$ and hence in $b$. Moreover you are saying that $a$ and $b$ have no common primes. The only option is that $a$ has no primes, i.e. $a=\pm 1$. But then $a|b$ trivially.
A: Hint: Note that $a\not\mid b\implies b=ka+r,\ r\in {1,2,\cdots, a-1}\implies b^2\equiv j \mod a$ with $j\ne 0$.
Edit: Note that as per my answer $(a,b)=1\implies a=\pm 1$.
