Originally Posted by

**undefined** EDIT 2: Anyway, this is what I came up with:

You found that

$\displaystyle f'(x)=x^p*((cos(1/x)*(-1/x^2))+(sin(1/x)*px^{p-1})$

$\displaystyle =x^{p-1}*(-cos(1/x)*(1/x)+sin(1/x)*p)$

when $\displaystyle x \neq 0$. I agree with this part.

**Good to know I did something right :S**

In what follows, when I assign a name to a limit (like $\displaystyle L_1$), I mean that this name applies only in the case that the limit exists.

We should use the definitions for right-derivative

$\displaystyle L_1 = lim_{h->0^+}(f(a+h)-f(a))/h$

and left-derivative,

$\displaystyle L_2 = lim_{h->0^-}(f(a+h)-f(a))/h$

to find out whether f(x) is differentiable at x=a=0. If both limits exist and $\displaystyle L_1=L_2$ then the derivative exists and $\displaystyle f'(0)=L_1=L_2$. We should **not** think only in terms of

$\displaystyle L_3 = lim_{x->0}f'(x)$

because it's possible that f'(0) exists but either (1) $\displaystyle L_3$ doesn't exist, or (2) $\displaystyle L_3$ exists but $\displaystyle f'(0) \neq L_3$, and in both cases (1) and (2), f(x) will be differentiable, but the derivative will not be continuous. It is also generally possible for $\displaystyle L_3$ to exist but f'(0) to not exist, in which case f(x) will not be differentiable but we might mistakenly think it is. This is a bit tricky to realize, but I believe it's the whole point of the problem.

** I follow you on this as well, that the limit may exist on both sides, but not necessarily equal**

So first, the right derivative:

$\displaystyle L_1 = lim_{h->0^+}(f(a+h)-f(a))/h$

$\displaystyle =lim_{h->0^+}(f(0+h)-f(0))/h$

$\displaystyle =lim_{h->0^+}(h^p*sin(1/h)-0)/h$

$\displaystyle =lim_{h->0^+}h^{p-1}*sin(1/h)$

If p = 1, then we have

$\displaystyle L_1=lim_{h->0^+}h^0*sin(1/h)$

$\displaystyle =lim_{h->0^+}sin(1/h)$

which does not exist since sin(1/h) oscillates an infinite number of times in any closed interval [0, b], b > 0.

If p > 1, then we'll be able to use the sandwich theorem (aka squeeze theorem) to determine that both right- and left-derivatives exist and equal 0.

So the first part of the question is answered: f(x) is differentiable if and only if p > 1.

**That makes sense.**

For the second part we need to check

$\displaystyle L_3 = lim_{x->0}f'(x)$

I believe it's most useful to express f'(x) like this

$\displaystyle f'(x)=-x^{p-2}*cos(1/x)+p*x^{p-1}*sin(1/x)$

**Okay, took a minute to realize, but yes - I agree**

because otherwise we might fall into a certain trap: if $\displaystyle lim_{x->0}g(x)=0$ and $\displaystyle lim_{x->0}h(x)$ is undefined, it would be wrong to conclude that $\displaystyle lim_{x->0}(g(x)h(x))=0$, for example consider $\displaystyle g(x)=x$ and $\displaystyle h(x)=x^{-4/3}$.

Anyway it's my understanding that

$\displaystyle lim_{x->0}(-x^{p-2}*cos(1/x))$

only exists when p > 2, in which case it will be 0 by the sandwich theorem. So overall f'(x) will be continuous only in the case p > 2.

**What about p = 2? **

I think this is right but again it's been a while, so please check my work and see if you agree.

**The work is very complicated, and it will take my mind 10 minutes to understand, but for now, let's agree that the work is correct. I thank you for your help, greatly.**