Some time ago I read Euclid's proof of the irrationality of $\sqrt 2$. The proof I leave below for any $n$ is quite similar in procedure to the one for $n=2$, and I think it is a good generalisation.
Theorem: $$ \not\exists k \in \mathbb N : k^2 = n \implies \sqrt n \not\in \mathbb Q $$
Proof (by contradiction):
For $n \ge 2$, assume $\sqrt n = \frac p q \land \textrm{gcd}(p, q) = 1$. Then $$ \begin{align*} n &= \frac{p^2}{q^2} \\ n q^2 &= p^2 \\ &\implies n | p^2 \iff n | p \\ &\implies \exists r : p = r \cdot n \\ nq^2 &= (rn)^2 \\ nq^2 &= r^2 n^2 \\ q^2 &= r^2 n \\ &\implies n | q^2 \iff n | q \\ &\implies \textrm{gcd}(p, q) \ge n \\ & \implies \bot \\ &\because \textrm{gcd}(p, q) = 1 \land \textrm{gcd}(p, q) \ge n \end{align*} $$
Therefore, $\sqrt n$ is irrational.
Is this a valid proof? Have I made a mistake?
solution-verification
question to be on topic you must specify precisely which step in the proof you question, and why so. This site is not meant to be used as a proof checking machine. – Bill Dubuque Sep 24 '23 at 17:02