The derivative of an absolute value function is a fundamental concept in calculus that often surprises students because it introduces a critical exception to the smooth, differentiable curves typically studied in early differentiation lessons. Also, while the absolute value function, denoted as $f(x) = |x|$, is continuous everywhere, it is not differentiable at the single point where its argument equals zero. Understanding why this happens and how to calculate the derivative everywhere else requires a careful look at the definition of the derivative, piecewise functions, and the geometric concept of a corner or cusp.
Understanding the Absolute Value Function
Before diving into differentiation, Visualize the function itself — this one isn't optional. The absolute value of a real number $x$ represents its distance from zero on the number line, regardless of direction. Algebraically, this is defined as a piecewise function:
$ |x| = \begin{cases} x & \text{if } x \geq 0 \ -x & \text{if } x < 0 \end{cases} $
Graphically, this forms a distinct V-shape with the vertex resting at the origin $(0,0)$. Day to day, for all positive $x$, the graph is the line $y = x$ with a slope of $1$. Now, for all negative $x$, the graph is the line $y = -x$ with a slope of $-1$. This abrupt change in direction at the vertex is the geometric root of the differentiability issue And that's really what it comes down to..
Not obvious, but once you see it — you'll see it everywhere.
The Formal Definition of the Derivative
To determine if a derivative exists at a specific point, we must return to the limit definition of the derivative:
$ f'(a) = \lim_{h \to 0} \frac{f(a+h) - f(a)}{h} $
For this limit to exist, the limit approaching from the left ($h \to 0^-$) must equal the limit approaching from the right ($h \to 0^+$). So if these one-sided limits disagree, the derivative does not exist at that point. This is precisely what happens with the absolute value function at $x = 0$ No workaround needed..
Evaluating the Derivative at $x = 0$
Let $f(x) = |x|$. We evaluate the difference quotient at $a = 0$:
$ f'(0) = \lim_{h \to 0} \frac{|0+h| - |0|}{h} = \lim_{h \to 0} \frac{|h|}{h} $
Now we check the one-sided limits:
-
Right-hand limit ($h \to 0^+$): When $h$ is positive, $|h| = h$. $ \lim_{h \to 0^+} \frac{h}{h} = \lim_{h \to 0^+} 1 = 1 $
-
Left-hand limit ($h \to 0^-$): When $h$ is negative, $|h| = -h$. $ \lim_{h \to 0^-} \frac{-h}{h} = \lim_{h \to 0^-} -1 = -1 $
Because the left-hand limit ($-1$) does not equal the right-hand limit ($1$), the two-sided limit does not exist. Which means, the derivative of $|x|$ at $x = 0$ is undefined.
Derivative for $x \neq 0$
Away from the origin, the function behaves like simple linear functions, making differentiation straightforward using the piecewise definition Worth keeping that in mind..
- For $x > 0$: $f(x) = x$. The derivative is $f'(x) = 1$.
- For $x < 0$: $f(x) = -x$. The derivative is $f'(x) = -1$.
We can combine these into a single piecewise expression for the derivative:
$ \frac{d}{dx}|x| = \begin{cases} 1 & \text{if } x > 0 \ \text{undefined} & \text{if } x = 0 \ -1 & \text{if } x < 0 \end{cases} $
The Signum Function: A Compact Notation
Mathematicians often express the derivative of the absolute value function using the signum function (or sign function), denoted as $\text{sgn}(x)$ or $\text{sign}(x)$. It is defined as:
$ \text{sgn}(x) = \begin{cases} 1 & \text{if } x > 0 \ 0 & \text{if } x = 0 \ -1 & \text{if } x < 0 \end{cases} $
Using this notation, the derivative can be written compactly as:
$ \frac{d}{dx}|x| = \text{sgn}(x) \quad \text{for } x \neq 0 $
Note that while $\text{sgn}(0)$ is typically defined as $0$, the derivative of $|x|$ at $0$ remains undefined. The signum function provides the value of the derivative where it exists, but it does not "fix" the non-differentiability at the origin Easy to understand, harder to ignore. But it adds up..
Alternative Algebraic Derivation
There is a clever algebraic trick to derive the formula $\frac{d}{dx}|x| = \frac{x}{|x|}$ (for $x \neq 0$) without explicitly using piecewise definitions, relying on the identity $|x| = \sqrt{x^2}$ Surprisingly effective..
- Rewrite the function: $f(x) = |x| = (x^2)^{1/2}$.
- Apply the Chain Rule: $ f'(x) = \frac{1}{2}(x^2)^{-1/2} \cdot \frac{d}{dx}(x^2) $
- Simplify: $ f'(x) = \frac{1}{2\sqrt{x^2}} \cdot 2x = \frac{x}{\sqrt{x^2}} $
- Substitute back $\sqrt{x^2} = |x|$: $ f'(x) = \frac{x}{|x|} $
This expression, $\frac{x}{|x|}$, is mathematically equivalent to the signum function for all $x \neq 0$. If $x$ is positive, the fraction is $x/x = 1$. If $x$ is negative, the fraction is $x/(-x) = -1$. At $x=0$, the expression involves division by zero, confirming the derivative is undefined Simple, but easy to overlook. Surprisingly effective..
And yeah — that's actually more nuanced than it sounds.
Generalizing: The Chain Rule with Absolute Values
In practical calculus problems, you will rarely differentiate just $|x|$. In real terms, you will encounter composite functions like $|u(x)|$, where $u(x)$ is a differentiable function of $x$. The Chain Rule is essential here.
If $y = |u|$, then: $ \frac{dy}{dx} = \frac{d}{du}|u| \cdot \frac{du}{dx} = \frac{u}{|u|} \cdot \frac{du}{dx} \quad (\text{for } u \neq 0) $
Example 1: Polynomial inside Absolute Value
Find the derivative of $f(x) = |x^2 - 4|$ That's the part that actually makes a difference. Still holds up..
- Identify $u = x^2 - 4$ and $u' = 2x$.
- Apply the formula: $ f'(x) = \frac{x^2 - 4}{|x^2 - 4|} \cdot 2x $
- Domain Restriction: This derivative is valid for all $x$ except where $x^2 - 4 = 0$, i.e., $x = \pm 2$. At these points, the graph has sharp corners (vertices of the V-shapes), and the derivative is undefined.
Example 2: Trigonometric Function
Find the derivative of $g(x) = |\sin x|$.
- Identify $u = \sin x$ and $u' = \cos x$. 2