# Derivative of absolute function

In the video lecture that I am watching, the instructor compared an example of finding the derivative of the $f(x) = |x|$ vs $f(x) = x|x|$, where $f(x) = x|x|$, derivative is $0$, whereas $f(x) = |x|$, does not have a derivative.

The instructor highlighted that the absolute value function does not have a derivative compared to $f(x) = x|x|$.

If I would to apply the power rule: $f(x) = nx^{n-1}$, where $f(0) = 1*0^{1-1}$. Because 0 to the power of 0 is undefined.

Is it because $0$ to the power of $0$ is undefined, therefore the absolute value function does not has a derivative?

• The absolute value function has a derivative(s) on restricted domains. i.e. f'(x) = -1 for x <0 and f'(x) = 1 for x > 0. However, the absolute value function is not "smooth" at x = 0 so the derivative at that point does not exist. Jun 21, 2017 at 14:14
• The power rule only applies to power functions. Neither $x \mapsto |x|$ nor $x \mapsto x|x|$ are power functions. So it isn't relevant here—you have to go back to the definition to decide if the function has a derivative. Jun 21, 2017 at 14:23
• Possible duplicate of math.stackexchange.com/q/839293/294695 Jun 21, 2017 at 14:23
• @MatthewLeingang in this case the exponent of X must not be equal to zero? x^2 or x^-2 should be a valid power function? Jun 24, 2017 at 10:30
• Yes, $x^2$ and $x^{-2}$ are valid power functions. But your question was about $|x|$ and $x|x|$, right? Those are not power functions. You could insert exponents, but it would have to be $1$, not $0$. That doesn't help with your calculation, though. Applying the power rule to $|x|^1$ gives $1$, times $|x|^0$ (also $1$), times the derivative of $|x|$. Jun 25, 2017 at 10:24

Recall the definition of the derivative as the limit of the slopes of secant lines near a point.

$$f'(x) = \lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$

The derivative of a function at $x=0$ is then

$$f'(0) = \lim_{h\to 0}\frac{f(0+h)-f(0)}{h}= \lim_{h\to 0}\frac{f(h)-f(0)}{h}$$

If we are dealing with the absolute value function $f(x)=|x|$, then the above limit is

$$\lim_{h\to 0}\frac{|h|-|0|}{h} = \lim_{h\to 0}\frac{|h|}{h}$$

If $h$ approaches $0$ from the left, it is negative, so that $|h| = -h$ and the above limit is $-1$. But if $h$ approaches $0$ from the right, it is positive, so that $|h|=h$ and the limit is $1$. The left and right hand limits disagree, so the derivative does not exist at $0$.

• Thank you so much for your clear explanation. Now I am able to understand the rational behind this. Jun 22, 2017 at 13:28
• But, is my understanding and application of the power rule correct? Jun 25, 2017 at 2:46

First compare the graphs:

## $x|x|$

$|x|$ is very sharp at $(0,0)$, so it doesn't have a derivative there.

$x|x|$ has derivatives because $x|x|$ is equal to:

$\begin{cases}y=x^2 & x > 0\\y=0 & x = 0\\y=-x^2& x<0\end{cases}$

And "square" makes $y = x^2$ tangent same of the $y=-x^2$. Same tangents = differentiable.

See those:

Source of tangent animations: Alice Ryhl (https://math.stackexchange.com/users/132791/alice-ryhl), Why is the absolute value function not differentiable at $x=0$?, URL (version: 2014-10-26): https://math.stackexchange.com/q/991559

• Thank you for your animations. It definitely helps a lot in understanding. Jun 25, 2017 at 5:25
• @youcanlearnanything No, they are not mine. See this this Jun 25, 2017 at 10:21

I know you've already accepted an answer on how to find the derivatives of these functions using the definition, but you also have an interesting question on the power rule and how it relates. You asked in the comments above if we could write $$f(x) = x^1 |x^1|$$ and apply the power rule.

Starting with a more basic function, look at $$x \mapsto x$$, which you can write as $$x\mapsto x^1$$. The power rule applied to this function gives $$\frac{d}{dx} x^1 = 1 \cdot x^0 = 1 \cdot 1 = 1$$ This comports with our by-the-definition computation. The two things that prevent applying the power rule directly to $$f(x) = x^1 |x^1|$$ are the product rule and the chain rule.

I don't know if you've learned these yet. In case not: the product rule is the rule by which we can compute derivatives of products of functions. If $$f(x) = g(x) h(x)$$, you might hope that $$f'(x) = g'(x) h'(x)$$. If that were true, differentiating products would be as simple as differentiating sums. But that is not the case. Instead: $$f'(x) = g'(x)h(x) + g(x) h'(x)$$ So even on a product of power functions you can't just take the derivative of each factor. The chain rule is for differentiating a composition function. If $$h(x) = k(\ell(x))$$, you might try $$h'(x) = k(\ell'(x))$$, but in fact that's not true. Instead: $$h'(x) = k'(\ell(x)) \ell'(x)$$

So if you want to write $$f(x) = x^1 |x^1|$$, you can, but it's still not a power function. It's a product of two functions. The first is a power function, but the second is the composition of the absolute value function with a power function. If $$g(x) = \ell (x) = x$$, and $$k(x) = |x|$$, then $$f(x) = g(x)\cdot k(\ell(x))$$

We need the derivative of the absolute value function $$k(x) = |x|$$.
As you have seen from the definition: $$k'(x) = \frac{d}{dx} |x| = \begin{cases} 1 & \text{if x>0;}\\ -1 & \text{if x<0.} \end{cases} = \frac{|x|}{x}$$ For the rest of the derivative, we need the product and chain rules: $$f'(x) = g'(x) k(\ell(x)) + g(x) k'(\ell(x)) \ell'(x)$$ We know $$g'(x) = \ell'(x) = 1$$, so $$g'(x) = 1\cdot |x| + x \cdot \left(\frac{|x|}{x}\right) \cdot 1 = 2 |x|$$

• Thank you for your clear explanation. It took me some time to revisit those rules/topics again and came back to your post for a review. =) Jul 2, 2017 at 11:59

if you meant $$f(x)=x|x|$$ you can compute $$\frac{f(x_0+h)-f(x_0)}{h}=\frac{h|h|}{h}=|h|$$ for $$h\ne 0$$ and $$x_0=0$$ therefore $$\lim_{h\to 0}|h|=0$$ the function has a derivative in $$x=0$$