What is the largest value $n$ such that $f$ belongs to $C^n([-1,1])$? $f: [-1,1]\to \mathbb{R}$, $f(x) = x^3\sin(1/x)$ if $x$ doesn't equal $0$ and $0$ if $x=0$. What is the largest value of $n$ such that $f$ belongs to $C^n([-1,1])$?
So we want to find the largest value $n$ such that $f$ is continuously differentiable $n$ times on the interval $[-1,1]$.
I began by noticing for $x$ not equal to $0$, $f$ is continuously differentiable infinite times on the interval by AoCF so I just need to look at differentiability at $x = 0$.
$f$ is differentiable at $0$ iff $\lim_{x\to 0^-} (f(x)-f(0))/(x-0) = \lim_{x\to 0^+} (f(x)-f(0))/(x-0)$, $(f(x)-f(0))/(x-0) = x^2\sin(1/x)$ and both of the limits to $0$ from above and below are $0$ which I showed using sandwich rule with $-x^2$ and $x^2$.
I then did the same process with the first derivative, noticing both limits are again $0$. With the second derivative, both of the limits were infinity.
Does this fit the definition for $f$ to be differentiable at $0$? Can I say the limits are equal as they both tend to infinity? If so, should I keep going with this method until the limits don't match or should I be looking down a different path?
I feel like the answer should be $n = 3$ because then as $x$ tends to $0$, $f(x)$ will have been reduced to a trig function no longer multiplied by some power of $x$ (which will have made the function's derivative tend to $0$ as $x$ tended to $0$).
I think Caratheodory's theorem may have helped also but I am not supposed to know about it yet so cannot use it!
 A: Your calculations correctly show that $f$ is differentiable at $0$.  To conclude that $f$ is continuously differentiable at $0$, there is one more step you need to do: you need to compare the value $f'(0)=0$ that you found with values of $f'(x)$ for $x$ near $0$ to check whether $f'$ is continuous at $0$.  Since $f'(x)=3x^2\sin(1/x)-x\cos(1/x)$ for $x\neq 0$ and this does indeed approach $0$ as $x\to 0$, $f'$ is indeed continuous at $0$.
In general, this is the procedure you need to take to check whether $f$ is $C^n$.  You use the definition of the derivative to check whether the derivative exists at $0$.  Then, you have to check whether this derivative value at $0$ makes the derivative a continuous function (when combined with the easy general formula you get by the rules of calculus away from the singularity at $0$).  This shows $f$ is $C^1$. Then, you repeat the same process with $f'$ in place of $f$ to check whether $f$ is $C^2$, and so on.  For the derivative to exist, the limit defining it needs to exist as a real number, so if the limit is $\infty$ then the derivative does not exist.
You then say you did the same process with the first derivative and found that the limit defining the second derivative again gives $0$, but it seems you made a mistake in doing so.  Using the formula above for $f'(x)$ when $x\neq 0$ and remembering that $f'(0)=0$, the difference quotient for $f''(0)$ is $$\dfrac{f'(x)-f'(0)}{x-0}=\dfrac{3x^2\sin(1/x)-x\cos(1/x)}{x}=3x\sin(1/x)-\cos(1/x).$$  This expression does not converge to a limit as $x\to 0$, since while the first term approaches $0$, the second term oscillates between $-1$ and $1$.  So, $f''(0)$ does not exist, and $f$ is not $C^2$.
