Proof: the square root of the product of two distinct primes is irrational

I'd like to prove that the product of the roots of two distinct primes $p_1$ and $p_2$ is irrational. That is, $$\sqrt{p_1 p_2} \notin \mathbb{Q}$$

Would the following be a valid proof?

Suppose $\sqrt{p_1 p_2} \in \mathbb{Q}$.

Then $\sqrt{p_1 p_2} = \frac{a}{b}$ for $a,b \in \mathbb{Z}$ such that $\gcd(a,b) = 1$. $$p_1 p_2 = \frac{a^2}{b^2} \implies p_1p_2b^2 = a^2 \implies p_1, p_2 \mid a^2 \implies p_1, p_2 \mid a.$$ So $a = p_1 p_2 n$, for nonzero $n \in \mathbb{Z}$.

Let the unique prime factorization of $a = p_1 p_2 (p_{i_1} \cdots p_{i_n})$ and of $b=p_{j_1} \cdots p_{j_m}$.

Then $$p_1p_2 = \frac{a^2}{b^2} = \frac{p_1^2 p_2^2 (p_{i_1}^2 \cdots p_{i_n}^2)}{p_{j_1}^2 \cdots p_{j_m}^2} = p_1 p_2 \underbrace{\left( \frac{p_1 p_2 (p_{i_1}^2 \cdots p_{i_n}^2)}{p_{j_1}^2 \cdots p_{j_m}^2} \right)}_{=1}$$ But this implies that $p_1 = p_{j_t}$ and $p_2 = p_{j_s}$ for $t, s \in [1,m]$. That is $p_1, p_2 \mid b$.

Therefore, $p_1$ and $p_2$ are divisors of both $a$ and $b$, which contradicts $\gcd(a,b)=1$.

Hence, $\sqrt{p_1 p_2} \notin \mathbb{Q}$.

P.S. Sorry for the double subscripts.

• The proof looks OK, I would suggest trying to use a factorization to get that $p_1,p_2|b$ instead of dividing. – Michael Burr May 7 '17 at 20:48
• The proof is fine, but a little over complex. Once you show that $p_1$, say, divides $a$ you can show that $p_1$ divides $b$ and that's enough. – lulu May 7 '17 at 20:49
• These number-theoretic proofs are important to know how to do--nothing wrong with them--but know that are a variety of other ways of going about this. For instance, one could consider the polynomial $f(x) = x^2 - p_1p_2$. The irreducibility of $f$ would imply $\sqrt{p_1p_2} \notin \mathbb{Q}$; one can use Eisenstein's criterion or the rational root test to show this. – Kaj Hansen May 7 '17 at 20:52
• @KajHansen How irreducibility of $f(x)$ imply $\sqrt{p_1p_2} \notin \mathbb{Q}$? – user157835 Jul 4 '17 at 2:29

Once you get at $p_1 p_2 b^2 = a^2$ I'd just point out that, say, $p_1$ appears an odd number times on the left and an even number of times on the right.