Derivative of $x|x|$ I am trying to find the derivative of $f(x)=x|x|$ using the defition of derivative. For $x > 0$ I found that $f'(x)=2x$ and for $x<0$ the derivative is $f'(x)=-2x$. Everything is fine up to here. Now I want to check what happens when at $x=0$.
By the way, I know that $|x|$ is not differentiable at $x=0$.
So I am checking the left & right limits of $f$ when $x$ approaches $0$.


*

*$\lim_{x \to 0^-}\cfrac{x|x|}{x} = \lim_{x \to 0^-}\cfrac{x(-x)}{x}=\lim_{x \to 0^-}\cfrac{(-x)}{1} = -0? = 0. $

*$\lim_{x \to 0^+}\cfrac{x|x|}{x} = \lim_{x \to 0^4}\cfrac{x(x)}{x}=\lim_{x \to 0^+}\cfrac{(x)}{1} = 0. $
I think that $f$ is not differentiable at $x=0$ since $|x|$ is not differentiable at that point. So , what do I do wrong?
Should I write something like $\lim_{x \to 0^-}\cfrac{x|x|}{x} = -0^{-}$ and $\lim_{x \to 0^+}\cfrac{x|x|}{x} =0^{+}$ so that $f'$ does not exist at $x=0$?
 A: You did nothing wrong. Your calculated derivative is $$g(x)=\begin{cases}-2x & x<0\\ 2x & x>0 \\ 0& x=0\end{cases}$$
which is a continuous function, thus $f$ if differentiable.
What happens here is that the fact the zero of one function ($x \mapsto x$) smoothens out the undifferentiable point of the other function ($x \mapsto |x|$). 
More generally, if $h_1(x_0)=0$ and $h_2$ is continuous in a neighborhood of $x_0$, then always $\lim_{x\rightarrow x_0}h_1(x)\cdot h_2(x)=0$, i.e. it doesn't matter how misbehaving $h_2$ is at $x_0$. Finally note that $x \mapsto |x|$ is continuously differentialble on any interval which does not include $x=0$.
A: You didn't do anything wrong, you in fact shown that $f$ is differentiable at $x = 0$ and $f'(0) = 0$. The fact that $x \mapsto |x|$ is not differentiable at $x = 0$ doesn't mean that if you consider the product of this function with another function then the result won't be differentiable at $x = 0$, as you have just shown. 
However, since you have shown that $f'(x) = 2|x|$ you can see that $f$ is not twice differentiable at $x = 0$.
A: \begin{eqnarray}
g^\prime(x)&=&\lim_{h\to0}\frac{(x+h)\vert x+h\vert-x\vert x\vert}{h}\\
&=&\lim_{h\to0}\frac{(x+h)\vert x+h\vert-x\vert x\vert}{h}\cdot\frac{(x+h)\vert x+h\vert+x\vert x\vert}{(x+h)\vert x+h\vert+x\vert x\vert}\\
&=&\lim_{h\to0}\frac{(x+h)^4-x^4}{h((x+h)\vert x+h\vert+x\vert x\vert)}\\
&=&\lim_{h\to0}\frac{4x^3+6x^2h+4xh^2+h^3}{(x+h)\vert x+h\vert+x\vert x\vert}\\
&=&\frac{4x^3}{2x\vert x\vert}\\
&=&\frac{2x^2}{\vert x\vert}\\
&=&2x\cdot\frac{\vert x\vert}{x}
\end{eqnarray}
A: For information, you have the following theorem which you can use

Let $I$ be an interval, $a\in I$. If a function $f$ is continuous on $I$, has a derivative on  $I\smallsetminus\{a\}$ and if $f'(x)$ has a limit at $a$, then $f $ has a derivative at $a$, and
  $$f'(a)=\lim_{x\to a}f'(x).$$

