# Prove that if $ab$ is a perfect square and $GCD(a,b)=1$, then $a$ and $b$ are perfect squares

Let $$a$$ and $$b$$ be positive integers. How can I easily prove that if $$ab$$ is a perfect square and $$GCD(a,b)=1$$ then $$a$$ and $$b$$ are perfect squares.

I actually managed to prove that this way:

if an integer $$n$$ is a perfect square, then all the powers of the prime numbers of its integer factorization are even. So if an integer is not a perfect square, then at least one the prime numbers of its integer factorization is odd.

Then, reasoning by the absurd, we suppose that $$a$$ and $$b$$ are not perfect squares and considering that their GCD is 1, no prime number of its integer factorizations is the same, so $$ab$$ is not a perfect square, which is absurd.

Even if this proof seems convincing, I'd like to know if it was possible to solve the problem another easier way (In exam conditions, I'd have to prove the proposition that if "if an integer $$n$$ is a perfect square, then all the powers of the prime numbers of its integer factorization are even" considering that it's not included in the course given by the teacher, so It would get a little tedious)

• – Bill Dubuque Jan 18 at 18:05

Your proof is just fine (and in fact, the claim you use holds true also in the opposite direction: a positive integer is a complete square if and only if every prime enters its prime decomposition with an even exponent). However, if, for any reason, you want a different proof, you can use the basic properties of the greatest common divisor: if $$a$$ is coprime with $$b$$ and $$ab=m^2$$, then $$a = a(a,b) = (a^2,ab) = (a^2, m^2) = (a,m)^2,$$ and similarly $$b=(b,m)^2$$, so that both $$a$$ and $$b$$ are complete squares.

• Yes! That's exactly the type of proof that would work well on an exam paper. Thank you very much – s89ne Jan 18 at 17:23
• @s89ne Same as proof in the linked dupe (please search first!) – Bill Dubuque Jan 18 at 18:08

In exam conditions, I'd have to prove the proposition that if "if an integer n is a perfect square, then all the powers of the prime numbers of its integer factorization are even" considering that it's not included in the course given by the teacher, so It would get a little tedious

Yes, you would. But I dont think it'd be tedious or hard:

Let $$n = k^2$$ and let $$k =\prod p_i^{a_i}$$ be the unique prime factorisation. Then $$n = k^2 = (\prod p_i^{a_i})^2 = \prod p_i^{2a_i}$$ is the unique prime factorization of $$n$$.

So 1: If $$n$$ is a perfect square $$\implies$$ its prime factorization contains only even powers.

Let $$n = \prod {p_i^{2a_i}}$$ be a number whose prime factorization contains only even powers. Then $$n = (\prod p_i^{a_i})^2$$.

So 2: If $$n$$ is a number whose prime factorization contains only even powers $$\implies n$$ is a perfect square.

considering that it's not included in the course given by the teacher

I find that a little hard to be believe. It's such a basic result that I imagine a (poor) teacher may have glossed over it or took it for granted. Or maybe a slightly overwhelmed student might have blinked in class while it was presented and missed it.