TITLE: If a and b are relatively prime and ab is a square, then a and b are squares.
QUESTION [11 upvotes]: If $a$ and $b$ are two relatively prime positive integers such that $ab$ is a square, then $a$ and $b$ are squares.

I need to prove this statement, so I would like someone to critique my proof. Thanks
Since $ab$ is a square, the exponent of every prime in the prime factorization of $ab$ must be even.   Since $a$ and $b$ are coprime, they share no prime factors.   Therefore, the exponent of every prime in the factorization of $a$ (and $b$) are even, which means $a$ and $b$ are squares.

REPLY [8 votes]: Its clear you understand what's going on, but it might help you communicate it more precisely if you use symbols.  For example if $a$ has prime factorization $$a = p_1^{l_1} \cdot p_2^{l_2} \cdot \ldots \cdot p_n^{l_n}$$ and $b$ has prime factorization $$b = q_1^{k_1} \cdot q_2^{k_2} \cdot \ldots \cdot q_m^{k_m}$$ then $ab$ has prime factorization $$ab = p_1^{l_1} \cdot p_2^{l_2} \cdot \ldots \cdot p_n^{l_n} \cdot q_1^{k_1} \cdot q_2^{k_2} \cdot \ldots \cdot q_m^{k_m}.$$  There can be no $p_i = q_j$ because $a$ and $b$ are coprime.
Because $ab$ is square, all of the $l_i$ and $k_i$ are even, completing the proof.