Condition for Rational Number to be Square of Rational Number

Theorem
Let $m$ and $n$ be (strictly) positive integers which are coprime.

Then:
 * $\dfrac m n$ is the square of a rational number


 * both $m$ and $n$ are square numbers.
 * both $m$ and $n$ are square numbers.

Proof
Let $m$ and $n$ be (strictly) positive integers which are coprime.

Sufficient Condition
Suppose that $\dfrac m n$ is the square of a rational number.

Then there exists a rational number $r$ such that:
 * $\dfrac m n = r^2$

By Existence of Canonical Form of Rational Number, we can find $p \in \mathbb Z, q \in \mathbb Z_{>0}, p \perp q$ such that:
 * $r = \dfrac p q$

Now we have:
 * $\dfrac m n = \paren {\dfrac p q}^2 = \dfrac {p^2} {q^2}$

By Powers of Coprime Numbers are Coprime, $p^2$ and $q^2$ are coprime.

Hence both $\dfrac m n$ and $\dfrac {p^2} {q^2}$ are in canonical form.

By Canonical Form of Rational Number is Unique, we must have:
 * $m = p^2, n = q^2$

which shows that both $m, n$ are square numbers.

Necessary Condition
Suppose that both $m$ and $n$ are square numbers.

Then there exists integers $x, y$ such that:
 * $m = x^2, n = y^2$

Since $n > 0$, we must have $y \ne 0$.

Therefore we can write:
 * $\dfrac m n = \dfrac {x^2} {y^2} = \paren {\dfrac x y}^2$

By definition, $\dfrac x y$ is a rational number.

Hence we have shown that $\dfrac m n$ is the square of a rational number.