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

Source: https://practicecalculus.com/derivatives/absolute-value-of-x
Updated: 2026-11-06

$$ \frac{d}{dx}\,\lvert x\rvert = \frac{x}{\lvert x\rvert} $$

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

## Key takeaways

- The derivative of $\lvert x\rvert$ is $1$ for $x > 0$ and $-1$ for $x < 0$.
- A compact formula is $\frac{x}{\lvert x\rvert}$, also written $\operatorname{sgn}(x)$.
- At $x = 0$ the left and right slopes disagree, so $\lvert x\rvert$ is not differentiable there.
- $\lvert x\rvert$ is continuous everywhere, so it shows that continuous does not imply differentiable.

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.

$$\frac{d}{dx}\,\lvert x\rvert = \frac{x}{\lvert x\rvert} = \begin{cases} 1, & x > 0 \\ -1, & x < 0 \end{cases}$$

## Graph of |x| and its derivative

```graph
title: 'Graph of y = |x| and its derivative'
caption: 'The V shape has slope $-1$ on the left and $1$ on the right. The derivative jumps at $x = 0$, where it is undefined.'
x: [-4, 4]
y: [-2, 4]
functions:
  - expr: abs(x)
    label: y = |x|
  - expr: abs(x)/x
    label: derivative
    dashed: true
points:
  - [0, 0, 'corner, no 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$:

$$\frac{\lvert 0 + h\rvert - \lvert 0\rvert}{h} = \frac{\lvert h\rvert}{h}$$

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](/learn/calculus-1/the-derivative/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](/rules/chain-rule) gives $\frac{2x}{2\sqrt{x^2}}$, the same formula.

## The chain rule version: derivative of |u|

$$\frac{d}{dx}\,\lvert u\rvert = \frac{u}{\lvert u\rvert}\cdot u', \qquad u \ne 0$$

**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|](/integrals/absolute-value-of-x) is found.

## Common mistakes

1. **Answering $\lvert 1\rvert = 1$.** The derivative is not $1$ everywhere. On the left side it is $-1$.
2. **Saying $f'(0) = 0$.** The corner has no tangent line, so the derivative at $0$ does not exist.
3. **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](/functions/absolute-value-function) page.

## Frequently asked questions

### What is the derivative of |x|?

It is $\frac{x}{\lvert x\rvert}$, which equals $1$ when $x > 0$ and $-1$ when $x < 0$. It does not exist at $x = 0$.

### Why is |x| not differentiable at 0?

The slope from the right is $1$ and the slope from the left is $-1$. The two one-sided limits of the difference quotient are different, so the derivative does not exist.

### What is the derivative of |x| at x = 3?

It is $1$, because near $x = 3$ the function is just $x$.

### What is the derivative of |x - 2|?

It is $\frac{x - 2}{\lvert x - 2\rvert}$: $1$ for $x > 2$, $-1$ for $x < 2$, and undefined at $x = 2$.
