# Does the existence of the derivative at a point imply the existence of the left and right derivative?

I'm asking this because I've seen "results" in the internet that state:

A function $f$ is differentiable at $x = a$ if and only if both the right-hand derivative and left-hand derivative at $x = a$ exist and both of these derivatives are equal.

And the counter implication appears in passing in my notes:

If a function $f$ is differentiable at $x = a$ then both the right-hand derivative and left-hand derivative at $x = a$ exist and both of these derivatives are equal.

However, the function $x^2 \sin \frac{1}{x}$ is differentiable in $\mathbb{R}$ even thought the lateral derivatives don't exist at $0$. This example appears in my notes, which is distressing because (unless I'm committing a logical fallacy) then it's not true that the existence of the derivative at a point imply the existence of the left and right derivative at that point (which would not be consistent with the previous statement).

• How did you get that the "lateral derivatives" (as you put it) don't exist at $0$ for $x^2\sin{\frac{1}{x}}$? – Joey Zou Nov 28 '15 at 22:34
• The function you describe is not even defined at zero, it certainly is not differentiable there. – I. Cavey Nov 28 '15 at 22:35
• Your second sentence is a true theorem. What maybe confuses you is that the function $x^2 \sin \frac{1}{x}$ (defined to be $0$ at $x = 0$) is differentiable for all $x \in \mathbb{R}$ but the derivative is not continuous at $x = 0$. The left and right hand limits of the derivative do not exist, but this is not the same as the left-hand and right-hand derivative. – levap Nov 28 '15 at 22:37

As indicated by @levap in the comments, you are likely confusing the (right-hand side, RHS) derivative at $0$ with the (RHS) limit of the derivative. I will just add details to clarify. Assuming you mean $f(0)=0$.

The derivative at $0$ is by definition
$\displaystyle\lim\limits_{h\to0}\frac{f(0+h)-f(0)}h = \lim\limits_{h\to0}\frac{h^2\sin(\frac1h)-0}h = \lim\limits_{h\to0}h\sin(\frac1h)=0$.

Similarly the RHS derivative at $0$ is $\displaystyle\lim\limits_{h\to0^+}\frac{f(0+h)-f(0)}h = \lim\limits_{h\to0^+}\frac{h^2\sin(\frac1h)-0}h = \lim\limits_{h\to0^+}h\sin(\frac1h)=0$,

and the LHS derivative at $0$ is
$\displaystyle\lim\limits_{h\to0^-}\frac{f(0+h)-f(0)}h = \lim\limits_{h\to0^-}\frac{h^2\sin(\frac1h)-0}h = \lim\limits_{h\to0^-}h\sin(\frac1h)=0$.

On the other hand when $x\not=0$ we could use differentiation formulas (apart from the limit definition of the derivative, which we could also use but it would be unnecessary), to obtain that

$f'(x)=2x\sin(\frac1x)-\cos(\frac1x)$, $x\not=0$.

Now, it is true that the limits $\lim\limits_{x\to0}f'(x)$, as well as $\lim\limits_{x\to0^+}f'(x)$ and $\lim\limits_{x\to0^-}f'(x)$ do not exist, that is the derivative $f'(x)$ has no limit (no RHS limit, no LHS limit) as $x\to0$, but this is a different matter than the derivative (the RHS derivative, the LHS derivative) of $f$ at $0$. The latter, as we saw earlier, exists and equals to $0$.

To illustrate, I enclose a couple of graphs (different zoom). $f(x)$ is shown in black, squeezed in between grey $x^2$ an $-x^2$. It should be clear from the picture that the tangent line at $0$ exists and has slope $0$. On the other hand in every neighborhoos of $0$ the slope of $f$ varies between $\approx\pm1$. That is, the dirivative $f'(x)$, shown in red, varies between $\approx\pm1$ (when $x$ is close to $0$ but different from $0$), and hence the limit of the derivative does not exist, as $x\to0$. Zoom in • Yeah, I was assuming that the RHS derivative with the RHS limit of the derivative. Which is true if the RHS limit of the derivative exists, right? – Gonate Nov 29 '15 at 7:57
• I didn't think the latter would be right and searched MSE with terms: first derivative discontinuous at a point . Got several results including one answer essentially taking the antiderivative of the function you consider and obtaining a function everywhere ... well need to think but will leave this for later, this particular link is math.stackexchange.com/questions/352449/… – Mirko Nov 29 '15 at 13:00