# Is $1-\sin(x)$ a contraction mapping? And is there a sufficient/necessary condition for a real-valued function to be a contraction?

This came up as I was thinking about how to solve an assignment problem I've been given. I'm not posting the assignment problem here as I want to think about it myself, but one approach I am currently working on is to try to show that $$f:\mathbb{R}\to\mathbb{R},\quad f(x) = 1-\sin(x)$$ is a contraction mapping.

At the moment I have a feeling it isn't. For example take $x_1 < 0 < x_2$, then $$\left|\frac{(1-\sin x_1)-(1-\sin x_2)}{x_1-x_2}\right| = \left|\frac{\sin(x_1) - \sin(x_2)}{x_1-x_2}\right| \to 1$$ as $x_1 \to 0^-, x_2 \to 0^+$.

Hence there does not exist a non-negative $k<1 \in \mathbb{R}$ such that $|\sin(x_1)-\sin(x_2)| \leq k|x_1-x_2|$ for all $x_1,x_2 \in \mathbb{R}$. (Just take $x_1,x_2$ arbitrarily close to $0$.) So $f$ is not a contraction mapping.

That was the idea. Thinking just a little bit further, we see that this occurs because $|f'(x)| = 1$ at $x=0$. So perhaps we have a necessary and sufficient condition for a function on the reals to be a contraction mapping, namely that $\forall x\in\mathbb{R},|f'(x)|\leq k<1$ for some non-negative real $k$. Is this the case? Or have I missed some subtle (or not-so-subtle) point?

-
from where to where. Note that a mapping $T$ is a contraction if $d(T(x),T(y))< \alpha \cdot d(x,y)$ for some $\alpha \in (0,1)$. –  user9413 Aug 31 '11 at 9:49
Sorry, I accidentally posted before I finished typing the question up. Will update shortly. –  Josh Chen Aug 31 '11 at 9:50
I believe this to be one of my more rambling posts; I apologize. –  Josh Chen Aug 31 '11 at 10:25
No need to apologize and you're exactly right. For the last part, you can simply apply the mean value theorem in one direction and estimate the absolute value of the derivative in the other direction. Of course, you need to assume the function to be differentiable everywhere. Think e.g. of $x \mapsto |x|/2$ which certainly is a contraction but isn't differentiable at zero. –  t.b. Aug 31 '11 at 10:32
There is a clear relation between the contraction rate $k$ of the mapping $f:A\to A$ for $A\subseteq \mathbb R$ and the best Lipschitz constant for the function $f$ on $A$. The last constant can be found through the absolute value of $f'$ if $f\in C^1(A)$ as Theo has already written. –  Ilya Aug 31 '11 at 13:30

That's the case if $f$ is differentiable on all of $\mathbb{R}$, then by Lagrange's theorem (mean value theorem) $$|f(x)-f(y)|=|f'(c_{x,y})||x-y|$$ for some $c_{x,y}$ between $x$ and $y$, for all $x,y\in\mathbb{R}$. From here, sufficiency is clear since if $|f'(x)|\leq K$ then $$|f(x)-f(y)|=|f'(c_{x,y})||x-y|\leq K|x-y|$$ Now, for necessity we only need to use the definition of the derivative: if $f$ is contracting with constant $K<1$, given $x\in \mathbb{R}$ then $$|f'(x)|=\lim_{h\to 0} \left|\frac{f(x+h)-f(x)}{h}\right|\leq\lim_{h\to 0} \frac{K\cdot|x+h-x|}{|h|}=K$$ using that the absolute value is continuous and that limits preserve inequalities. q.e.d.