Derivative of piecewise function with $\sin\frac{1}{x}$ term

calculusderivatives

I was going through my calculus book, and I am not sure I understand this part

$f(x) = \begin{cases} \frac{x^2}{4}+x^4\sin(\frac{1}{x}) &\text{if $x\neq0$ } \\ 0 &\text{if $x=0$ } \end{cases}$

$ f'(x) = \begin{cases} \frac{x}{2}-x^2\cos(\frac{1}{x})+4x^3\sin(\frac{1}{x}) &\text{if $x\neq0$ } \\ 0 &\text{if $x=0$ } \end{cases}$

$ f''(x) = \begin{cases} \frac{1}{2}+12x^2\sin(\frac{1}{x})-\sin(\frac{1}{x})-6x\cos(\frac{1}{x}) &\text{if $x\neq0$ } \\ \frac{1}{2} &\text{if $x=0$ } \end{cases}$

So, I know that when I have piecewise function, I need to look at left and right limit, but I don't see why second part in second derivative is $\frac{1}{2}$, or rather why does the $\sin\frac{1}{x}$ term go to 0?

Best Answer

If $x\neq0$, then\begin{align}\frac{f'(x)-f'(0)}x&=\frac{\frac x2-x^2\cos\left(\frac1x\right)+4x^3\sin\left(\frac1x\right)}x\\&=\frac12-x\cos\left(\frac1x\right)+4x^2\sin\left(\frac1x\right)\end{align}and therefore\begin{align}f''(0)&=\lim_{x\to0}\frac12-x\cos\left(\frac1x\right)+4x^2\sin\left(\frac1x\right)\\&=\frac12.\end{align}

Related Question