Proof $\sqrt{2}$ irrational using last digits

I was struggling to see how the last digit of $b^2$ must be 0. I believe the answer is that it is not necessary, it could be 0 or 5. It can be seen that the last digits of $a^2,b^2$ must be in 0,1,4,9,6,5 , so cannot be 2 or 8,

$$ a^2\equiv 0 \mod 10$$ $$ 2b^2\equiv 0 \mod 10$$ Since $2|10$, $$ b^2\equiv 0 \mod 5$$ Then since 5 is prime, we can make the argument that the factor of 5 did not come from squaring. Therefore if true for $b,a$ we can divide by 5 to find it is also true for two smaller integers, leading to a contradiction by infinite descent due to the well ordering principle.


Assume for contradiction that there are non zero natural numbers $a, b$ such that $a^2 = 2 b^2$. Consider $a \neq 0 \in \mathbb{N}$ minimal such that there is $b \in \mathbb{N}$ (wlog) such that $a^2 = 2 b^2$. As observed, the last digit of $a^2$ and $2b^2$ are $0$, so that both are divisible by $5$.

Hence, both $a$ and $b$ are divisible by $\textbf{5}$ (and not necessarily by $10$, as noted by @jamie in his excellent answer).

Then $a' := \frac{a}{5}$ and $b' := \frac{b}{5}$ also satisfy $a'^2 = 2 b'^2$. It is a contradiction since $a' < a$.

Btw I skiped the "infinite descent" but it amounts to this : if any $a, b$ satisfy $a^2 = 2 b^2$ then $a' := \frac{a}{5}$ and $b' := \frac{b}{5}$ also satisfy $a'^2 = 2 b'^2$ and eventualy you can't divide by $5$ anymore.