Let $p$ be a prime number.Show that $\sqrt{p}$ is a irrational number.

Let $$p$$ be a prime number. Show that $$\sqrt{p}$$ is a irrational number.

Attempt: Suppose for contrary that $$\sqrt{p}$$ is a rational number. Then, $$\sqrt{p}=\frac{m}{n} \qquad (1),$$ for some integers $$m$$ and $$n$$ with $$n \ne 0$$ and $$\gcd(m,n)=1$$. By squaring both side of $$(1)$$, we obtain $$p=\frac{m^2}{n^2} \implies m^2 = pn^2 \implies p\mid m^2. \qquad (2)$$ We'll show that if $$p\mid m^2$$, then $$p \mid m$$. Suppose for the contrary that $$p \nmid m$$. Then, $$m=pq+r$$, for some integer $$q$$ and $$r$$ with $$0. Hence, $$m^2=(pq+r)^2=p^2q^2+2pqr+r^2.$$ Since $$p \mid m^2$$, then $$p \mid p^2q^2+2pqr+r^2$$, which means $$p \mid r^2$$. But, since $$0, we have $$p \nmid r^2$$, a contradiction. So, if $$p \mid m^2$$, then $$p \mid m$$. Now, on $$(2)$$, we get $$p \mid m$$. It means there is an integer $$k$$ such that $$m=pk$$. Plugging this in to the relation $$m^2=pn^2$$, we have $$p^2k^2=pn^2$$, which implies that $$p \mid n$$. Since $$p \mid m$$ and $$p \mid n$$, then $$\gcd(m,n) \ge p>1$$, since $$p$$ is a prime number. Contradiction with the assumption that $$\gcd(m,n)=1$$. Therefore, $$\sqrt{p}$$ is a irrational number.

Does the above approach correct, especially in the proof of implication: "If $$p\mid m^2$$, then $$p \mid m$$" (without using Euclid's Lemma; that is, by an elementary approach)? Thanks in advanced.

• Comments are not for extended discussion; this conversation has been moved to chat. Sep 22, 2022 at 14:27
• I prefer to show that $\gcd(m,n) = 1 \implies \gcd(m^2, n^2) = 1$, therefore if $n \nmid m$, then $n^2 \nmid m^2$. So if $\frac mn$ is not integer, neither is $\frac {m^2}{n^2}$. Therefore if $p$ is any integer other than a perfect square, $\sqrt p$ cannot be rational. Sep 22, 2022 at 22:53
• Does this answer your question? How to prove: if $a,b \in \mathbb N$, then $a^{1/b}$ is an integer or an irrational number? Sep 24, 2022 at 23:29
• This question is a multi-duplicate in that many similar or identical questions have been closed as duplicates. The above answer seems to be the generic one which all the duplicates are pointed at. Sep 24, 2022 at 23:30

The equality $$m^2=pn^2$$ contradicts the fundamental theorem of arithmetic because $$p$$ appears an even number of times on the left hand side and an odd number of times on the right hand side.
Your method seems quite elementary. The one of Sinclair seems (my opinion) more sophisticate because $$n\not\mid m$$ does not mean $$n\wedge m=1$$.