3

Consider $$f(x)=\begin{cases}1\text{ if }x\gt 0\\ 0 \text{ if }x\le 0.\end{cases}$$ Then the left-hand derivative of $f$ at $x=0$ is equal to $0$, and the right-hand derivative of $f$ at $x=0$ is equal to $0$ as well. Since both left-hand and right-hand derivatives at $x=0$ exist and are equal, it must be true that $$f'(0)=0.$$

But $f$ is not continuous at $x=0$.

This seems to be contradicting the fact that "differentiable implies continuous". Where is the error?

Nomas
  • 417
  • 11
    The right hand derivative is not $0.$ – Thomas Andrews Mar 14 '22 at 23:44
  • 6
    The function is not differentiable at zero. The fact that $\lim_{x\to 0^+} f'(x) = \lim_{x\to 0^-} f'(x) = 0$ does not imply that $f'(x) =0 $. You need to look at the actual definition of the derivative. – Xander Henderson Mar 14 '22 at 23:44
  • 7
    The right hand derivative is $$\lim_{h\to0^+}\frac{f(h)-f(0)}{h}=\lim_{h\to0^+}\frac{1-0}{h},$$ which doesn’t converge. What you’ve noticed is that $\lim_{h\to0^+} f’(h)=0,$ but that is a different limit – Thomas Andrews Mar 14 '22 at 23:47

1 Answers1

6

As others have mentioned here, you're computing the limits of derivatives from the left of $0$, and limits of derivatives from the right of $0$. This is a different concept than the left-derivative of $f$ at $0$ and the right-derivative of $f$ at $0$.

Therefore, your function doesn't contradict the statement that differentiability at a point implies continuity at that point (and of course, there are no such functions, because "differentiable $\implies$ continuous" is a true statement).


As a fun related theorem, we have the following (the proof uses the mean-value theorem):

Suppose $f:I\to\Bbb{R}$ is a function defined on some (say open) interval $I$, and $a\in I$ a point such that:

  • $f$ is continuous at $a$
  • $f$ is differentiable at all points of $I$, except perhaps at $a$
  • $\lim\limits_{x\to a}f'(x)$ exists

Then, $f$ is differentiable at the point $a$, and $f'(a)=\lim\limits_{x\to a}f'(x)$.

The function $f$ you concocted satisfies the second and third bullet points, but not the first, which just goes to show the importance of continuity at the point in question.

As an example of the utility of this theorem, consider the function $f:\Bbb{R}\to\Bbb{R}$ defined as \begin{align} f(x)&:= \begin{cases} x^2&\text{if $x\geq 0$}\\ 0& \text{if $x<0$} \end{cases} \end{align} Then, $f$ is continuous at the origin, $f$ is differentiable away from the origin, and we have \begin{align} f'(x)&= \begin{cases} 2x&\text{if $x>0$}\\ 0&\text{if $x<0$} \end{cases} \end{align} So, $\lim\limits_{x\to 0^+}f'(x)=\lim\limits_{x\to 0^+}2x=0$ and $\lim\limits_{x\to 0^-}f'(x)=\lim\limits_{x\to 0^-}0=0$, so $\lim\limits_{x\to 0}f'(x)$ exists and equals $0$. So, all three hypotheses of the theorem are satisfied and we can now conclude that $f$ is differentiable at the origin, and $f'(0)=\lim\limits_{x\to 0}f'(x)=0$.

Of course, in this special case, you can also verify directly that for $h\neq 0$, we have $\frac{f(0+h)-f(0)}{h}\to 0$ as $h\to 0$, so that directly from the definition we have $f$ differentiable at the origin with $f'(0)=0$.

peek-a-boo
  • 65,833