Prove that if $ab$ is a perfect square and $\gcd(a,b)=1$, then both $a$ and $b$ must be perfect squares.

Their Answer:

Consider the prime factorization $ab=p_1^{e_1}\cdots p_k^{e_k}$. If $ab$ is a square, all the $e_i$ are even and each term $p_i^{e_i}$ is a square in its own right. (Do you see why?) Each prime in the factorization divides either $a$ or $b$ but not both, since we have $\gcd(a,b)=1$. Thus each term $p_i^{e_i}$ in the factorization completely divides either $a$ or $b$. Hence, $a$ is the product of many terms $p_i^{e_i}$, each of which is a square; since it’s a product of squares, $a$ is itself a square. Similarly for $b$. □

My Question

The answer states if:

$$ab = P_1^{e_1}....P_n^{e_n}$$

Then if $ab$ is a perfect square, $e_k$ is even for any $k$.

But since:

$$ab = (P_1 \cdots P_n)^{e_1 \cdots e_n}$$

It is possible that if $e_1 = 3$ and $e_2 = 4$ then, $e_1 \cdot e_2 = 12$

So not all $e_k$ have to be even?

  • $\begingroup$ $p_1^{e_1}\cdots p_n^{e_n} \neq (p_1\cdots p_n)^{e_1\cdots e_n}$. $\endgroup$
    – user99914
    Commented May 15, 2015 at 6:11
  • $\begingroup$ You have an algebra error. $p_1^{e_1} p_2^{e_2} \dots p_n^{e_n} \neq (p_1 p_2 \dots p_n)^{e_1 e_2 \dots e_n}$ $\endgroup$ Commented May 15, 2015 at 6:11

2 Answers 2


If $ab=2^4\cdot 3^2$ is $ab=(2\cdot 3)^{4\cdot 2}=6^8$? Because that's your argument.

It is not true that:



Note that $$2^33^4\neq 6^{12}$$In fact $2^33^4=8\times 81=648$ is clearly not a square, and $6^4=1296\gt 648$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .