The absolute value function is defined as
If x is strictly positive (x > 0), then |x| = x, and d|x|/dx = dx/dx = 1.
If x is strictly negative (x < 0), then |x| = -x, and d|x|/dx = d(-x)/dx = -1.
But if x = 0, the derivative doesn't exist!
In order for the derivative of a function f(x) to exist at x = c, the limit
must exist. This limit does not exist for f(x) = |x| and c = 0 because the value of the limit depends on which way x approaches 0.
If x approaches 0 from below (so x < 0), we have
whereas if x approaches 0 from above (so x > 0), we have
But 1 ≠ -1, so the limit and hence derivative doesn't exist at x = 0.
Putting everything together, you can define the derivative of |x| as