Why is $|x|'=\frac{x}{|x|}$? Why is $|x|'=\frac{x}{|x|}$ ?
May someone explain this clearly? If $x>0$ then it should be 1, and if $x<0$ then it's $-1$...
 A: Well, for a full answer, let's deal with this problem in $n$ dimensions. Let $\mathbf{x}=(x_1,...,x_n)=\sum_{i=1}^{n} x_i \widehat{\mathbf{e}_i}$ and $\Vert\mathbf{x}\Vert = \sqrt{\sum_{i=1}^{n} {x_i}^2}$ Then
$$\nabla \Vert\mathbf{x}\Vert = \sum_{i=1}^{n} \frac{\partial \Vert\mathbf{x}\Vert}{\partial x_i} \widehat{\mathbf{e}_i}$$
Using the chain rule,
$$\frac{\partial \Vert\mathbf{x}\Vert}{\partial x_i} = \frac{1}{2\sqrt{\sum_{i=1}^{n} {x_i}^2}} {2 x_i}$$
$$=\frac{x_i}{\Vert\mathbf{x}\Vert}$$
Thus
$$\nabla \Vert\mathbf{x}\Vert = \sum_{i=1}^{n} \frac{x_i}{\Vert\mathbf{x}\Vert} \widehat{\mathbf{e}_i}$$
$$= \frac{\mathbf{x}}{\Vert\mathbf{x}\Vert}.$$
A: You may also want to consider this alternative derivation. Write the modulus as $|x| =\sqrt{x^2}$. Therefore, using the chain rule:
$$
\frac{d}{dx}|x| = \frac{2x}{2\sqrt{x^2}} = \frac{x}{|x|}
$$
A: You can derive this equation by writing the absolute value as $|x| =\sqrt{x^2}$. From here we see that
$$
\frac{d}{dx} |x| = \frac{d}{dx} \sqrt{x^2} = \frac{1}{2 \sqrt{x^2} } \left( \frac{d}{dx} x^2 \right) =  \frac{2x}{2 \sqrt{x^2} }  =  \frac{x}{\sqrt{x^2} } =     \frac{x}{|x|}
$$
where we use the chain rule. Notice that the function $|x|$ is differentiable on $\mathbb{R}\setminus\{0\}$, which means that in our derivation above $x \neq 0$, which is why we can have an $x$ in the denominator.
You can see that this is consistent with the equation
$$
|x|'=\begin{cases}1 & \text{ if } x > 0\\ -1 & \text{ if } x <0\end{cases}
$$
Since if $x>0$, then $|x| =x$, this means that
$$
\frac{x}{|x|} = \frac{x}{x}  = 1
$$
And similarly, for $x<0$ we have $|x| = -x$, so we get
$$
\frac{x}{|x|} = \frac{x}{-x}  = -\frac{x}{x} = -1
$$
A: Note that
$$|x|=\begin{cases}x & \text{ if } x \geq 0\\ -x & \text{ if } x <0\end{cases}$$
The function has a derivative on $(-\infty, 0) \cup (0,\infty)$ and is given by
$$\frac{d}{dx}|x|=\begin{cases}1 & \text{ if } x > 0\\ -1 & \text{ if } x <0\end{cases}.$$
This is just the function $\frac{|x|}{x}$ (see the function definition of $|x|$ given above) for all $x \neq 0$.
A: Since $|x|^2=x^2\ $ we get $\ 2x=(x^2)'=(|x|^2)'=2|x||x|'\ $ thus $\ |x|'=\dfrac{x}{|x|}$ for $x\neq 0$.
