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$$...

• ... which is exactly what $\frac{x}{\lvert x\rvert}$ is.
– user239203
Jun 19, 2020 at 21:21
• By definition of absolute value, $|x|=x$ if $x\ge0$ and $|x|=-x$ otherwise. So $\frac{|x|}x=\frac x{|x|}=\pm1$ depending on the sign of $x$, and undefined if $x=0$. Jun 19, 2020 at 21:21
• And it is, use the definition of absolute value Jun 19, 2020 at 21:21
• Yes because if x<0, |x|=-x is decreasing. Jun 19, 2020 at 21:21
• Just think about what the function $x/|x|$ does, and consider the derivative of $|x|$ when $x>0$ and when $x<0$. Out of curiosity, why did you include "induction" among the tags? Jun 19, 2020 at 21:29

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}.$$

• I was typing my answer from mobile while you posted your answer. I didn't see it, otherwise I would have not posted mine (since it is just the 1-dimensional case) +1 :) Jun 19, 2020 at 21:48

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|}$$

• Interesting, but asking for trouble, I think, insofar as it changes the issues to some other implicit/concealed issues... Jun 19, 2020 at 21:39

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$$

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$$.

Since $$|x|^2=x^2\$$ we get $$\ 2x=(x^2)'=(|x|^2)'=2|x||x|'\$$ thus $$\ |x|'=\dfrac{x}{|x|}$$ for $$x\neq 0$$.