Finding the derivative of $|x|^4$ using the chain rule. I am presented with the following task:
Can you use the chain rule to find the derivatives of $|x|^4$ and $|x^4|$ in $x = 0$? Do the derivatives exist in $x = 0$? I solved the task in a rather straight-forward way, but I am worried that there's more to the task:
First of all, both functions is a variable to the power of an even number, so given that $x$ is a real number, we have that $|x^4| = |x|^4$. In order to force practical use of the chain rule, we write $|x|^4 = \sqrt{x^2}^4$. We are using the fact that taking a number to the power of an even number, and using the absolute value, gives us positive numbers exclusively. If we choose the chain $u = x^2$, thus $g(u) = \sqrt{u}^4$, we have that $u' = 2x$ og $g'(u) = (u^2)' = 2u$. Then we have that the derivative of the function, that I for pratical reasons will name $f(x)$, is $f'(x) = 2x^2 * 2x = 4x^3$. We see that the the general power rule applies here, seeing as we work with a variable to the power of an even number. The derivative in the point $x = 0$ is $4 * 0^3 = \underline{\underline{0}}$. Thus we can conclude that the derivative exists in $x = 0$.
Is this fairly logical? I'm having a hard time seeing that there is anything more to this task, but it feels like it went a bit too straightforward.
 A: $$
{{\rm d}\left\vert x\right\vert^{4} \over {\rm d}x}
=
4\left\vert x\right\vert^{3}\,{{\rm d}\left\vert x\right\vert \over {\rm d}x}
=
4\left\vert x\right\vert^{3}\,{\rm sgn}\left(x\right)
=
4\left\vert x\right\vert^{2}
\left\lbrack\vphantom{\Large A}%
\left\vert x\right\vert\,{\rm sgn}\left(x\right)
\right\rbrack
=
4x^{2}\left\lbrack\vphantom{\Large A}x\right\rbrack
=
4x^{3}
$$
We usually define $\quad{\rm sgn}:{\mathbb R} - \left\lbrace 0\right\rbrace \to {\mathbb R}$ such that
$$
{\rm sgn}\left(x\right)
=
\left\lbrace%
\begin{array}{rl}
-1\,,\qquad & x < 0
\\[1mm]
1\,,\qquad  &   x > 0
\end{array}\right.
$$
However, we usually see calculations where it is assumed
"${\rm sgn}\left(0\right) = 0$" for practical purposes. The correct way is to perform the calculation for $x \not= 0$ and consider the case $x = 0$ as an independent one. It could be ( in particular cases ) that the "result $x = 0$" coincides with the "result $\not= 0$" in the limit $x \to 0^{\pm}$. 
The above definition and "extremely care" are useful in 'practical calculations'. For example, let's solve ${\rm y}'\left(x\right) = 2\left\vert x\right\vert$
with ${\rm y}\left(-1\right) = -1$:
\begin{align}
{\rm y}\left(x\right) - {\rm y}\left(-1\right)
&=
{\rm y}\left(x\right) + 1
=
2\int_{-1}^{x}{\rm sgn}\left(x'\right)x'\,{\rm d}x'
=
\left.
\vphantom{\Huge A}x'^{2}{\rm sgn}\left(x'\right)
\right\vert_{-1}^{x}
-
\int_{-1}^{x}x'^{2}
\left\lbrack 2\delta\left(x'\right)\right\rbrack\,{\rm d}x'
\\[3mm]&=
x^{2}\,{\rm sgn}\left(x\right) + 1
\quad\Longrightarrow\quad
{\rm y}\left(x\right) = x\,\left\vert x\right\vert\,,\quad x \not= 0
\end{align}
We solved the differential equation without dividing the problem in two cases
( $x < 0$ and $x > 0$ ). Since
${\rm y}\left(0^{\pm}\right) = 0\left\vert 0\right\vert$, we 'adopt' as a solution ${\rm y}\left(x\right) = x\,\left\vert x\right\vert,\ {\large\forall\ x}$.
If you are in the Physics area, you'll find many situations like the one you addressed. 
A: You can apply the chain rule to $(x^{2})^{2}$, which happens to equal $|x^{4}|=|x|^{4}$, since it is the composition of two functions differentiable at $0$ (i.e take $f(x)=x^{2}$ then this is $f\circ f$). You could actually proceed quicker since $|x^{4}|=|x|^{4}=x^{4}$ so we don't need chain rule. What you are using is that $f(x)=|x^{4}|=|x|^{4}$ agrees everywhere with a function that is differentiable everywhere and is hence differentiable everywhere itself. You can prove this using difference quotients.
Let $f$ be a function that agrees everywhere with a function $g$ whose derivative at $x_{0}$ exists.. Then is $f$ is differentiable at $x_{0}$ and $f'(x_{0})=g'(x_{0})$
$\lim_{h\to0}\frac{f(x_{0}+h)-f(x_{0})}{h}=\lim_{h\to0}\frac{g(x_{0}+h)-g(x_{0})}{h}=g'(x_{0})$. So $f'(x_{0})$ exists and equals $g'(x_{0})$.
A: It's worth noting that $|x^4|$ and $|x|^4$ equal $x^4$, but no matter. I'll assume that any simplifications like that are off-limits throughout.
One way to express the derivative of $|x|$ is $\frac{|x|}{x}$. So if we applied the chain rule to $|x^4|$ we have $\frac{|x^4|}{x^4}\cdot4x^3$, which is undefined at $0$. However this expression is defined in a neighborhood of $0$, and its limit exists, because $\frac{|x^4|}{x^4}$ is bounded and $4x^3$ approaches $0$.
Something similar could be done with $|x|^4$.
