<s>[INST] To derive quantity $k=\frac{2-p^2}{p+2}$ for positive rational $p$ such that $p^2>2$ and $(p+k)^2>2$ I am reading Baby Rudin and stuck at one small point.
$A$ is set of all positive rationals $p$ such that $p^2<2$ and $B$ is set of all positive rationals $p$ such that $p^2>2$. We wanted to show $A$ contains no largest element and $B$ contains no smallest element. So for any such $p$ in either set, author associated number $q$ as,
$q=p-\frac{p^2-2}{p+2}$, which works fine.
I was trying to figure out how to obtain the quantity $\frac{p^2-2}{p+2}$.
I did it for set $A$ as follows.
So, we have positive rational $p$ such that $p^2<2$. We want some $k>0$ such that $(p+k)^2 <2$
i.e. $p^2+2pk+k^2<2$
As all three quantities are positive, we can say
$p^2+2pk<2$, which gives
$k<\frac{2-p^2}{2p}$.
But as $p^2<2$, we have $p<2 \Rightarrow p+p=2p<p+2$
Therefore, we can choose $k=\frac{2-p^2}{p+2}$.
But I am stuck while deriving it for set $B$.
I did following.
So, we have positive rational $p$ such that $p^2>2$. We want some $k<0$ such that $(p+k)^2 >2$
i.e. $p^2+2pk+k^2>2$.
From this point, I can say $p^2+k^2>2$, but not sure how this will take me to the desired result.
Any hint or help. Thank you.
 [/INST] We get $$(p+k)^2 >2\implies p+k\gt\sqrt 2\implies k\gt \sqrt 2-p$$
Multiplying $\sqrt 2-p$ by $\dfrac{\sqrt 2+p}{\sqrt 2+p}\ (=1)$ gives $\dfrac{2-p^2}{\sqrt 2+p}$, and so we have
$$k\gt \dfrac{2-p^2}{\sqrt 2+p}$$
It follows from $2\gt \sqrt 2$ and $2-p^2\lt 0$ that $\dfrac{2-p^2}{2+p}\gt\dfrac{2-p^2}{\sqrt 2+p}$.
Therefore, we can choose $k=\dfrac{2-p^2}{2+p}$.
</s>