Recall the definition of absolute value:
• If x ≥ 0, then |x| = x
• If x < 0, then |x| = -x
(a) Splitting up f(x) = x |x| into similar cases, you have
• f(x) = x ² if x ≥ 0
• f(x) = -x ² if x < 0
Differentiating f, you get
• f '(x) = 2x if x > 0 (note the strict inequality now)
• f '(x) = -2x if x < 0
To get the derivative at x = 0, notice that f '(x) approaches 0 from either side, so f '(x) = 0 if x = 0.
The derivative exists on its entire domain, so f(x) is differentiable everywhere, i.e. over the interval (-∞, ∞).
(b) Similarly splitting up g(x) = x + |x| gives
• g(x) = 2x if x ≥ 0
• g(x) = 0 if x < 0
Differentiating gives
• g'(x) = 2 if x > 0
• g'(x) = 0 if x < 0
but this time the limits of g'(x) as x approaches 0 from either side do not match (the limit from the left is 0 while the limit from the right is 2), so g(x) is differentiable everywhere except x = 0, i.e. over the interval (-∞, 0) ∪ (0, ∞).