If $ab = y^2$ and $\gcd(a,b) = 1$ then show that a is either a square or the negative of a square. Let $a, b \in \Bbb Z\backslash\{0\}$ . Suppose that $ab$ is a square, i.e., there exists $y \in\Bbb Z$ such that $ab = y^2$.
If $ab = y^2$ and $\gcd(a,b) = 1$ then show that a is either a square or the negative of a square.
 A: We can assume WLOG that $a$ is square free, or we can divide both sides by the square component of $a$. Now it just remains to show that $a$ is $\pm 1$. Suppose that $p \mid a$, then $p\mid y^2$, so $p \mid y$ by Euclid's lemma, and $p^2 \mid y^2=ab$. Since $p\mid a$, we have $p\nmid b$, since they are relatively prime. Thus $(p^2,b)=1$, so by the fundamental lemma, $p^2\mid a$. But $a$ was square free. Contradiction. Thus no prime divides $a$, so $a$ is a unit, and hence $a=\pm 1$.
Now if we assume $(a,b)=p$. We again assume WLOG that $a$ is square free at every prime except $p$, and indeed if any prime $q\ne p$ divides $a$, then by the same logic as above, since $q\nmid (a,b)=p$, we have $q\nmid b$ and $q^2\mid a$ again, contradiction. Thus we have $a=\pm p^k$ for some  $k$. We can WLOG pull out factors of $p^2$ as long as what remains is divisible by $p$ to preserve $(a,b)=p$ until $a$ is either $\pm p^2$ or $\pm p$. If $a$ is $\pm p^2$, then dividing by $a$, we have $b=\pm (y/p)^2$. But $p\mid b$, so $p\mid y/p$, but then $p^2 \mid b$ but since $p^2\mid a$, we have $p^2 \mid (a,b)=p$, a contradiction. Thus originally we had $a=\pm pn^2$ for some integer $n$.
A: Suppose $a=\pm p_1^{a_1 }... p_n ^{a_n}$ which is not a square and not a negative of a square  i.e $a_i$ s are not even for atleast one $ i$. Now $b= q_1^{b_1} ....q_r^{b_r}$ where no $p_i = q_j$ because $gcd(a,b)=1$. But $ab$ is a square which gives us contradiction.
A: Let $a=(-1)^{f(a)}\prod\limits_pp^{e_p(a)}$ and $b=(-1)^{f(b)}\prod\limits_pp^{e_p(b)}$ be the prime factorizations of $a$ and $b,$ respectively, where $f(i)$ is either $0$ or $1$ depending on whether $i$ is positive or negative. Then $ab=(-1)^{f(a)+f(b)}\prod\limits_pp^{e_p(a)+e_p(b)}$ and so $e_p(a)+e_p(b)$ must be even for each prime $p.$ Since $\gcd(a,b)=1$ it follows that at least one of $e_p(a)$ or $e_p(b)$ is $0$ and  hence both must be even. The result follows.
