prove that if $p$ is a prime number, then $\sqrt{p}$ is an irrational number. 
*

*$\sqrt{p}$ is rational. 

*$\sqrt{p}=\frac{a}{b}$, where $a,b$ are integers with $\gcd(a,b)=1$.

*$a^2=b^2p$. 


Since $p$ divides $a^2$, $p$ divides $a$.


*

*$a=kp$. 

*$a^2=k^2p^2=b^2p$ 

*$p=\frac{b^2}{k^2}\Rightarrow\sqrt{p}=\frac{b}{k}\Rightarrow\frac{a}{b}=\frac{b}{k}$

*$b^2=ak\Rightarrow b=\sqrt{ak}$.

*$\sqrt{p}=\frac{a}{b}=\frac{a}{\sqrt{ak}}=\frac{\sqrt{a}\sqrt{a}}{\sqrt{a}\sqrt{k}}$ which has $\gcd(a,b)=\sqrt{a}\neq 1$ , a contradiction.


($a\neq 1$ because the only number that divides 1 is 1, but 1 is not a prime from $a=kp$)
Hence, $p$ is irrational. Is this legit?

By way of contradiction, assume $\sqrt{p}$ is rational. Then there exist $a, b \in \mathbb{Z}$ with $b\neq 0$ such that $\sqrt{p} = \frac{a}{b}$. Without loss of generality, we may assume $\text{gcd}(a,b) \neq 1$
We can make this assumption, because we still lose no generality.
Now using  $\text{gcd} (a,b) = d \neq 1$. Then we can write $a = d \cdot a'$ and $b = d \cdot b'$, for some relatively prime integers $a'$ and $b'$. 
Hence
$$
\sqrt{p} = \frac{a}{b} = \frac{d a'}{d b'} = \frac{a'}{b'},
$$
So we have shown that $\sqrt{p}$ is a ratio of two relatively prime integers.
