Analysis:Is $x|x|$ differentiable at $x=0$?

I plotted this graph in wolfram alpha and it looks nice and smooth at $x=0$. Does that mean that $x|x|$ is differentiable at $x=0$? I don't understand formally using the definition of the derivative why this is the case. Thanks.

• Yes. But its second derivative does not exist at $0$ – ziggurism Nov 20 '17 at 1:35
• "I don't understand formally using the definition of the derivative why this is the case. " Why? What's difficult in writing down the definition? – Jack Nov 20 '17 at 2:07
• Yeah, I agree, I was overthinking it. I understand now. – kemb Nov 20 '17 at 2:22

It's not because the graph looks nice and smooth that the function is differentiable, although that is what the term is trying to capture.

The function is differentiable because of the definition of differentiable. The limit $$\lim_{h\to 0} \frac{f(0+h) - f(0)}{h} = \lim_{h\to 0} \frac{h|h|}{h} = \lim_{h\to 0} |h| = 0$$

Note that $f(x)=x|x|$ can be written as:

$$f(x)=\cases{ x^2 & x\ge 0\\ -x^2 & x<0}$$

The derivative of $x^2$ is $2x$, and the derivative of $-x^2$ is $-2x$. Both approach $0$ as $x\to 0$, and we also have $\displaystyle\lim_{h\to 0}\frac{f(h)}{h}=\displaystyle\lim_{h\to 0}|h|=0$, so $f'(x)$ is defined and continuous at $x=0$. The second derivative however, as noted in a comment above, is problematic...

A more "applied-math" approach is use the formula $$\frac{d|x|}{dx}=\mathrm{sgn}(x)$$ for real $x$. Then we have

$$\frac{d(x|x|)}{dx}=|x|+x\,\mathrm{sgn}(x)=2|x|.$$

The first-order derivative is continuous and equals $\,0\,$ at $\,x=0$. The second-order derivative is $2\,\mathrm{sgn}(x)$ and is not continuous at $\,x=0$.

• One has to be careful with this approach. $\frac{d|x|}{x} = \mathop{\mathrm{sgn}}(x)$ only when $x\neq 0$, unless we extend the definition of derivative. – Matthew Leingang Nov 21 '17 at 13:42
• @MatthewLeingang, you're right. Also, "derivative not exist" is not the same thing as "derivative not continuous". That's why I say it's "applied-math". – Zhuoran He Nov 21 '17 at 23:33