Proving that for each prime number $p$, the number $\sqrt{p}$ is irrational [duplicate]

If $\sqrt p=\frac{a}{b}$ where (a,b)=1 and a>1 as p>1,

then $p=\frac{a^2}{b^2}$.

Now as p is integer, $b^2$ must divide $a^2$, which is impossible unless b=1 as (a,b)=1.

If b=1, p=$a^2$ which can not be prime as a>1.


Suppose $\sqrt{p}=\frac{m}{n}$, where $m,n$ are relatively prime integers and $n\neq 0$. Then by squaring you get $n^2\cdot p=m^2$, so $p$ divides $m^2$. As $p$ is prime we must have $p^2$ divides $m^2$. On the other hand then $p^2$ divides $pn^2$ so $p$ divides $n$. Hence $m$ and $n$ are not relatively prime so we reached a contradiction.