# When is this function Differentiable?

I was given this function:

$$f(x)=\begin{cases}\displaystyle|x|^p\cos\Big(\frac\pi{|x|^q}\Big),&x\ne0\\0,&x=0\end{cases}$$

And was asked to find for what $$p, q>0$$ it is differentiable at $$x=0$$.

First I saw it is continuous when $$p>0, q>0$$.

Now, I tried to see if the limit for $$f'(x)$$ exists at $$x=0$$. This function is even so I looked at the right side only.

$$\lim_{x\to0^+}\frac{f(x)-f(0)}{x-0}=\lim_{x\to0^+}\frac{x^p\cos\Big(\displaystyle\frac\pi{x^q}\Big)}x=\lim_{x\to0^+}x^{p-1}\cos\Big(\frac\pi{x^q}\Big)$$

I get that this limit exists when $$p>1$$, and for all $$q>0$$, but looking at the graph online it doesn't seem to be right. What am I doing wrong here (if anything)?

Thanks a lot!

• You have solved it correctly. Graphical aids are often inaccurate for plots like these. How were you able to draw any conclusion for $f$ near $0$ using its graph? – Shubham Johri Jan 8 '19 at 19:53
• I got confused and looked for the derivative to be continuous. – איתן לוי Jan 8 '19 at 20:02

Your conclusion is right for $$p>1$$ and all values of $$q>0$$. The reason why you don't observe so on the graph is the the oscillation of the function increases around $$x=0$$ so it's indistinguishable to see whether the function is differentiable in $$x=0$$ or not. Also the function has no continuous derivative in $$x=0$$ for $$0. The figure below shows why: 