# Showing that $\left|x-1+\frac 1{1+x}-\left(y-1+\frac 1{1+y}\right)\right|\leq 2|x-y|$

I asked a question here the other day and one of the steps in the answer I encountered was: $$\left|x-1+\frac 1{1+x}-\left(y-1+\frac 1{1+y}\right)\right|\leq 2|x-y|$$

when $x,y\ge0$

I can't seem to figure out why this is true.. Cans someone help me out?

Thanks :)

-

An alternative approach. Let $$f(x)=x-1+\frac{1}{x+1}\quad\text{so that}\quad f'(x)=1-\frac{1}{(x+1)^2}\,.$$ Then $0\le f'(x)<1$ for all $x\ge0$. If $x,y\ge0$, by the mean value theorem $$|f(x)-f(y)|=|f'(c)(x-y)|<|x-y|\,,$$ where $c$ is a point between $x$ and $y$.