# Continuity of differentiable function $x^2\sin(1/x)$

Assume this function has a value $0$ at $x=0$.

If the right hand derivative of a derivable function is equal to the right hand limit of the derivative function (same for the left), why aren't functions like the one above continuously differentiable?

For a function to be continuous, limits should be finite and equal to value at that particular point.

For this function derivative using first principle yields $0$.

The RHD, LHD is $0$, I think. So why isn't the derivative continuous?

For finding the RHD and LHD, I have seen answers resorting to using known derivatives. My question is: why don't we use the first principle itself? Why do we get different answers then?

The function, let's call it $f$, is indeed differentiable. For $x\ne0$ we have $$f'(x)=2x\sin\frac{1}{x}-\cos\frac{1}{x}$$ using the chain and product rules.
At zero, using the definition of derivative, $$f'(0)=\lim_{h\to0}\frac{f(0+h)-f(0)}{h}= \lim_{h\to0}h\sin\frac{1}{h}=0$$
On the other hand the limit $\lim\limits_{x\to0}f'(x)$ does not exist. If we compute it on the sequence $a_n=\frac{1}{2\pi n}$, we have $$\lim_{n\to\infty}f'(a_n)=\lim_{n\to\infty} \left(\frac{1}{2\pi n}\sin(2\pi n)-\cos(2\pi n)\right)=-1$$ whereas, over $b_n=\frac{1}{\pi+2\pi n}$ we have $$\lim_{n\to\infty}f'(b_n)=\lim_{n\to\infty} \left(\frac{1}{\pi+2\pi n}\sin(\pi+2\pi n)-\cos(\pi+2\pi n)\right)=1$$ Therefore $f'$ is not continuous at $0$.
• @MarzooqAbdulKareem The derivative at $0$ exists, no doubt about that. However the derivative, as a function, is not continuous at $0$. Mar 31, 2017 at 22:06