# A Small Question about Rudin's Gap Construction [duplicate]

In Rudin's PMA, he shows the following.

$A=$ { $p \in R^+ | p^2<2$}, B= { $p \in R^+ | p^2>2$}

Let $q = p - \frac{p^2 -2}{p+2}= \frac{2p+2}{p+2}$, then $q^2 -2= \frac{2(p^2- 2)}{(p+2)^2}$

Therefore, if $p$ is in $A$, then $q>p$ and $q$ is in A. If $p$ is in $B$, $0<q<p$ and $q$ is in $B$.

I do understand all of this, but I'm just wondering if there is any fundamental mathematical reasoning to construct a gap like this. It just seems to me that he found somehow that magical number $q$: I want more insight to see how he was able to find and construct it.