Is $f(x)=x|x|$ differentiable everywhere?
When $f$ is a function $\mathbf{R}$ to $R$. I know $\lim_{x \to 0+}\frac{f(x)-f(0)}{x-0}= \lim_{x \to 0+}\frac{x^2}{x}=0$ and $\lim_{x \to 0-}\frac{f(x)-f(0)}{x-0}= \lim_{x \to 0-}\frac{-x^2}{x}=0$, but $|x|$ is not differentiable everywhere, so I'm doubting myself.
$\endgroup$ 52 Answers
$\begingroup$Yes, it is differentiable everywhere, but it does not have a second derivative at $x=0$.
One way to see this is to use the equivalent definition
$$f(x) = \begin{cases} x^2, & x\ge 0 \\[2ex] -x^2, & x< 0 \\ \end{cases}$$
The derivative of each piece (the limit on the left piece) at/approaching $x=0$ is zero, so the derivative at $x=0$ is indeed zero. This graph should show that the first derivative is defined as zero at $x=0$ but the second derivative is undefined there.
$\endgroup$ $\begingroup$It should be clear that $f$ is differentiable for $x\neq 0$.
For $x=0$, we have $\lim_{x \to 0} { f(x)-f(0) \over x-0} = \lim_{x \to 0} |x| = 0$, hence $f$ is differentiable at $x=0$ with derivative zero.
$\endgroup$More in general
What are the ramifications of clearing Fort Independence?