Derivative of |x|: Formula, Proof and Examples
The derivative of |x| is x/|x|: 1 for x > 0, -1 for x < 0, and undefined at 0. See the proof, the corner at 0 and the chain rule for |u|.
Powers, roots and polynomials Updated 2 min read
At a glance
- Derivative
- \dfrac{x}{\lvert x\rvert} for x \ne 0
- Piecewise form
- 1 for x > 0, -1 for x < 0
- At x = 0
- Does not exist, the graph has a corner
- Chain rule form
- \dfrac{d}{dx}\lvert u\rvert = \dfrac{u}{\lvert u\rvert}\,u'
- Integral version
- \int \lvert x\rvert\,dx = \frac{x\lvert x\rvert}{2} + C
On this page
The derivative of \lvert x\rvert is \dfrac{x}{\lvert x\rvert}. In plain terms, the slope is 1 to the right of 0, -1 to the left of 0, and there is no slope at 0 itself.
Graph of |x| and its derivative
Proof, piece by piece
Split \lvert x\rvert into its two pieces. For x > 0, \lvert x\rvert = x, so the derivative is 1. For x < 0, \lvert x\rvert = -x, so the derivative is -1. In both cases the answer equals \frac{x}{\lvert x\rvert}: dividing a number by its absolute value just gives its sign.
Why there is no derivative at 0
Look at the difference quotient at x = 0:
From the right (h > 0) this is 1. From the left (h < 0) it is -1. The one-sided limits disagree, so the limit does not exist. The graph has a sharp corner, and no single tangent line fits it. This is the textbook example in the lesson on differentiability.
Another way to write the result is \frac{d}{dx}\lvert x\rvert = \frac{x}{\sqrt{x^2}}, since \lvert x\rvert = \sqrt{x^2}. Differentiating \sqrt{x^2} with the chain rule gives \frac{2x}{2\sqrt{x^2}}, the same formula.
The chain rule version: derivative of |u|
Example 1. \frac{d}{dx}\lvert 3x\rvert = \frac{3x}{\lvert 3x\rvert}\cdot 3, which is 3 for x > 0 and -3 for x < 0.
Example 2. \frac{d}{dx}\lvert x^2 - 4\rvert = \frac{(x^2 - 4)\cdot 2x}{\lvert x^2 - 4\rvert}. For \lvert x\rvert > 2 this is 2x. For \lvert x\rvert < 2 it is -2x. At x = \pm 2 the graph has corners and no derivative.
Example 3. \frac{d}{dx}\lvert\sin x\rvert = \frac{\sin x\cos x}{\lvert\sin x\rvert}, undefined wherever \sin x = 0.
A function built from |x| that is differentiable
Multiplying by x smooths the corner. Take f(x) = x\lvert x\rvert. For x > 0 it is x^2, for x < 0 it is -x^2, so f'(x) = 2\lvert x\rvert. At 0 the difference quotient is \frac{h\lvert h\rvert}{h} = \lvert h\rvert \to 0, so f'(0) = 0 exists. This f is also an antiderivative of 2\lvert x\rvert, which is how the integral of |x| is found.
Common mistakes
- Answering \lvert 1\rvert = 1. The derivative is not 1 everywhere. On the left side it is -1.
- Saying f'(0) = 0. The corner has no tangent line, so the derivative at 0 does not exist.
- Thinking continuous means differentiable. \lvert x\rvert is continuous at 0 but still has no derivative there.
For the function itself, see the absolute value function page.
Practice it now
When derivatives fail
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson