What is the derivative of $|x^3|$? Let $f(x)=|x^3|$.
I found two ways to differentiate this function. Apparently method 2 is wrong, but I cannot figure out why. So the question is, is method two wrong and why?
Method 1 (according to wolfram mathematica)
$$f(x)=|x^3|=|x|^3$$
$$f'(x)=3|x|^2 \text{Sgn}(x)=3|x^2|\frac{x}{|x|}=3|x|x$$
Method 2 (using chain-rule)
$$f'(x)= \text{Sgn}(x^3)\cdot3x^2$$
With method 2 it seems $f'(0)$ is not defined, since $\text{Sgn}(0)$ is not defined. However, this is not true according to WolframAlpha.
 A: This is a nice question as it highlights an important subtlety in the chain rule, although it's a subtlety that comes up rarely. The chain rules tells us that
$$
\frac{d}{dx} (f \circ g)(a) = f'(g(a)) \cdot g'(a),
$$
provided that $g$ is differentiable at $a$ and $f$ is differentiable at $g(a)$. 
It may happen that $f \circ g$ is differentiable at $a$ even if one of these hypotheses does not hold. This question is an example. Here, $g(x) = x^3$ and $f(x) = |x|$. Since $f$ is not differentiable at $g(0) = 0$, the hypotheses of the chain rule do not apply at $0$ and it is illegitimate to use it to conclude anything about the derivative there. Therefore, you must find another way. As you see, when we compute in the other direction, we see that in fact the derivative exists at the origin and is zero.
A: Undisputably,
$$\lim_{x\to0^+}\frac{|x^3|-|0^3|}{x-0}=\lim_{x\to0^+}\frac{x^3}x=\lim_{x\to0^+}x^2=0,$$
$$\lim_{x\to0^-}\frac{|x^3|-|0^3|}{x-0}=\lim_{x\to0^-}\frac{-x^3}x=\lim_{x\to0^-}-x^2=0.$$
Other $x$ cause no real difficulty.
A: I learned that, ...

... whenever you want to compute the derivative of a function involving an absolute value, first convert the absolute value into its definition
  $$
|x| = \sqrt{x^2} = (x^2)^{\frac{1}{2}}.
$$

So, $f$ can be re-written as
$$
f(x) = |x^3| = ((x^3)^2)^{\frac{1}{2}}.
$$
If we now apply the chain rule multiple times to compute its derivative, we obtain
$$
\begin{eqnarray}
\dfrac{df(x)}{dx}
&=& \left( \dfrac{df(x)}{d((x^3)^2)} \right) \cdot \left( \dfrac{d((x^3)^2)}{dx} \right) \\
&=& \left( \dfrac{df(x)}{d((x^3)^2)} \right) \cdot \left( \dfrac{d((x^3)^2)}{d(x^3)} \right) \cdot \left( \dfrac{d(x^3)}{dx} \right) \\
&=& \left( \dfrac{1}{2} \dfrac{1}{((x^3)^2)^{\frac{1}{2}}} \right) \cdot \left( 2x^3 \right) \cdot \left( 3x^2 \right) \\
&=& \dfrac{3x^5}{((x^3)^2)^{\frac{1}{2}}}.
\end{eqnarray}
$$
Now there are two options of how to proceed:


*

*Combine $(x^3)^2 = x^6$ to yield $\dfrac{df(x)}{dx} = \dfrac{3x^5}{\sqrt{x^6}}$.

*Or use again the definition of the absolute value to yield $\dfrac{df(x)}{dx} = \dfrac{3x^5}{|x^3|}$.


The computer algebra system Maple seems to prefer the first option; I would prefer the second one, because we started with an absolute value in the original function and end with an absolute value in its derivative. Nonetheless, both are equivalent.
