I found the following proof arguing for the irrationality of $\sqrt{2}$.
Suppose for the sake of contradiction that $\sqrt{2}$ is rational, and choose the least integer $q > 0$ such that $(\sqrt{2} - 1)q$ is a nonnegative integer. Let $q'::= (\sqrt{2} - 1)q$. Clearly $0 < q' < q$. But an easy computation shows that $(\sqrt{2} - 1)q'$ is a nonnegative integer, contradicting the minimality of $q$.
Clearly, this is a vague proof in that it expects the reader to work out the math involved on his own. I took that as an exercise and worked out the following:
Assuming $\sqrt{2}$ to be rational, let $$\sqrt{2} = \frac{p}{q}$$ where $p$ and $q$ are least possible integers.
Clearly then, $\sqrt{2} - 1$ would also be rational, $$\sqrt{2} - 1 = \frac{p-q}{q}$$ where both $(p-q)$ and $q$ are also integers.
Multiplying both sides by $q$, we get $$(\sqrt{2} - 1)q = (p-q) = q'$$ where $q'$ is an integer. Using, $2>\sqrt{2} > 1$ , we get $$1>\sqrt{2}-1>0$$ proving that $q'$ is a non-negative integer.
As stated in the proof, computing $(\sqrt{2}-1)q'$ we get, $$(\sqrt{2}-1)q' = \frac{(p-q)^2}{q}$$which is not necessarily an integer (in fact necessarily not an integer). However, the proof claims it to be.
Am I missing something or something is wrong with how I proceeded?
Here is a link to the textbook where I found this proof: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-spring-2015/readings/MIT6_042JS15_textbook.pdf, (p 32, problem 1.14).
P.S. This is my first post here and my first time with TeX. I'd also like to know if there is anything wrong with the way my question is presented.
$$(\sqrt2-1)q'=(\sqrt2-1)(\sqrt2-1)q=(3-2\sqrt2)q=q+2(1-\sqrt 2)q =q-2q'$$