[Math] Show that $ \sqrt{p}$ is irrational if $p$ is prime

elementary-number-theoryirrational-numbersreal-analysis

Show that $ \sqrt{p}$ is irrational if $p$ is prime.

I did the proof before that $ \sqrt{2}$ is irrational by contradiction:

Let's assume that $\sqrt{2}$ is rational, therefore given $m$ and $n$ sharing no common factor:
$$\sqrt{2} = \frac{m}{n}$$
$$2=\frac{m^2}{n^2}$$
$$2n^2=m^2$$

As $2 \mid 2n^2$ , it follows that $2 \mid m^2$, and that $2\mid m$.
Therefore $\exists k \in Z$ s.t. $m=2k$

Using back
$2n^2=m^2$ and substituting $m=2k$ in it, we have:
$$2n^2=(2k)^2$$
$$2n^2=4k^2$$
$$n^2=2k^2$$

Similarly, as $2 \mid 2k^2$, it follows that $2 \mid n^2$, and that $2 \mid n$.
Therefore, $\exists j \in Z$ s.t. $n=2j$

Finally, if $m=2k$ and $n=2j$ $n,j \in Z$, $m$ and $n$ share a common factor $2$. We have a contradiction with the assumption.

It follows that $\sqrt{2}$ cannot be rational but irrational.

This is where I am so far with my understanding. What would the best approach be with the original question?

What would be the approach be here? I was thinking to state that if $p$ is composite then $\exists x,y,m,n \in Z$, all four prime numbers, s.t. $p=xy$.and have then
$$\sqrt{xy}= \frac{m}{n}$$
but I don't see how I could move forward in this direction.

Much appreciated

Best Answer

Why not just try the same thing? Assume $\sqrt{p} = \frac{m}{n}$ for coprime $m,n$. Then $p = m^2/n^2 \implies m^2 = pn^2$. Hence $p \mid m^2 \implies p \mid m$ by Euclid's Lemma. Then $p \mid n^2 \implies p \mid n$. Contradiction.