Follow-up Question: Proof of Irrationality of $\sqrt{3}$

As a follow-up to this question, I noticed that the proof used the fact that $p$ and $q$ were "even". Clearly, when replacing factors of $2$ with factors of $3$ everything does not simply come down to being "even" or "odd", so how could I go about proving that $\sqrt{3}$ is irrational?


It's very simple, actually. Assume that $\sqrt{3}$ = $\frac{p}{q}$, with $p,q$ coprime integers.

Then, $p = \sqrt{3}q$ and $p^2 = 3q^2$. If $3\mid p^2$, then $3\mid p$. So actually, $9\mid p^2$. Then, by similar logic, $3\mid q^2$, meaning $3\mid q$. Since $3$ divides both $p$ and $q$, the two numbers are not coprime. This is a contradiction, since we assumed that they $\textbf{were}$ coprime. Therefore, $\sqrt{3}$ cannot be written as a ratio of coprime integers and must be irrational.


$\textbf{NOTE:}$ The word "even" in the original proof was just a substitution for "divisible by $2$". This same idea of divisibility was used in this proof to show that $p$ and $q$ were divisible by $3$. It really is the same idea. There just isn't a nice concise word like "even" that was used to describe a multiple of $3$ in this proof.


Alternatively, a contradiction can be derived as follows: $$\begin{align} \sqrt3 &=\frac ab \\ a^2&=3b^2 \\ a^2+b^2 &= 4b^2=(2b)^2 \\ \end{align}$$The contradiction is due to the fact that the integer length of the hypothenuse of a primitive right triangle is odd.