How do these statements imply that the square root of 2 is irrational? Let $A$ be the set of all rationals $p$ such that $p^2 < 2$ and Let $B$ be the set of all rationals $p$ such that $p^2 > 2$


*

*If $p$ is in $A$, then there is some $q$ in $A$ such that $p<q$

*If $p$ is in $B$, then there is some $q$ in $B$ such that $p>q$
This is the final part of Baby Rudin's proof of irrationality of $\sqrt2$
I don't understand how these two statements imply the irrationality of $\sqrt2$
If someone can tell me the reasoning behind it, It'd really help.
 A: Rudin is not attempting to prove that $\sqrt{2}$ is irrational by the two statements you have summarized in your post. He has already shown in the first two paragraphs of $\S$1.1 Example that there is no rational $p$ such that $p^2 = 2$. After this, he says, "We now examine this situation a little more closely." This examination is what you are concerned with in your question.
The bottom line of this examination is the following:

*

*It is assumed that we already know that the set of rational numbers is linearly ordered, that is, for any two rationals $p$ and $q$, we can say that either $p \leq q$ or $q \leq p$ (or both, in which case, $p = q$).

*Rudin has just shown that there is no rational $p$ such that $p^2 = 2$.

*Following this, Rudin has shown that for any rational $p > 0$ such that $p^2 < 2$, there is another rational $q > p$ such that $q^2 < 2$, too; similarly, for any rational $p$ such that $p^2 > 2$, there is another rational $q < p$ such that $q^2 > 2$, too.

Thus, the set of rational numbers appears to have "gaps" in the sense identified in 3. above. For any rational that is slightly less than $\sqrt{2}$, we can find a larger rational that is also slightly less than $\sqrt{2}$. For any rational that is slightly greater than $\sqrt{2}$, we can find a smaller rational that is also slightly greater than $\sqrt{2}$. Yet, at no point can we find a rational that is exactly equal to $\sqrt{2}$.
Hence, though the linear ordering of the set of rational numbers as in 1. suggests the mental image of a line, we must amend the naïve picture of a continuous line to note the presence of these "gaps" in this rational number line. Thus does real analysis begin.
