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.
 A: Let $p\in B.$ I'll change the definition of $k$ slightly to $k=\dfrac{2-p^2}{2p}.$ (So $k<0,$ hence $p+k<p.$) Because $k^2>0,$ we can say
$$(p+k)^2 = p^2 +2pk +k^2 > p^2 +2pk$$ $$ =p^2 +2p\frac{2-p^2}{2p} = p^2 +2-p^2 =2.$$
We're done.
A: 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}$.
A: Rudin presented the following equation which represents an approximation of $\sqrt{2}$ :
$$
q = p - \frac{p^{2} - 2}{p + 2} = \frac{2p+2}{p+2}
\tag3$$
The equation presented in the book with no explanation from where it came from will be explained here. There are a number of ways to derive equation I chose to derive it geometrically using what is known as the secant method
This method involves drawing a secant into the curve of the function $f(p)=p^{2}-2$ this will result in formation of three important points, two points formed by the intersection of secant and the curve will be projected at $x-axis$ and will be denoted as $S_{n-1}$ and $S_{n}$ and a third point which is formed from the intersection of the secant line with $x-axis$ will be denoted as $S_{n+1}$. A recursive relation is established and is given by :
\begin{equation*}
S_{n+1}=\frac{S_{n-1}f(S_{n}) - S_{n}f(S_{n-1})}{f(S_{n})-f(S_{n-1})}
\end{equation*}
We will denote $S_{n-1} = t$ , $S_{n} = p$ , $S_{n+1} = q$ then our equation becomes :
\begin{equation*}
q=\frac{t(p^{2}-2)-p(t^{2} - 2)}{p^{2}-2-(t^{2}-2)} = \frac{(p-t)(pt+2)}{p^{2}-t^{2}} = \frac{pt+2}{p+t}
\end{equation*}
from the expression $q= \frac{pt+2}{p+t}$ we want to study when $q$ is more accurate than $p$ and when $p$ is more accurate than $q$ and thus we would conclude to which set they would belong in these two cases. So we would want to study the sign of $q-p$ whether its positive or negative. Thus we have that :
\begin{equation*}
q-p= \frac{pt+2}{p+t} - p = \frac{pt+2-p^{2}-pt}{p+t} = \frac{2-p^{2}}{p+t} 
\end{equation*}
\begin{equation*}
\therefore q-p=-\frac{p^{2}-2}{p+t}
\end{equation*}
Now notice how the numerator is independent of $t$ yet the denominator is so whatever positive value of $t$ you choose it will not affect the comparison between $p$ and $q$ because what we really wanna look at is when $p^{2}-2 <0$ which is case of set A and when $p^{2} - 2>0$ which is case of set B. So had the author used the Secant Method to derive his expression, he would have picked the easiest number he could think of  $t=2$ in order to obtain the required equation $(3)$.
