Explicitly approximating $\sqrt{2}$ with rationals from left and from right After it is shown in a book "Principles of mathematical analysis - W. Rudin" that $\sqrt{2}$ is not rational number then it is shown that if $A$ is set of all positive rationals $r$ such that $r^2<2$ and if $B$ is set of all positive rationals $r$ such that $r^2>2$ then $A$ does not contain the largest and $B$ does not contain the smallest element.
That is done by defining for positive rational $r$ the number $s=r- \dfrac{r^2-2}{r+2}$.
Then it is shown that $s^2-2=\dfrac{2(r^2-2)}{(r+2)^2}$ so if $r$ is in $A$ then $s>r$ and $s$ is in $A$ and if $r$ is in $B$ then $s<r$ and $s$ is in $B$.
Is algebraic expression $\dfrac{r^2-2}{r+2}$ somehow special in this context or even some other algebraic expressions can be subtracted from $r$ "to satisfy the needs" of this construction?
 A: Another method is based on Heron's approximation algorithm: 
For small $h$, we have $f(x+h)\approx f(x)+hf'(x)$, so picking $h=-\frac{f(x)}{f'(x)}$ is a promising choice to make $f(x+h)$ small. 
Here, we can consider $f(x)=x^2-2$, so that $f'(x)=2x$. This gives us the recursion
$$x_{n+1}=x_n-\frac{x_n^2-2}{2x_n}=\frac {x_n}2+\frac 1{x_n}.$$
Note that this makes
$$x_{n+1}^2-2=\frac 14x_n^2+1+\frac1{x_n^2}-2=\left(\frac{x_n}2-\frac1{x_n}\right)^2, $$
i.e., we will always (except perhaps for $x_1$) have an over-estimate - but we can always obtain $\frac 2{x_n}$ as an under-estimate from it.
A: For a given $r$, we want $s$ such that $s>r$ if $r^2<2$ and $s<r$ if $r^2>2$. It's natural to pick $s=r-\lambda (r^2-2)$, for some $\lambda>0$ to be determined.
We also want $r$ and $s$ to be both in $A$ or both in $B$, so $\lambda$ must not be too large. Let's compute $s^2-2$:
$$s^2-2=r^2+\lambda^2(r^2-2)^2-2\lambda r(r^2-2)-2=(r^2-2)\left[\lambda^2(r^2-2)-2\lambda r+1\right]$$
So $\lambda^2(r^2-2)-2\lambda r+1$ must be positive. Its discriminant is $8$, so the trinomial (in $\lambda$) has two roots. 
If $r^2-2>0$, then both roots are positive as long as $r>0$. So $\lambda$ must be less that the smallest root, which is $\frac{1}{r+\sqrt2}$ (because the trinomial is positive outside of the interval between the roots). That is, we must have:
$$0\lt\lambda\lt\frac{1}{r+\sqrt2}$$
If $r^2-2<0$, there is one positive and one negative root, and the positive root is again $\frac{1}{r+\sqrt2}$, so we must have the same inequality (the trinomial is now positive for $\lambda$ between the roots).
Furthermore, the larger the value of $\lambda$ the better, as we get as far as possible from $r$, thus as close as possible to $\sqrt2$.
Any such value of $\lambda$ will do. Since $2$ is the simplest upper bound for $\sqrt2$, it seems $\dfrac{1}{r+2}$ is the simplest value of $\lambda$. You could also pick $\lambda=\dfrac{1}{r+3/2}$, for instance.
A: The OP asks

Is algebraic expression $\dfrac{r^2-2}{r+2}$ somehow special in this context or even some other algebraic expressions can be subtracted from $r$ "to satisfy the needs" of this construction?

Ans: Subtracting $(r^2 - 2)/(r + k)$ also satisfies the "needs" when $k^2 \gt 2$.
Furthermore, we can apply the algebraic algorithm , say twice (composition), and get results that 'move faster' towards the square root of $2$; this would work equally well in Rudin's argument,
$\quad s = r -  2(\frac{r^2-2}{2 r + 3})$
For a discussion, see the next section.

If $k \ne \pm \sqrt 2$ consider the function
$\tag 1 F(x) = \frac{2+kx}{k+x}$
The function $F$ satisfies
$\tag 2 F(\sqrt 2) = \sqrt 2 \text{ and } F(-\sqrt 2) = -\sqrt 2$
So these are fixed points of the function $F$. It is likely that Rudin was aware of the theory surrounding these functions; they are linear fractional transformations of a specific form. Functions of the form $F(x)$ can be used to construct sequences of rational numbers converging to $\sqrt 2$.
Also $F(x) = x - (x^2 - 2)/(k + x)$.
Rudin selected $k = 2$ which satisfies $k \gt \sqrt 2$. Moreover, theory tells us that Rudin could have selected $k$ to be any rational number such that $k^2 \gt 2$ and everything would work the same. In fact, with such a $k$ suppose we have positive rational numbers $p$ and $q$ such that $p^2 \lt 2 \lt q^2$. Then
$\tag 3 \displaystyle{\bigcap_{n \ge 0}\, \big [F^n(p), F^n(q)\big] = \sqrt 2}$
with the nested closed intervals all containing $\sqrt 2$.
Interestingly, things work out differently (sequence alternating but still converging) when $k^2 \lt 2$.
For example, let $k = \frac{1}{2}$. Then
$\tag 4 \text{If } r = \frac{11}{10} \text{ then } r \lt \sqrt 2 \text{ and } F(r) = \frac{51}{32} \gt \sqrt 2$
$\tag 5 \text{If } r = \frac{51}{32} \text{ then } r \gt \sqrt 2 \text{ and } F(r) = \frac{179}{134} \lt \sqrt 2$
