If $a^2$ divides $b^2$, then $a$ divides $b$

By the fundamental theorem of arithemtic, you can write $a$ and $b$ as a product of primes, say $$ a=p_1^{\alpha_1}\cdots p_r^{\alpha_r},\qquad b=p_1^{\beta_1}\cdots p_r^{\beta_r} $$ where $\alpha_i,\beta_i\geq 0$. Allow the exponents to possibly be $0$ if such a prime $p_i$ occurs in the factorization of one integer but not the other.

So $a^2=p_1^{2\alpha_1}\cdots p_r^{2\alpha_r}$ and $b^2=p_1^{2\beta_1}\cdots p_r^{2\beta_r}$. Since $a^2\mid b^2$, by unique factorization, necessarily $2\alpha_i\leq 2\beta_i$ for each $i$. That implies $\alpha_i\leq\beta_i$ for all $i$, and so $a\mid b$.


To say that $a^2$ divides $b^2$ is to say that $n=b^2/a^2 = (b/a)^2$ is an integer. Now integers only have square roots which are integers or irrational. Since $b/a$ is rational, it must be an integer, which is to say that $a$ divides $b$.


Call a positive integer $y$ bad if for some positive $x$, we have $x^2\mid y^2$ but $x \nmid y$.

If there are bad positive integers, there is a smallest bad one, say $b$. Since $b$ is bad, there is a positive integer $a$ such that $a^2 \mid b^2$ but $a \nmid b$.

It is clear that $a \ne 1$. So some prime $p$ divides $a^2$. But if a prime divides the product $cd$, it divides $c$ or $d$ or both. Thus $p\mid a$.

Since $a^2\mid b^2$, we have $p\mid b^2$, and therefore $p\mid b$.

Let $a=pa_1$ and $b=pb_1$. Since $a^2\mid b^2$, we have $(pa_1)^2=q(pb_1)^2$ for some integer $q$, and therefore $a_1^2\mid b_1^2$.

But $a_1\nmid b_1$, since if it does, one can easily show that $a\mid b$.

So we have shown that $b_1$ is bad. It is clear that $b_1\lt b$, which contradicts the supposed minimality of $b$.

We conclude that there are no bad positive integers.