TITLE: Show that $A = \{p\in\mathbb{ Q}^+\mid p^2<2\}$ contains no largest number and $B= \{p\in\mathbb {Q}^+\mid p^2>2\}$ contains no smallest number
QUESTION [10 upvotes]: I was reading Principles of Mathematical Analysis - Walter Rudin. In the start (pg-11), it is shown that the equation $p^2 = 2$ is not satisfied by any rational $p$ i.e. $\sqrt{2}$ is irrational.
After this the book says:
"We now examine this situation a little more closely. Let $A$ be the set of all positive rationals $p$ such that $p^2 < 2$ and let $В$ consist of all positive rationals $p$ such that $p^2 > 2$. We shall show that $A$ contains no largest number and $В$ contains no smallest.
More explicitly, for every $p \in A$ we can find a rational $q \in A$ such that $p < q$, and for every $p \in В$ we can find a rational $q \in В$ such that $q < p$.
To do this, we associate with each rational $p > 0$ the number
$$
\begin{align}
q &= p - \frac{(p^2 - 2)}{p + 2} &(2)\\
&=\frac{2p + 2}{p + 2} &(3)\\
&\Rightarrow q^2 - 2 = \frac{2(p^2 - 2)}{(p + 2)^2} &(4)
\end{align}
$$
If $p \in A$ then $p^2 — 2 < 0$, (3) shows that $q > p$, and (4) shows that $q^2 < 2$. Thus $q \in A$. If $p \in В$ then $p^2 — 2 > 0$, (3) shows that $0 < q < p$, and (4) shows that $q^2 > 2$. Thus $q \in B$."
I am unable to follow this part, specially how we construct the equations (3) and (4). Can somebody explain?

REPLY [23 votes]: This is a "good old-fashioned" textbook which tells you the answer and proves it is true but never gives you a clue as to where the answer came from in the first place.  It might have been something like this.$\def\eps{\varepsilon}$
We have a positive rational $p$ such that $p^2<2$; we want a rational bigger than $p$, such that its square is still less than $2$.  So we want, let's say,
$$(p+\eps)^2<2$$
with $\eps$ a positive rational.  Expanding and rearranging,
$$\eps^2+2p\eps<2-p^2\ .$$
Now we could solve this to find $\eps$, but it would be rather messy.  More importantly, the formula would contain a square root, so it would be very hard to be sure that $\eps$ was rational.  So we have to be a bit more careful.  Write the above as
$$\eps(2p+\eps)<2-p^2\ ;\tag{$*$}$$
we can get rid of the second $\eps$ by noting that we will certainly need $p+\eps<2$.  So if
$$\eps(p+2)\le2-p^2\ ,$$
then $(*)$ will be true, because its LHS is less than this LHS.  Thus we can take
$$\eps=\frac{2-p^2}{p+2}$$
and hence
$$p+\eps=p+\frac{2-p^2}{p+2}\ ,$$
which is Rudin's $q$.

REPLY [7 votes]: Equation 2 is the definition of $q$.  Rudin (or somebody) had the inspiration that this $q$ would work.  Adding some steps:$$\begin{align}
q &= p - \frac{(p^2 - 2)}{p + 2} &(2)\\
&=\frac {p(p+2)}{p+2}-\frac{(p^2 - 2)}{p + 2}\\
&=\frac{p^2+2p-p^2+2}{p+2}\\
&=\frac{2p + 2}{p + 2} &(3)\\
\Rightarrow q^2 - 2 &=\frac{4p^2+8p+4}{p^2+4p+4}-\frac{2p^2+8p+8}{p^2+4p+4}\\ &=\frac{2(p^2 - 2)}{(p + 2)^2} &(4)
\end{align}$$