# differentiation of a piecewise function at a point

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?

• Why did you write $0^3\sin\frac 50$? The hypothesis does not say that $f(0)=0^3\sin\frac 50$.
– user239203
Jun 22 '21 at 15:30
• So instead I just say that $$f'(0)=\lim_{h\to0}\frac{(0+h)^{3}\sin(\frac{5}{0+h})-0}{h}=\frac{h^{3}sin(\frac{5}{h})}{h}=h^{2}\sin(\frac{5}{h})=0$$ Jun 22 '21 at 15:39
• @DannyBlozrov Yes, that is the correct way to evaluate $f'(0)$. Jun 22 '21 at 15:49

The defintion of the derivative at $$0$$ is :$$f'(0)=\lim_{h\to0}\frac{f(0+h)-f(0)}{h}$$ You are given that $$f(0)=0$$ from here the limit is easy to evaluate.
For other $$x$$ you can use the product and chain rule .

• (+1) for a complete solution that actually addresses the OP's first question. Jun 22 '21 at 15:48

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$$.

• (+1) for a complete solution that actually addresses the OP's first question. Jun 22 '21 at 15:48
• Thank you very much,understood it all. As for showing that f' is continuous I can just use the product and chain rule to find $f'(x) for any$ x\ne 0 $and I know that$ f'(0)=0 \$ ,now I just have to compare the limit to 0 and see if its the same? Jun 22 '21 at 16:01

To check differentiability at $$0$$ you should essentially calculate the limit $$\lim_{h \to 0} \frac{f(h) -f(0)}{h} = \lim_{h\to 0} \frac{h^3 \sin(5/h)}{h} = \lim_{h \to 0} h^2 \sin \left( \frac{5}{h} \right)$$.

Observe that $$0 \le \left\vert h^2 \sin \left( \frac{5}{h} \right) \right\vert \le h^2$$ So by Squeeze_theorem the limit exists and equal to $$0$$.

• Not really following why, that's a must have condition that checks if it is continuous, why does it mean its differentiable? Jun 22 '21 at 15:44
• This fails to address the main question. Jun 22 '21 at 15:47

When you look at the product rule, you need that both factors are differentiable. But $$\sin(5/x)$$ is not differentiable in $$0$$, so you cannot apply this rule to your example.