I am studying the proof by contradiction below. But I am confused on why the proof is valid. It first assumes that $p, q$ have no common factor, and then arrives at a conclusion where $p, q$ are both divisible by $2$, and hence they do have a common factor, contradicting the earlier assumption. But I am confused on how this leads to the conclusion that $\sqrt{2}$ is irrational.
To me, it seems all it says is that we can't assume that $p, q$ have no common factors. How does it prove the case where $p, q$ have a common factor, but doesn't result in $\sqrt{2}$?