# Functions which are continuous but the left-hand and right-hand derivatives do not exist

I'll state my question up-front, and then provide some motivation afterwards. Is there an example of a function that is

• Defined in a neighbourhood of a point $$a$$,
• Continuous at $$a$$,
• But neither the left-hand nor the right-hand derivative exists at $$a$$,

and that it is 'visually obvious' that the function has these properties (so pathological functions like the Weierstrass function are excluded). For the purposes of this question, I will define 'visually obvious' as meaning that it is possible to guess that the function has the above properties just by looking at its graph.

The function $$f(x)=|x|$$ is probably the simplest example of how a function can be continuous, and yet not differentiable, at a point:

It is clear just by looking at the graph that $$f$$ is continuous at $$0$$, but $$f'(0)$$ does not exist as $$f'_+(0)=1$$ and $$f'_-(0)=-1$$. However, what I find unsatisfying about this example is that $$f$$ is still fairly well-behaved around $$0$$—it is meaningful to ask about the 'rate of change' of the function, it's just that we get different answers when we zone in from the left-hand side compared to the right-hand side. I'm looking for a function where it is not meaningful to talk about the 'rate of change' at all, and yet the function is still continuous at the point in the question.

• What is semi-differentiability? I can't find an exact definition for it Jun 14 '21 at 16:18
• @Buraian: A function is semi-differentiable at a point if the left-hand derivative exists or the right-hand derivative exists. So $|x|$ is semi-differentiable at $0$, for example; $x^2$ is also semi-differentiable at $0$ (because it is differentiable at $0$). However, the function$$f(x)=\begin{cases} x\sin(1/x) &\text{if x\neq0} \\ 0 &\text{if x=0} \end{cases}$$ is not semi-differentiable at $0$.
– Joe
Jun 14 '21 at 16:45
• @AmitMittal: Yep, neither of the one-sided derivatives are allowed to exist. Sorry if that was not clear.
– Joe
Jun 14 '21 at 16:45
• @Buraian: Apparently the term semi-differentiable has been raised to "semi-standard terminology" by Wikipedia writers who don't have much of a background in these matters (evidenced to me by the inappropriate and scant reference list there). Note, for example, the term is used here (middle p. 770) for a semicontinuity analog of differentiability. The many decades-old standard terms are "unilateral derivative" and "one-sided derivative". Jun 14 '21 at 17:35
• For what it's worth, my comment wasn't intended as a criticism your usage, as I assume the term "semi-derivative" is being spread by the Wikipedia page, which has only three references --- one a lesser known calculus text, one a research paper having virtually no reference significance for the topic at hand, and Dirac's quantum mechanics book (?!?). While I'm here, you might find Klymchuk's Counterexamples in Calculus useful. Jun 14 '21 at 17:54

Consider the function $$x\sin(1/x)$$, continuously extended at $$0$$. The left and right derivatives at $$0$$ don't exist as $$\sin(1/h)$$ keeps oscillating between $$-1$$ and $$1$$ as $$h\to 0$$:

• @Joe Thank you for your edit. Jun 15 '21 at 1:46

You don’t seem to have understood my comment so let me try an answer. The weierstrass function, $$|x|^s$$, $$x\sin1/x$$, these functions are all continuous on a neighbourhood of 0. But your question is asking for functions continuous only at one point. So you can consider the function $$f:\mathbb R\to\mathbb R$$,

$$f(x)=\begin{cases} x &x\in \mathbb Q\\ -x &x\not\in \Bbb Q\end{cases}$$ Note that the function is everywhere defined on $$\mathbb R$$. Its graph is X shaped, consisting of the two lines $$y=\pm x$$ (what you can’t ‘draw’ is that there are infinitely many holes in any interval.) Clearly there are two candidates for the (left or right) gradient at $$0$$; since the (left or right) gradient must be unique, it’s not (left or right) differentiable at $$0$$. But it is continuous at $$0$$. It’s not continuous anywhere else (and therefore, not differentiable anywhere else.)

• I understand what you are saying now. Thanks for this answer.
– Joe
Jun 15 '21 at 17:57

Another fairly standard example is $$f(x) = x^{2/3}$$, which (like the absolute value function) has a cusp at $$x = 0$$, but which (unlike the absolute value function) has neither a left-handed nor a right-handed derivative, because the graph of $$y=f'(x)$$ has a vertical asymptote at $$x = 0$$.

• My favourite version of this is $|x|^{s-1}x$ whose graph is a differentiable curve but the graph coordinates break down in the manner you described Jun 15 '21 at 0:41