This learning article is currently available in English. It is not published as a translated page.

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

d/dx |x| = x/|x| for x≠0; undefined at x=0

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

1
|x|'=1 for x>0
2
|x|'=−1 for x<0
3
|x|' undefined at 0

Worked examples

d/dx |x| at x=2
11

Use the positive branch.

d/dx |x| at x=−2
−1-1

Use the negative branch.

d/dx |x²−1|
2x(x²−1)/|x²−1| away from ±1

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

[|x|]'=1 for all x

Why it fails

The negative branch has slope −1 and zero has a corner.

Correction

x/|x| for x≠0; undefined at 0

Incorrect attempt

[|x²−1|]'=2x everywhere

Why it fails

The sign changes and x=±1 require separate analysis.

Correction

2x(x²−1)/|x²−1| away from ±1

Practice the same idea with a changed structure

Name the rule and its conditions before revealing the reference answer. Explain every sign and factor.

d/dx |x| at x=−2

Check before solving

Use the negative branch.

Reveal the reference answer

Reference answer

−1-1
d/dx |x²−1|

Check before solving

Analyze x=±1 separately.

Reveal the reference answer

Reference answer

2x(x²−1)/|x²−1| away from ±1

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: Derivadas

Frequently 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