Let $f(x):\mathbb{R}\to[0,1]$ be Lipschitz continuous, differentiable everywhere except for $x=0$ and such that $f(0)=0$. My question is whether or not the "left" derivative $\lim_{x\uparrow 0} \frac{f(x)}{x}$ and the "right" derivative $\lim_{x\downarrow 0} \frac{f(x)}{x}$ always exist.
3 Answers
Consider $f(x) = x \sin(-\log(x))$ for $x > 0$ and $f(x) = 0$ for $x \leq 0$. Then, clearly, $f$ is smooth on $\mathbb{R} \setminus \{0\}$, but $\frac{f(h)}{h} = \sin(-\log(h))$ does not converge: Consider $h_n := e^{-(n+1/2)\pi}$, then $$ \sin(-\log(h)) = \sin((n+1/2)\pi) = \begin{cases}1, & \text{for $n$ even,} \\ -1, & \text{else.}\end{cases} $$
For Lipschitz-continuity, consider the derivative $f'(x) = \sin(-\log(x)) - \cos(-\log(x))$ which is clearly bounded by $2$.

- 515
I cannot claim credit for the counterexample I am about to present, as the function was thought of by Mark Roelands, who is not an active MSE user, but was also intrigued by this problem when I told him about it, and he came up with the following example.
For each $k\in \mathbb N$ define $f_k:(0,1]\to \mathbb R$ by $$f_k(x)=\begin{cases}2^{k+1}(x^2-3\cdot2^{-(k+1)}x+2^{-(2k+1)}) & \text{if} ~k~ \text{even} \\ -2^{k+1}(x^2-3\cdot2^{-(k+1)}x+2^{-(2k+1)}) & \text{if} ~k~ \text{odd} \end{cases}.$$ Using these we can define $f:[0,1]\to \mathbb R$ by $$f(x)=\begin{cases}f_k(x) & \text{if} ~x\in(2^{-(k+1)},2^{-k}] \\ 0 & \text{if} ~x=0 \end{cases}.$$ Now for any $x\in (0,1)$ we have that \begin{align*} |f(x)| & =|2^{k+1}(x^2-3\cdot2^{-(k+1)}x+2^{-(2k+1)})| \\ & \leq 2^{k+1}x^2+3x+2^{-k} \\ & \leq 2^{k+1}2^{-2k}+3\cdot2^{-k}+2^{-k}\\ &=2^{-(k+1)}(2^2+6+2) \\ & \leq 12x. \end{align*} Hence $f(x)\to 0$ as $x\to 0$, meaning that $f$ is right continuous at the origin. Now obviously $f$ is differentiable at $x\in (2^{-(k+1)},2^{-k})$ for any $k$, so we just need to check that it is differentiable at $x=2^{-k}$ for any $k\in \mathbb N$. This is actually fairly easy to do, if we evaluate $\lim_{x\to 2^{-k+}}f'(x)$ and $\lim_{x\to 2^{-k-}}f'(x)$ we see that both equal $-1$, so $f$ will be differentiable at $2^{-k}$ as long as it is continuous there. It is a fairly simple matter to check that the limit from the left and limit from the right as $x\to 2^{-k}$ of $f(x)$ is equal, and in fact equal to $0$.
We now need to demonstrate that $f$ is Lipschitz. First note that for any $x\in(0,1)$ \begin{align*} |f'(x)|&=|2^{k+1}(2x-3\cdot2^{-(k+1)})|\\ &\leq 2^{k+1}2^{-k+1}+3 \\ & =7. \end{align*}
Now we need the fact that $f$ is differentiable on $(0,1)$ and continuous on $[0,1]$. For any $x<y$ in $[0,1]$ the mean value theorem guarantees the existence of a $c\in (x,y)$ such that $$\frac{|f(y)-f(x)|}{|y-x|}=|f'(c)|\leq7,$$ showing that $f$ is indeed Lipschitz. For $f$ to be right differentiable we require that $$\lim_{x\to 0^+}\frac{f(x)}{x}$$ exists. The sequence $(2^{-k})$ tends to $0$ as $k\to \infty$, but for each $k\in \mathbb N$ we have $f(2^{-k})=0$, so $$\lim_{k\to \infty}\frac{f(2^{-k})}{2^{-k}}=0.$$ Now the sequence $(3\cdot2^{-k-1})$ also tends to $0$, but for each $k$ we have that $f(3\cdot2^{-k-1})=2^{-k-1}\cdot2^{-1}$. Hence $$\lim_{k\to \infty}\frac{f(3\cdot2^{-k-1})}{3\cdot2^{-k-1}}=\frac{1}{6}.$$
Thus $\lim_{x\to 0^+}\frac{f(x)}{x}$ does not exist, and $f$ is not right differentiable at $0$. We can extend $f$ in a trivial manner (i.e setting it equal to $0$ on the negative line, and some bump function on $(1,\infty)$ with derivative at $1$ equal to the left derivative of $f$ at $1$) and scale it by some constant (in fact I think you can get a better bound on $f$ than the $12x$ I got, so that it might map into $[0,1]$ anyway, but that is neither here nor there) to get a function satisfying exactly your requirements that isn't right differentiable at $0$.

- 6,561
- 1
- 17
- 40
-
Just for reference, I added an alternative answer. That doesn't mean yours is wrong, of course :) – thomas Jan 31 '18 at 14:54
Formal proofs with prescribed functions are given in other answers. I will contribute by describing an easy procedure to obtain a counterexample:
We will define the function to be $0$ at $x=1$. Start drawing the graph of the function at $(1,0)$ going towards the direction $(-1,1)$ until you hit the graph of $y= x/2$. Then start drawing the graph on the direction $(-1,-1)$ until you hit the $x$-axis. Then start going towards the direction $(-1,1)$ again, repeating the above.
Observe that this defines a well-defined function on positive numbers whose graph looks like a saw. Extend to negatives by making this an even function and define $f(0) = 0$. Observe that the function is Lipschitz continuous on $[-1,1]$ (can be extended to all real numbers trivially) but it fails to have one sided derivatives at $x=0$ since it hits the lines $y=0$ and $y=x/2$ infinitely many times around $0$.

- 121