# Derivative of |x|

1. Jul 19, 2014

1. The problem statement, all variables and given/known data
Find $$\frac{\text{d}}{\text{d}x}|x|$$

2. Relevant equations

3. The attempt at a solution
I know that $\frac{\text{d}}{\text{d}x}x=1$ but it's $|x|$. For $x>0$, derivative is 1 and for $x<0$, derivative is -1.

And what's the derivative at $x=0$? $0$?

2. Jul 19, 2014

### Vibhor

Right .

There is no derivative at x=0 . The function is not differentiable at x=0 .

3. Jul 19, 2014

### Fightfish

To be a little bit more explicit - the derivative, formally, is defined in terms of a limit. Hence, if the left and right limits do not agree with each other, then the limit (and derivative) is undefined and do not exist at that particular point.

4. Jul 19, 2014

### Fredrik

Staff Emeritus
$\frac{|0+h|-|0|}{h}=\frac{|h|}{h}$ goes to +1 as h goes to 0 from the right, and goes to -1 as h goes to 0 from the left. So the limit as h goes to 0 doesn't exist. This means that the derivative of the absolute value function is undefined at 0.

This function isn't differentiable (meaning "differentiable at x for all x in its domain"), but it's differentiable at x for all non-zero real numbers x.

The derivative at some other point in the domain is easy to find using the definition of the absolute value function. Start by writing that down.

Edit: I wrote this before I saw the other replies above.

Last edited: Jul 19, 2014
5. Jul 19, 2014

### HakimPhilo

Here's another way to think about it: it is not hard to see that the derivative of $|x|$ represents the sign of $x$ which is $1$ if $x\gt0$ and $-1$ if $x\lt0$, but what is the sign of $0$ ?

6. Jul 19, 2014

### matineesuxxx

There is a way of defining the absolute value function in a way such that you may easily compute the derivative if you know the chain rule:

$$|x| = \sqrt{x^2}$$

7. Jul 19, 2014

### micromass

Staff Emeritus
And yet another way of seeing things. The derivative is closely associated the the angle that the tangent line makes with the X-axis. So the existence of the derivative at a point is equivalent to saying that there is a (non-vertical) tangent line at that point. You can see from the graph of the absolute value

that it is not at all clear what the tangent line at zero is supposed to be. There are many possible candidates of a tangent line at zero, and none really works that well. This illustrates the non-differentiability of the absolute value in zero.

8. Jul 19, 2014

### matineesuxxx

Clever. I like that.

9. Jul 20, 2014

Thanks everyone, I think I get it now.

10. Jul 20, 2014

### 1MileCrash

Which is how I recommend always defining absolute value. Such a simple expression need not be convoluted with if thens and piecewise representations.

I also recommend the OP simply differentiate $$|x| = \sqrt{x^2}$$

11. Jul 20, 2014

Good recommendation . Thanks.

12. Jul 20, 2014

### Fredrik

Staff Emeritus
That's the easiest way. An alternative is to use that if f(y)=g(y) for all y in an open interval (a,b) that contains x, then f'(x)=g'(x).

Define f by f(x)=|x| for all x. Let z>0 be arbitrary. Let a and b be real numbers such that 0<a<z<b. Define g by g(x)=x for all x. For all x in (a,b), we have $f(x)=g(x)$. This implies that f'(z)=g'(z)=1.

This way we find f'(z) for all z>0. A very similar argument finds f'(z) for all z<0.