# prove that derivative exists or doesn't exist

I am solving couple of problems to an upcoming test and I have a question regarding the understanding of the derivative. consider the following function:

$$f\colon x\mapsto\begin{cases}x^2\sin\left(\dfrac{1}{x}\right) & x \neq 0\\0 & x = 0\end{cases}$$

We have to prove if the derivative exists at $0$. It's clear that the function is continuous because:

$$\lim_{x \rightarrow 0}x^2\sin\left(\frac{1}{x}\right) = 0\times\lim_{x \rightarrow 0}\sin\left(\frac{1}{x}\right)$$

and $$x\mapsto\sin\left(\frac{1}{x}\right)$$ is bounded

so: $$\lim_{x \rightarrow 0} x^2\sin\left(\frac{1}{x}\right)=0$$

but what about the derivative? its clear that: $$\lim_{x\to 0}\ f'(x)=\lim_{x \rightarrow 0}\Big(2x\sin\left(\frac{1}{x}\right)-\cos\left(\frac{1}{x}\right)\Big)$$

and in this case the limit doesn't exist which makes perfect sense.

But what if I try to find the derivative by definition?

We get: $$\lim_{h \rightarrow 0}\frac{(0+h)^2\sin\left(\dfrac{1}{0+h}\right)-0}{h} = \lim_{h \rightarrow 0}\frac{h^2\sin\left(\dfrac{1}{h}\right)}{h}=\lim_{h \rightarrow 0}h\sin\left(\dfrac{1}{h}\right)=0$$

How can it be? I am totally confused.

• For the definition of the derivative you must write $0+h$ instead of every $x$ in the term. – user302982 Aug 1 '17 at 8:27
• Technically, you're not allowed to write $\lim_{x \rightarrow 0}x^2sin(\frac{1}{x}) = 0*\lim_{x \rightarrow 0}sin(\frac{1}{x})$, since $\lim_{x \rightarrow 0}sin(\frac{1}{x})$ doesn't really exist. However, I know exactly what you mean to say when you write it, so let's call it abuse of notation and leave it at that. – Arthur Aug 1 '17 at 8:27
• Product rule only works if both factors are differentiable at 0. – user302982 Aug 1 '17 at 8:31
• OK so how can I prove that the derivative is not continues without using the product rule? – misha312 Aug 1 '17 at 9:03

This function is the example of a function which is differentiable everywhere, but where the derivative isn't continuous. What is happening here is that $f$ is squeezed between $x^2$ and $-x^2$, so at $0$ the derivative must exist and it must be $0$ (this is true of any function, no matter how ugly and discontinuous: If it is squeezed between $x^2$ and $-x^2$, or something similar, then it is differentiable at $0$ with derivative $0$). If you think of the derivative as the slope of a line that approximates the function, rather than some algebraic limit of a fraction, this is easier to grasp.

However, close to $0$, the function $f$ oscillates up and down ever faster. In fact, it's happening so fast that even though it's squeezed between two parabolas, it gets to be about $1$ steep each time. That means that the derivative goes up and down between (roughly) $\pm 1$ more and more as you get closer and closer to $0$. And that is why $\lim_{x\to 0}f'(x)$ doesn't exist.

• Ok first of all thanks I perfectly understand. but what about xsin(1/x) I know that this function doesn't has a derivative at 0, But isn't that function behaves the same as x^2sin(1/x). in this case the sin is bounded by two linear functions. – misha312 Aug 1 '17 at 8:41

There is no contradiction, it is possible for the derivative to exists but it need not continuous.

That is $f'(0)$ exists but $\lim_{x \to 0}f'(x) \neq f'(0)$

Edit:

• Thank you! but what about xsin(1/x) I know that this function doesn't has a derivative at 0, But isn't that function behaves the same as x^2sin(1/x) – misha312 Aug 1 '17 at 8:49
• Included a picture for both graph, due to another factor of $x$, things behave quite differently as we can see from the graphs. For $x \sin\left( \frac1x \right)$, we get a a term like $\lim \sin (1/h)$ which doesn't exist but for For $x^2 \sin\left( \frac1x \right)$, we get a a term like $\lim h\sin (1/h)=0$ – Siong Thye Goh Aug 1 '17 at 8:56
• thanks got it, by the way which software is that ? – misha312 Aug 1 '17 at 9:00
• desmos.com, quite a convenient tool, try it out. – Siong Thye Goh Aug 1 '17 at 9:01