All rational numbers have the fraction form $$\frac a b,$$ where a and b are integers($b\neq0$).

My question is: for what $a$ and $b$ does the fraction have rational square root? The simple answer would be when both are perfect squares, but if two perfect squares are multiplied by a common integer $n$, the result may not be two perfect squares. Like:$$\frac49 \to \frac 8 {18}$$

And intuitively, without factoring, $a=8$ and $b=18$ must qualify by some standard to have a rational square root.

Once this is solved, can this be extended to any degree of roots? Like for what $a$ and $b$ does the fraction have rational $n$th root?

In order for the powers to continue being integers when we divide (and thus the result a rational number), they must be multiples of $n$. In the case where $n$ is $2$, that means the numerator and denominator, in their reduced form, are squares. (And for $n=3$, cubes, and so on...)

In your example, when you multiply the numerator and denominator by the same number, they continue to be the same rational number, just represented differently.

$$\frac{2*4}{2*9} = 2^{2+1-1}*3^{-2} = 2^{2}*3^{-2}$$

You correctly recognize the important of factoring, though you don't really want to use it in your answer. But the most natural way to test if the fraction produced by dividing $a$ by $b$ has a rational $n$th root, is to factor $a/b$ and look at the powers. Or, equivalently, reduce the fraction and determine if the numerator and denominator are integers raised to the power of $n$.

We give a fairly formal statement and proof of the result described in the post.

Theorem: Let $a$ and $b$ be integers, with $b\ne 0$. Suppose that $\frac{a}{b}$ has a rational square root. Then there exists an integer $e$, and integers $m$ and $n$, such that $a=em^2$ and $b=en^2$,

Proof: It is enough to prove the result for positive $b$. For if $b$ is negative and $\frac{a}{b}$ has a square root, then we must have $a\le 0$. Thus $\frac{a}{b}=\frac{|a|}{|b|}$. If we know that there are integers $e$, $m$, $n$ such that $|a|=em^2$ and $|b|=en^2$, then $a=(-e)m^2$ and $b=(-e)n^2$.

So suppose that $b\gt 0$, and $a\ge 0$. Let $d$ be the greatest common divisor of $a$ and $b$. Then $a=da^\ast$, and $b=db^\ast$, for some relatively prime $a^\ast$ and $b^\ast$.

It will be sufficient to prove that each of $a^\ast$ and $b^\ast$ is a perfect square.

Since $\frac{a^\ast}{b^\ast}$ is a square, there exist relatively prime integers $m$ and $n$ such that $\frac{a^\ast}{b^\ast}=\left(\frac{m}{n}\right)^2$.

With some algebra we reach
$$a^\ast n^2=b^\ast m^2.$$

By Euclid's Lemma, since $b^\ast$ divides the product on the left, and is relatively prime to $a^\ast$, we have that $b^\ast$ divides $n^2$. Also, because $n^2$ divides the expression on the right, and $n^2$ is relatively prime to $m^2$, we have $n^2$ divides $b^\ast$. Since $b^\ast$ is positive, we conclude that $b^\ast=n^2$. Now it is easy to show that $a^\ast=m^2$.

Trivially, a rational number has a rational square root if and only if it's the square of some rational number.

As the other answers note, various other characterizations can be given, e.g. that $\frac ab$ has a rational square root if and only if:

$a = ec^2$ and $b = ed^2$ for some integers $c$, $d$ and $e$,

the numerator and denominator of the reduced form of $\frac ab$ are both squares, or

the unique prime factorization of $\frac ab$ has only even exponents.

Yet another "cute" characterization is that $\frac ab$ has a rational square root if and only if $ab$ is a square of an integer. I've sketched a proof of this below. Alas, this trick does not generalize to higher powers.

Proof. To show that this rule works, first note that, if $a = ec^2$ and $b = ed^2$, then $ab = c^2d^2e^2 = (cde)^2$. Showing the converse is a bit trickier, but it follows easily enough from prime factorization. Specifically, let
$$ ab = x^2 = y = \prod_{i=1}^\infty p_i^{y_i}
,\quad
a = \prod_{i=1}^\infty p_i^{a_i}
\quad\text{and}\quad
b = \prod_{i=1}^\infty p_i^{b_i} $$
where $p_i$ denotes the $i$-th prime. Since $y = x^2$ is a square, we know that $y_i$ must be even for all $i$; from $y = ab$, we know that $y_i = a_i + b_i$ for all $i$. Together, these imply that, if $a_i$ is odd for some $i$, so is $b_i$, and the converse also holds.
Now let $$e = \prod_{i=0}^\infty p_i^{e_i},$$
where $e_i = 1$ if $a_i$ and $b_i$ are odd, and let $e_i = 0$ if they are even. Since $e_i \le a_i$ and $e_i \le b_i$ for all $i$, $e$ divides both $a$ and $b$. Furthermore, since $a_i - e_i$ and $b_i - e_i$ are both even for all $i$, it follows that $a/e = c^2$ and $b/e = d^2$ are both squares, and so we can write $a = ec^2$ and $b = ed^2$. $\square$

"Yet another "cute" characterization is that ab has a rational square root if and only if ab is a square of an integer." This is the answer I actually want, because it disregards whether a and b are in lowest term. But it fails to hold for higher degree of roots...
–
user2386986Jul 20 '13 at 21:02

1

Yes, it only works for square roots. Essentially, that's because the additive ring of integers modulo 2 has characteristic 2, and thus addition and subtraction modulo 2 are the exact same operation. The prime factorization of $ab$ is given by adding the exponents of the factorizations of $a$ and $b$, whereas that of $a/b$ is given by subtracting them. But for determining whether a number is a square, we only need to look at the exponents modulo 2, and thus addition and subtraction give the same result.
–
Ilmari KaronenJul 20 '13 at 21:13

You seem to confuse between a representation of the number as a ratio of two particular integers, and the number itself. This is similar to the confusion between $2$ and $10_b$ (binary base). Numbers represent some abstract quantity, not a numerical value.

The rational number $\frac49$ and the rational number $\frac8{18}$ are equal, and therefore they are the same number. You can't argue that something is true for the number $\frac49$ and not true for the number $\frac8{18}$. You could argue that it's easier to see that $\frac49$ has a square root by inspecting its representation as the ratio $\frac49$ rather than the ratio $\frac8{18}$, but that is not the same thing.

So when does a rational number $x$ has a square root? If and only if $x$ can be written as $\frac pq$ where both $p$ and $q$ have a square root.

It follows that whenever $m$ is a non-zero integer, $\frac{mp}{mq}$ will also have a square root, because that number is the same number as $\frac pq$.

First,
$$
\sqrt{\frac ab}\in\mathbb{Q}\implies\sqrt{ab}=b\,\sqrt{\frac ab}\in\mathbb{Q}\tag{1}
$$
According to this answer, since $\left(\sqrt{ab}\right)^2=ab\in\mathbb{Z}$, if $\sqrt{ab}\in\mathbb{Q}$, then $\sqrt{ab}\in\mathbb{Z}$. Thus, there is a $c\in\mathbb{Z}$ so that
$$
ab=c^2\tag{2}
$$
If $\gcd(a,b)=1$, then, by the Fundamental Theorem of Arithmetic, $(2)$ implies that both $a$ and $b$ are perfect squares.