How to find the class of a function Let $$f(x) = \begin{cases} 
 x^3\sin(\frac{1}{x}); & \text{ if, } x \neq 0 \\
 0; & \text{ $x=0$ }
\end{cases}$$
How do I find the greatest value of n such that $f \in C^n ([-1,1])$?
I know to find n, I must find the greatest n such that $f^{(n)}(x)$ is differentiable in the interval $[-1,1]$. But how do I prove its differentiability?
 A: You have to check if $f^{(n)}$ is continuous $n$ by $n$.
Start with $n=0$.
The function is continuous because
$$\lim_{x \to 0^+} x^3 \sin{\left(\tfrac{1}{x}\right)} = \lim_{x \to 0^-} x^3 \sin{\left(\tfrac{1}{x}\right)}=0.$$
For $n=1$,
$f'(x) = \begin{cases} -x \cos{\left(\tfrac{1}{x}\right)} + 3x^2 \sin{\left(\tfrac{1}{x}\right)} , & \text{ if } x \neq 0\\
0, & \text{ if } x = 0
\end{cases}$
is continuous because
$$\lim_{x \to 0^+} -x \cos{\left(\tfrac{1}{x}\right)} + 3x^2 \sin{\left(\tfrac{1}{x}\right)} = \lim_{ x \to 0^-} -x \cos{\left(\tfrac{1}{x}\right)} + 3x^2 \sin{\left(\tfrac{1}{x}\right)} = 0.$$
For $n = 2$,
$f''(x) = \begin{cases} -4 \cos{\left(\tfrac{1}{x}\right)} - \tfrac{1}{x}\sin{\left(\tfrac{1}{x}\right)}+6x\sin{\left(\tfrac{1}{x}\right)} , & \text{ if } x \neq 0\\ 
0, & \text{ if } x = 0
\end{cases}$ is not continuous because
$$\lim_{ x \to 0}-4 \cos{\left(\tfrac{1}{x}\right)} - \tfrac{1}{x}\sin{\left(\tfrac{1}{x}\right)}+6x\sin{\left(\tfrac{1}{x}\right)}$$ does not exist.
Thus the greatest $n$ for which $f \in C^n([-1,1])$ is $n=1$.
A: Check that $f'(0)=0$ and $f'(x)=3x^2\sin (1/x) - x\cos (1/x)$ if $x\ne 0.$ It follows that $f'$ is continuous everywhere.
However, for $x\ne 0,$
$$\frac{f'(x)-f'(0)}{x-0} = 3x\sin (1/x) - \cos (1/x).$$
As $x\to 0,$ the first term on the right $\to 0.$ But $\cos(1/x)$ has no limit as $x\to 0.$ Therefore $f''(0)$ does not exist. It follows that $n=1$ is the answer to the problem.
