On this page
The modulus (or absolute value) function f(x) = |x| returns the non-negative value of x. Its graph is V-shaped, passing through the origin. While this looks simple on the surface, differentiating it requires breaking it down into its component parts and understanding what happens when the direction of a line suddenly snaps.
What is the derivative of mod x?
To differentiate |x|, we can look at its piecewise definition. By definition, the function f(x) = |x| is equal to x when x > 0, and -x when x < 0.
When we differentiate these two straight lines, the derivative is 1 for positive x and -1 for negative x. Instead of writing out a piecewise bracket every time you need the derivative in an exam, mathematicians wrap this up into a single algebraic formula: d|x|/dx = x/|x| for all x ≠ 0. You can also write this identically as |x|/x; both versions will always evaluate to +1 or -1.
This formula correctly captures the flat horizontal lines of the slope on either side of the y-axis.
Why does the derivative of |x| fail at zero?
If you try to substitute x = 0 into our formula x/|x|, you get 0/0, which is mathematically undefined. This algebraic breakdown points to a geometric truth about the shape of the graph.
A derivative measures the instantaneous slope of a curve. As you trace the curve approaching x = 0 from the negative side, the slope is a constant -1. As you approach from the positive side, the slope is a constant +1. According to Wolfram MathWorld, the real derivative is simply not defined at x = 0. Visually, this mismatch in the left-hand and right-hand limits creates a sharp corner (or cusp) at the origin. A single point cannot have a well-defined tangent line if the curve is simultaneously pointing in two different directions.
If you have gaps in your understanding of limits and differentiability, you can use the Fermi Concept Library to revisit each concept and its place in the map. You can also explore removable and jump discontinuities to see how piecewise functions and sharp corners are related to continuity.
How do you find the derivative of |f(x)|?
When you have an algebraic expression inside the modulus, such as y = |x² - 4|, you cannot treat the modulus signs like ordinary parentheses. You must apply the chain rule to peel back the layers.
The chain rule states that to differentiate an outer function containing an inner function, you multiply the derivative of the outer function by the derivative of the inner function.
The outer function is the modulus operation. Its derivative is the inside expression divided by its absolute value.
The inner function is f(x). Its derivative is f'(x).
Multiplying these together gives the general rule for composite modulus functions: d|f(x)|/dx = f(x)/|f(x)| × f'(x).
This formula holds true for all values of x except the roots where f(x) = 0. At those points, the modulus graph will usually have a sharp corner, meaning the derivative will be undefined. This piecewise splitting approach is highly useful for solving modulus equations and inequalities.
A worked example
Let's find the derivative of y = |sin x| with respect to x.
Applying our chain rule formula step by step:
The derivative of the outer modulus layer is sin x / |sin x|.
The derivative of the inner function (sin x) is cos x.
Combining them, we get: d|sin x|/dx = (sin x / |sin x|) × cos x.
This derivative is perfectly valid everywhere except where sin x = 0 (such as x = 0, π, 2π). At these exact roots, the original sine wave crosses the x-axis, and the modulus operation abruptly flips the negative troughs upwards, generating a sharp corner.
If it is hard to picture how the modulus operator flips the negative parts of a wave upwards to create sharp corners, you can use the Fermi Simulation Lab to interact with the curves and watch the slopes change dynamically. For a deeper dive into the formal limit definitions that prove this, read about derivatives from first principles in Class 11.
A checklist for modulus derivatives
When faced with a complex modulus function in an exam setting, use this checklist to avoid common traps:
Identify the roots: First, find where the expression inside the modulus equals zero. Mark these points clearly; your derivative will generally be undefined here.
Apply the chain rule: Use the formula d|f(x)|/dx = f(x)/|f(x)| × f'(x) for all other points on the real number line.
Simplify the sign: Remember that f(x)/|f(x)| is just a formal mathematical way of writing "1 if positive, -1 if negative". You can often simplify your final answer into a piecewise format based on the intervals between the roots to make it easier to read.



