If $f:[a,b]\to \mathbb{R}$ satisfies $|f'(x)|<1, \forall x\in [a,b]$, is $f$ necessarily a contraction?

If $f:[a,b]\to \mathbb{R}$, $f'(x)$ exists for all $x\in [a,b]$ (derivatives at endpoints $a,b$ are one-sided) and satisfies $|f'(x)|<1, \forall x\in [a,b]$, is $f$ necessarily a contraction (i.e. $|f(x)-f(y)|\leq c|x-y|$, for some $0<c<1$)?

I've tried to prove it by contradiction. Define $E=\left\{\dfrac{|f(x)-f(y)|}{|x-y|}: x\neq y\in [a,b]\right\}\neq \emptyset$. By mean value theorem, $|f(x)-f(y)|<|x-y|,\forall x\neq y\in [a,b]$. Therefore, $E$ has an upper bound $1$, hence the least upper bound $s=\sup E\leq 1$. Suppose that $s=1$, take $\epsilon_n=\dfrac{1}{n}$, we can find $a_n=\dfrac{|f(x_n)-f(y_n)|}{|x_n-y_n|}\in E$ such that $1-\dfrac{1}{n}<a_n<1$, thus a sequence $\{a_n\}$ with limit $1$.

For the two sequences $\{x_n\},\{y_n\}$, with $x_n<y_n$. According to Bolzano-Weierstrass Theorem, there exist subsequences $\{x_{n_k}\},\{y_{n_k}\}$ converging to $x_0,y_0$,respectively. If $x_0\neq y_0$,then since $a_{n_k}$ converges to $1$, we can obtain $\dfrac{|f(x_0)-f(y_0)|}{|x_0-y_0|}=1$, which is a contradiction.

The proof gets stuck at the case $x_0=y_0$. Since the following proposition may fail to hold if $x_n<x_0=y_0<y_n$ doesn't hold.

If $x_n<x_0<y_n$, both $\{x_n\},\{y_n\}$ converge to $x_0$ and $f'(x_0)$ exists, then $\lim\limits_{n\to\infty}\dfrac{f(x_n)-f(y_n)}{x_n-y_n}=f'(x_0)$.

And now I don't know whether the original proposition holds. If we add the condition that the derivative $f'$ is continuous on $[a,b]$, then by the maximum value theorem, $f$ is surely a contraction. So, if there is any counterexample, then $f'$ must be discontinuous.

Since some text requires a contraction maps a space into itself, how about adding this as a condition, i.e. consider $f:[a,b]\to [a,b]$?


A try for a counter-example.

Put for $x\in ]0,1]$ $$f(x)=\int_{1/x}^{+\infty}\frac{\sin(u)}{1+u^2}du$$

and of course $f(0)=0$.

1) We integrate by parts: $$f(x)=\frac{x^2}{1+x^2}\cos(\frac{1}{x})-\int_{1/x}^{+\infty}\frac{2u\cos(u)}{(1+u^2)^2}du$$

We have $\displaystyle |\frac{x^2}{1+x^2}\cos(\frac{1}{x})|\leq \frac{x^2}{1+x^2}$, and: $$|\int_{1/x}^{+\infty}\frac{2u\cos(u)}{(1+u^2)^2}du|\leq \int_{1/x}^{+\infty}\frac{2u}{(1+u^2)^2}du=\frac{x^2}{1+x^2}$$

We have hence $|f(x)|\leq 2x^2$. This imply that $f$ has a derivative at $x=0$, and $f^{\prime}(0)=0$.

2) For $x\in ]0,1]$, $f$ is derivable and $$f^{\prime}(x)=(-\frac{1}{x^2}) (-\frac{\sin(1/x)}{1+(1/x)^2})=\frac{\sin(1/x)}{1+x^2}$$ Now we get that $\displaystyle |f^{\prime}(x)|\leq \frac{1}{1+x^2}<1$ if $x\in ]0,1]$, hence for all $x\in [0,1]$.

3) Let $\displaystyle x_n=\frac{1}{\pi/2+2n\pi}$. We have $\displaystyle f^{\prime}(x_n)=\frac{1}{1+x_n^2}$, and hence $f^{\prime}(x_n)\to 1$ as $n\to +\infty$.

4) Hence there cannot exists $c<1$ such that $|f^{\prime}(x)|\leq c$ for all $x$.


Counterexample: Let $a_n = 1/n, n = 1,2, \dots.$ For each $n$ let $g$ be an isosceles triangular spike over $a_n$ of base length $b_n < 1/2^n$ and height $h_n = 1-1/n.$ This can be done so that the bases are disjoint. Define $g = 0$ everywhere else. Then $g$ is continuous and bounded on $(0,1],$ hence $g$ is Riemann integrable on $[0,1].$ Define

$$f(x) = \int_0^x g(t)\,dt, \,x \in [0,1].$$

We have $f'(x) = g(x)$ on $(0,1]$ by the FTC. Hence $0\le f'(x)< 1$ for all such $x.$ Because $f'(a_n) = g(a_n) = 1-1/n \to 1,$ the definition of the derivative shows $f$ cannot be a contraction on $[0,1].$

We haven't dealt with $f'(0)$ yet. Claim: $ f'(0) = 0.$ To prove this, let $x\in [a_{n+1},a_n].$ Then

$$\tag 1 \frac {f(x) - f(0)}{x} = \frac{1}{x} \int_0^x g \le \frac{1}{a_{n+1}}\int_0^{a_n} g \le (n+1)\sum_{k=n}^{\infty} 2^{-k} = (n+1)\cdot 2^{1-n}.$$

As $x\to 0^+, n \to \infty,$ and the right side of $(1) \to 0,$ giving the claim.