# Trouble checking whether a function is differentiable or not

I have this function $$x^2|\cos \frac \pi x|$$ . To check if it's differentiable at $$x=0$$, I first directly differentiated the given function- having two cases, opening the mod sign with positive and negative signs. In both cases I end up with a $$\sin \frac \pi x$$ term in the derivative, so that at $$x=0$$ the derivative is discontinuous (oscillatory discontinuity) and so the derivative shouldn't exist at $$x=0$$. But, if I differentiate using first principles instead, I get the derivative as $$0$$, and so the function IS differentiable at $$x=0$$. So, is the function differentiable or not, which result do I take?

• You've shown that the derivative exists (and in addition that it is discontinuous at $0$). (You're done.) Jan 5, 2019 at 13:14
• To be clear, "differentiable" means "the derivative exists" (which you showed from first principles). It does not mean "the derivative is itself continuous" (which you showed is false here). Jan 5, 2019 at 14:05
• But I don't understand, if by differentiation using first principles, I could find the left hand and right hand limits of the derivative, then why is the function still discontinuous? Is it because we can't find the value of the derivative AT x=0? Jan 5, 2019 at 14:43
• Also, why would I not get a left hand and right hand limit by differentiating directly, how is that process wrong? Jan 5, 2019 at 14:48
• @karun Yes. A function of this type is a standard example. Another is $x^2\sin \frac1x$. Jan 7, 2019 at 14:35

Hint: Compute $$\lim_{h\to 0}\frac{f(0+h)-f(0)}{h}$$ this is $$\lim_{h\to 0}\frac{h^2|\cos(\frac{\pi}{h})|-0}{h}$$ and since $$\frac{h^2|\cos(\frac{\pi}{h})|}{h}=h|\cos(\frac{\pi}{h})|\le h$$ this tends to zero for $$h$$ tends to zero.
• @karun There's no such thing as $\sin(\infty)$. All you know is that $x\to 0$, $\sin(\frac\pi{x})$ is bounded in absolute value by $1$. This is good enough to show the limit is $0$. Jan 5, 2019 at 17:30
Apparently this type of function is an example of a function whose derivative at a point exists (this can be checked by applying the first principle of differentiation), however it's derivative is also discontinuous at that very same point. Such functions do exist. Another example of this is $$x^2sin1/x$$ . Thanks @Matt Samuel for explaining