Piecewise derivatives
Derivative of |x|: Piecewise Rule and the Corner at Zero
Absolute value joins two lines with different slopes. It is continuous at zero, but its left and right derivatives do not agree.

Direct answer
The formula excludes zero; every zero of a composite inside expression needs direct analysis.
When to use derivative of |x|
Choose the method from the top-level mathematical structure before manipulating symbols. Conditions are part of the task, not optional notes.
Ask first 1
Which structure controls the method?
What to do
Use the piecewise definition wherever the expression can change sign.
Ask first 2
Which condition can change the answer?
What to do
The formula excludes zero; every zero of a composite inside expression needs direct analysis.
Ask first 3
How should the result be checked?
What to do
Compare left and right derivatives at every zero of the inside expression.
Use the piecewise definition
For x>0, |x|=x and the derivative is 1.
For x<0, |x|=−x and the derivative is −1.
At zero the one-sided derivatives are 1 and −1, so the ordinary derivative does not exist.
For |g(x)| away from g(x)=0, the chain rule gives g(x)g′(x)/|g(x)|.
Worked examples
Use the positive branch.
Use the negative branch.
Analyze x=±1 separately.
Common mistakes
- • Claiming the derivative is always 1.
- • Using x/|x| at zero.
- • Assuming continuity implies differentiability.
- • Ignoring zeros of the inner function.
Error clinic: locate the first invalid step
Incorrect attempt
Why it fails
The negative branch has slope −1 and zero has a corner.
Correction
Incorrect attempt
Why it fails
The sign changes and x=±1 require separate analysis.
Correction
Practice the same idea with a changed structure
Name the rule and its conditions before revealing the reference answer. Explain every sign and factor.
Check before solving
Use the negative branch.
Reveal the reference answer
Reference answer
Check before solving
Analyze x=±1 separately.
Reveal the reference answer
Reference answer
Try the worked examples in the calculator
Each link opens the matching calculator with the expression, variable and required conditions already filled in.
Open the calculator without a preset: DerivativesFrequently asked questions
Is |x| continuous at zero?+
Yes, but the one-sided derivatives differ.
What is sign(x)?+
For x≠0, sign(x)=x/|x|, matching the derivative of |x|.
Does every zero of g create a corner in |g|?+
Not always; inspect how g crosses or touches zero.
Conclusion
Differentiate absolute value piecewise and treat each zero of the inside expression as a separate differentiability question.
Compare usage plans