# Derivative by definition

I'm trying to find the derivative by definition of the following function:

$f(x)=\sqrt{|x|}\sin(x)$

I know that by definition:

$$f'(x)=\lim_{h\to0}\frac{\sqrt{|x+h|}\sin(x+h)-\sqrt{|x|}\sin(x)}{h}$$

But if I try to find the derivative at $0$ I get:

$$f'(0)=\lim_{h\to0}\frac{\sqrt{|h|}\sin(h)}{h}=0$$

which is not true because the derivative $DNE$ at $0$ because:

$$f'(x)=\begin{cases} \sqrt{x} \cos x+\frac{\sin x}{2\sqrt{x}}, \ \ \ \ \ x>0 \\ \sqrt{-x} \cos x-\frac{\sin x}{2\sqrt{-x}}\ \ \ x<0 \\ \end{cases}$$

So how can it be that the derivative exists only when it is calculated by definition?

• Your final expression for $f'(x)$ looks as if it has limits of $0$ as $x \to 0$ from above or below. Combine this with the continuity of $f(x)$ – Henry Jan 19 '16 at 10:57
• You could make the derivative concise by taking $$\frac{d}{dx}|x|=|x|/x$$. Try evaluating the resultant derivative using a limit – Prish Chakraborty Jan 19 '16 at 13:07

You shouldn't say that the derivative does not exist.

Indeed,

$$\lim_{h\to0}\frac{\sqrt{|h|}\sin(h)}{h}=\lim_{h\to0}\sqrt{|h|}\cdot\lim_{h\to0}\frac{\sin(h)}{h}=0\cdot1.$$

As the limit exists, this is the value of the derivative.

• Just a comment to the OP: the first equality holds because both limits on the right exist. If $\lim g$ and $\lim f$ exist, then $\lim f\cdot g$ exists and is equal to $\lim f\cdot \lim g$ – 5xum Jan 19 '16 at 9:18
• Yves, I edited my question. – CodeNinja Jan 19 '16 at 9:31
• @CodeNinja: when you modify a question after the fact, you should clearly indicate it, otherwise comments and answers can become nonsense. – Yves Daoust Jan 19 '16 at 10:03
• I just clarified my intention. – CodeNinja Jan 19 '16 at 10:07
• @CodeNinja: you should clearly indicate the change. – Yves Daoust Jan 19 '16 at 10:20

We have $$f(x)=\begin{cases} \sqrt{x} \sin x, \ \ \ \ \ x\geq0 \\ \sqrt{-x} \sin x\ \ \ x<0 \\ \end{cases}$$ and $$f'(x)=\begin{cases} \sqrt{x} \cos x+\frac{\sin x}{2\sqrt{x}}, \ \ \ \ \ x>0 \\ \sqrt{-x} \cos x-\frac{\sin x}{2\sqrt{-x}}\ \ \ x<0 \\ \end{cases}$$ But $$\frac{\sin x}{2\sqrt{x}}\rightarrow 0, \ \ \ \frac{\sin x}{2\sqrt{-x}}\rightarrow 0$$ for $x\rightarrow 0^+$ and $x\rightarrow 0^-$. Moreover, by definition of derivative: $$\lim_{h\to0}\sqrt{|h|}\cdot\lim_{h\to0}\frac{\sin(h)}{h}=0\cdot1.$$

• but it does not defined at $x=0$ so the derivative does not exist at that point (because you divide by $\sqrt{x}$) – CodeNinja Jan 19 '16 at 9:26
• @CodeNinja Not true. The derivative at $0$ is defined as $\lim_{h\to 0} \frac{f(0+h) - f(0)}{h}$. That is the definition. The fact that $\sqrt{x}\cos x + \frac{\sin x}{2\sqrt x}$ is not defined for $x=0$ does not mean that the derivative does not exist. – 5xum Jan 19 '16 at 9:30
• I agree with @5xum. Furthermore, the two limits are equal. – Mark Jan 19 '16 at 9:32
• @Mark, So I can I know when I can calculate the derivative by a formula (like the chain rule of something else) or that it can be calculated only by definition. – CodeNinja Jan 19 '16 at 9:37
• @CodeNinja, if $\exists$ $\lim_{x\to x_0} f'(x)$ then $f'(x_0)=\lim_{x\to x_0} f'(x)$. But beware: this is only a sufficient condition. – Mark Jan 19 '16 at 9:55