# Multiple choice exercise on $f(x)= \frac {\sin x}{|x|+ \cos x}$

Let $$f : \Bbb R \to \Bbb R$$ be the function defined by $$f(x)= \frac {\sin x}{|x|+ \cos x}$$. Then

A.$$f$$ is differentiable at all $$x \in \Bbb R$$.

B.$$f$$ is not differentiable at $$x =0$$.

C.$$f$$ is differentiable at $$x=0$$ but $$f'$$ is not continuous at $$x=0$$.

D.$$f$$ is not differentiable at $$x=\frac {\pi}{2}$$.

Using the standard definition of derivative, I get that $$f$$ is differentiable at $$0$$ as well as $$\frac {\pi}2$$. This is as follows,

$$\lim_{h \to 0} \frac {f(0+h)-f(0)}{h}=1=\lim_{h \to 0} \frac {f(0-h)-f(0)}{-h}$$

and

$$\lim_{h\to 0} \frac {f(\frac {\pi}2 +h)-f(\frac {\pi}{2})}{h}=0=\lim_{h \to 0} \frac {f(\frac {\pi}2 -h)-f(\frac {\pi}2)}{-h}$$ using L'Hospital rule at one stage.

Hence I eliminate options B and D.

Since $$0$$ was the only doubtful point to check about differentiability, I choose option A as the answer.

I regret a little about not knowing how to check validity of option C. Can you tell me how to prove it wrong?

• Just differentiate and see what happens when $x=0$. Dec 14, 2015 at 13:31
• While I differentiate by $\frac uv$-rule, I get encountered by the term $|x|$. In that case how should I approach it? Dec 14, 2015 at 13:35
• $\frac{d}{dx}|x|=\frac{x}{|x|}$, to see this start with $t=|x|$ and then $t^2=x^2$ Dec 14, 2015 at 13:38
• @Quintic. Nice. That really worked. I verified $\lim_{h \to 0} f'(0+h)=\lim_{h \to 0} f'(0-h)=1$. Dec 14, 2015 at 14:13
• Then you can post your solution as an answer. It is a nice practice to answer your own question after you find out everything right. :) Dec 14, 2015 at 15:18

By definition of the derivative $$f'(0)=\lim_{h\to0}\frac{\frac{\sin h}{|h|+\cos h} - \frac{\sin 0}{0+1} }h= \lim_{h\to0}\frac{\sin h}{h(|h|+\cos h)}$$ Note that (using L'Hospital and then substitution) $$\lim_{h\to0^+}\frac{\sin h}{h(|h|+\cos h)}=\lim_{h\to0^+}\frac{\sin h}{h(h+\cos h)}=\lim_{h\to0^+}\frac{\cosh}{2h+\cos h - h\sinh)}=1$$

Verify by yourself that also $$\lim_{h\to0^-}\frac{\sin h}{h(|h|+\cos h)}= \lim_{h\to0^-}\frac{\sin h}{h(-h+\cos h)}=1$$

Conclude that $f'(0)=1$

So you got that $f'(0)$ is defined, to show $f'$ is continuous at $x=0$ one need to show for example that $$\lim_{x\to0} f'(x)=f'(0)$$

$$\lim_{x\to0} f'(x) = \lim_{x\to0}\lim_{h\to0}\frac{\frac{\sin x+h}{|x+h|+\cos (x+h)} - \frac{\sin x}{|x|+\cos x} }h= \lim_{h\to0}\lim_{x\to0}\frac{\frac{\sin x+h}{|x+h|+\cos (x+h)} - \frac{\sin x}{|x|+\cos x} }h=f'(0)$$ The switching the order of limits is allowed when the function is uniformly continuous. A continuous function on a compact set is uniformly continuous, so everything is fine here, but I guess that you won't like this sort of answer:)

Using $x\ne0$: $|x|'=\mathrm{sgn}(x)$ where $$\mathrm{sgn}(x) = \begin{cases}1&x>0\\0&x=0\\-1&x<0\end{cases}$$ $$f'(x)=\frac{\cos (x)}{\left| x\right| +\cos (x)}-\frac{\sin (x) (\mathrm{sgn}(x)-\sin (x))}{(\left| x\right| +\cos (x))^2},\quad x\ne0$$

$$\lim_{x\to0^+} f'(x) = \frac{1}{0 +1}-\frac{0 (0-0)}{(0 +1)^2}=1$$

Similarly $$\lim_{x\to0^-} f'(x) = 1$$ Conclude $$\lim_{x\to0} f'(x)=f'(0)$$ and you done.

• How did you conclude that $f'$ is continuous at $0$? Dec 14, 2015 at 13:45
• I just show why $f$ is differentiable at $x=0$, will add a note about continuity Dec 14, 2015 at 13:52
• One more thing as $f'(0)=1$ so we can conclude that $f'$ is continuous at $0$. Is that right? Dec 14, 2015 at 13:53
• @Quintic nope, math.stackexchange.com/questions/292275/… Dec 14, 2015 at 14:19
• @Alex Nope, using L'Hospital we differentiate different function, the nominator and denominator. Dec 14, 2015 at 14:20

I feel you are looking for a descriptive answer, still leaving it here as an answer since it explains your doubt.

From graph:

Where green is $$f$$, blue is $$f'$$, orange is $$f''$$. $$f'$$ is clearly continuous but not differentiable at $$0$$

• The graph certainly makes the things clear. Thanks :) Dec 14, 2015 at 14:07

As per the discussion with @Quintic in the above comments,

$f'(x)=\frac {1+|x|\cos x-\frac {x}{|x|} \sin x}{(|x|+\cos x)^2}$.

Now, $\lim_{h \to 0} f'(0+h)=\lim_{h \to 0} \frac {1+|h|\cos h-\frac {h}{|h|}\sin h}{(|h|+\cos h)^2}=\lim_{h \to 0}\frac {1+h\cos h-\sin h}{(h+\cos h)^2}$. (Where $h \gt 0$)

$\Rightarrow \lim_{h\to 0} f'(0+h)=\frac {1+0-0}{(0+1)^2}=1.$

Similarly, $\lim_{h\to 0} f'(0-h)=\lim_{h\to 0} \frac {1+h\cos h-\sin h}{(h+\cos h)^2}$ (Where $h \gt 0)$

$\Rightarrow \lim_{h\to 0} f'(0-h)=1$.

Hence $\lim_{h\to 0} f'(0+h)=\lim_{h\to 0} f'(0-h) \Rightarrow$ $f'$ is continuous at $x=0$.