TITLE: differentiation of a piecewise function at a point
QUESTION [5 upvotes]: say I have the function $$ f(x)=\begin{cases}
x^{3}\sin(\frac{5}{x}) & x\ne0\\
0 & x=0
\end{cases} $$
I want to prove it is differentiable at $0.$
I first show that it is continuous by:
$$ \lim_{x\to0}f(x)=x^{3}\sin(\frac{5}{x})=0 $$
That is because I have a bounded function multiplied by 0.
Now i need to show if f is differentiable and if so,is $f'$ continuous?
I started by doing $$ f'(0)=\lim_{h\to0}\frac{(0+h)^{3}\sin(\frac{5}{0+h})-(0)^{3}\sin(\frac{5}{0})}{h} $$
But I can't seem to understand how do I go about the $\sin (\frac{5}{0})$ part because that doesn't exist.
Do i take 2 limits of $ x\to 0 $ and $h\to 0 $ in that case?
As for the second part of showing that f' is continuous I just differentiated with the product rule and got that:
$$ f'(x)=3x^2\sin(\frac{5}{x})-5x\cos(\frac{5}{x}) $$
And after checking both sides I saw that one of them is negative and the other is positive, hence it has different limits at the two sides.
How do I solve these problems by definition?

REPLY [3 votes]: You have that
\begin{eqnarray*}
f: I\subset \mathbb{R} &\to& \mathbb{R}\\
x&\mapsto& f(x)=\begin{cases}x^{3}\sin\left(\frac{5}{x}\right), &\quad x\not=0\\
0, &\quad x=0 \end{cases}
\end{eqnarray*}
If you want to prove that $f$ is differentiable at $0$, you do not need to start by proving that $f$ is continuous at $0$. Of course, if $f$ is not continuous at $0$, then $f$ is not differentiable at $0$. But, it is not what is requested in the problem.
You need to prove that $$\lim_{h\to 0} \frac{f(0+h)-f(0)}{h}$$there exists and if that limit there exists, then $$f'(0)=\lim_{h\to 0} \frac{f(0+h)-f(0)}{h}.$$
Now, you know that if $x=0$, so $f(0)=0$ and for all $x\not=0$, you have that $f(x)=x^{3}\sin\left(\frac{5}{x}\right)$.
Hence, $$\lim_{h\to 0}\frac{h^{3}\sin\left(\frac{5}{h}\right)-0}{h}=\lim_{h\to 0}h^{2}\sin\left(\frac{5}{h}\right)=0. \quad (1)$$
Note that $(1)$ it's clear, because $$-1\leqslant \sin\left(\frac{5}{h}\right)\leqslant 1$$
$$-h^{2}\leqslant h^{2}\sin\left(\frac{5}{h}\right)\leqslant h^{2}$$
$$\lim_{h\to 0} -h^{2}\leqslant \lim_{h\to 0} h^{2}\sin\left(\frac{5}{h}\right)\leqslant \lim_{h\to 0} h^{2}$$
$$0 \leqslant h^{2}\sin\left(\frac{5}{h}\right)\leqslant 0$$
Therefore, $$\lim_{h\to 0} h^{2}\sin\left(\frac{5}{h}\right)=0$$
and $f$ is differentiable at $x=0$ with $f'(0)=0$.