# Does every continuous function have a left and right derivative?

I understand that differentiability implies continuity, whereas the converse isn't true. But must a continuous function have both a left and right derivative, not necessarily equal to one another?

• $f(x) = x \sin(1/x),$ with $f(0)$ defined to be $0,$ is continuous and has neither a left nor a right derivative at $x=0.$ – Dave L. Renfro Feb 21 '14 at 22:12
• There is a nice graph of the function I gave in the StackExchange question Calculating Dini derivatives (which I found by doing a google image search for "right derivative" AND "sin(1/x)". – Dave L. Renfro Feb 21 '14 at 22:28

For $f(x)=x \sin{\frac{1}{x}}$, $f(0)=0$ (Just like Dave commented) you have: $$\frac{f(0 + \Delta x) - f(0)}{ \Delta x} = \frac{(0 + \Delta x) \sin (\frac{1}{0 +\Delta x}) - 0}{\Delta x} = \sin (\frac{1}{\Delta x})$$ As $\Delta x$ approaches $0$ from the left/right you will just get $- \sin(x)$ / $\sin(x)$ as $x$ tends to $\infty$, i.e, no limit.

But, let $\epsilon > 0$ and $\delta = \epsilon$: $$|x|=|x-0| < \delta \implies |x \sin (\frac{1}{x}) - 0| = |x \sin (\frac{1}{x})| \leq |x| < \delta = \epsilon$$ Hence $f$ is continous at $0$.

• This does not address the OP's question at all. – Mark Viola Mar 29 at 22:17

The famous Weierstrass function, which is continuous but nowhere differentiable, fails everywhere to have left- and right-derivatives, as well. This takes a bit of work to check.

• I wouldn't have believed it was possible at the time – user10389 Feb 22 '14 at 13:42

If $f$ has a left and right derivative at every point, then it certainly has finite Dini derivatives at every point, and then it follows immediately from the Denjoy-Young-Saks Theorem that $f$ is differentiable away from a set of measure $0$. But as pointed out in Ted Shifrin's answer, there are certainly continuous functions which are nowhere differentiable, e.g. Weierstrass's function.

[Or in other words: it is relatively common to describe Weierstrass-like nowhere differentiable functions as "having corners at every point". The above paragraph shows that this is very loose language: taken literally, there are no such functions!]

Thus the Weierstrass function is continuous everywhere and certainly has left and right hand derivatives only at a set of measure zero. This checks a weak form of Ted's answer, but enough to use the Weierstrass function to answer the OP's question...lazily.

Really though this answer is almost a joke: I believe I am applying too big a theorem to deduce too small a result. When I first read the question I was tempted to say that a function which has (finite!) left and right hand derivatives at every point must be differentiable on the complement of a countable set, just like a function which has left and right hand limits at every point must be continuous except at countably many points. Is that actually true? (Added: Hmm, I think I've changed my guess; I now doubt that's true. But I'd still like to know.)