<s>[INST] 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?
 [/INST] 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$.
</s>