Why is the absolute value function f(x) = |x| not differentiable at x = 0?
answer
- the graph has a sharp corner
- check h > 0 and h < 0 separately
- the quotient is just the sign of h
- one side gives +1, the other -1
- continuous but with no single slope
basics
~10 sAt 0 the difference quotient |h|/h equals +1 for positive h and -1 for negative h, so the two one-sided limits disagree and no single tangent slope exists. The function is still continuous there.
solid answer
~40 sA derivative exists only when the two-sided limit `lim(h -> 0) (f(0+h) - f(0))/h` exists. For `f(x) = |x|` that quotient is `|h|/h`, which is exactly the sign of `h`: it is `+1` for every `h > 0` and `-1` for every `h < 0`. The right-hand limit is `+1`, the left-hand limit is `-1`, they disagree, so the limit does not exist and `f` has no derivative at 0. Everywhere else the derivative is fine: `+1` for `x > 0` and `-1` for `x < 0`. Continuity is unaffected — `|x|` tends to 0 as `x` tends to 0, matching `|0| = 0` — which is why this is the standard demonstration that a continuous function need not be differentiable.
go deeper
Be ready to sketch the V and say in plain words that the slope is -1 on the left and +1 on the right, with no single answer at the corner.
Compute the quotient |h|/h explicitly and state both one-sided limits. The mechanics of why a two-sided limit needs agreement from both sides is what is being tested here.
Point out where kinks show up in real objectives — absolute-value penalties, maxima of smooth pieces — and explain that a computed derivative at the kink returns an arbitrary one-sided value by convention.
Own the tradeoff between smooth and non-smooth formulations: kinked objectives buy properties like exact sparsity or robustness at the cost of needing optimisation machinery that tolerates a missing derivative.
### The function and its shape The absolute value function is defined piecewise: `|x| = x` for `x >= 0` and `|x| = -x` for `x < 0`. Its graph is a V with the vertex at the origin: a straight line of slope `-1` coming down from the left, meeting a straight line of slope `+1` going up to the right. There is no jump and no gap — the two pieces meet at the same height — but the direction of travel changes abruptly. That abrupt change of direction is called a **corner** or a **kink**. ### Away from the origin For `x > 0` the function coincides with the line `y = x` in a whole neighbourhood of that point, so its derivative there is `1`. For `x < 0` it coincides with `y = -x`, so its derivative is `-1`. Compactly, `d/dx |x| = sign(x)` for `x` not equal to 0. Notice that this derivative function is itself discontinuous at the origin: it jumps from `-1` to `+1` with nothing in between. ### At the origin Apply the definition directly. With `f(0) = 0`: ``` (f(0 + h) - f(0)) / h = |h| / h ``` For `h > 0`, `|h| = h`, so the quotient is `h/h = 1`. For `h < 0`, `|h| = -h`, so the quotient is `-h/h = -1`. The quotient therefore never settles: it is pinned at `+1` on one side and `-1` on the other, no matter how small `h` becomes. - Right-hand derivative: `lim(h -> 0+) |h|/h = +1` - Left-hand derivative: `lim(h -> 0-) |h|/h = -1` A two-sided limit exists only if both one-sided limits exist **and are equal**. Here they are both perfectly well defined and simply different, so the two-sided limit does not exist and `|x|` is not differentiable at 0. Geometrically: at the vertex of the V there is no single line that touches the graph and matches its direction. Infinitely many lines pass through the vertex without crossing the graph, and no one of them is the tangent. ### Continuity is untouched Continuity at 0 requires `lim(x -> 0) |x| = |0|`. Both one-sided limits of the *function value* are 0, and `|0| = 0`, so the function is continuous. This is the cleanest counterexample to the belief that a continuous function must be differentiable: you can draw the V without lifting your pen, yet the pen's heading is undefined at the exact moment it passes the vertex. ### The general taxonomy of failure Differentiability can fail at a point in several distinct ways, and being able to name them is what separates a memorised example from understanding: 1. **Corner**: one-sided derivatives both exist but differ — the `|x|` case at 0. 2. **Vertical tangent**: the difference quotient grows without bound. For `f(x) = x^(1/3)` at 0 the quotient is `h^(1/3)/h = h^(-2/3)`, which tends to `+infinity`. The graph has a tangent, but it is vertical, so no finite slope exists. 3. **Discontinuity**: if the function jumps, the numerator does not even tend to 0, so the quotient blows up. A discontinuous point is automatically non-differentiable. 4. **Oscillation**: the quotient keeps swinging between values without approaching any of them. ### Why this matters beyond the classroom Kinks are not exotic. The function `max(0, x)` is `|x|`-like: it is differentiable everywhere except at 0, where its one-sided slopes are 0 and 1. An absolute-value penalty on a parameter has exactly the kink of `|x|` at zero. Any objective built from absolute values, maxima or minima of smooth pieces inherits corners at the points where the active piece changes. Gradient-based methods still handle these, because the set of bad points is small and the function has a well-defined set of *supporting slopes* at each kink, but you must know the kink is there. In practice a computed derivative at exactly 0 will return one of the one-sided values by convention, and the fact that this convention is arbitrary is precisely the point: mathematics gives no preferred answer there. ### The trap to avoid Many candidates say the derivative at 0 is 0 because the graph reaches its minimum there. Reaching a minimum forces the derivative to be 0 only if the derivative exists. At a kink the minimum is real, the derivative is not, and the correct statement is that the minimum is certified by a condition that generalises the vanishing-derivative test rather than by the test itself.
- Is |x| continuous at x = 0?Yes. As `x` approaches 0 from either side, `|x|` approaches 0, which equals `|0|`, so the continuity condition holds exactly. Continuity only demands that the function value has no jump; it says nothing about the existence of a well-defined slope, which is why this function is the classic separator of the two properties.
- What is the derivative of |x| at every point other than 0?It is `sign(x)`: `+1` for `x > 0` and `-1` for `x < 0`, because near any such point the function coincides with a straight line. Note that this derivative function is itself discontinuous at 0, jumping from `-1` to `+1` with no value in between.
- Name another continuous function that fails to be differentiable at exactly one point, for a different reason.`f(x) = x^(1/3)` at 0. It is continuous everywhere, but the difference quotient is `h^(1/3)/h = h^(-2/3)`, which grows without bound as `h` tends to 0. The failure is a vertical tangent rather than a corner: the one-sided slopes agree in direction but are infinite.
Walk down one side of a V-shaped valley and up the other. The path is unbroken, but at the exact bottom your heading flips instantly from downhill-left to uphill-right, so asking which way you are pointing at that instant has no single answer.
saying these in an interview costs you the question
- Claims |x| is discontinuous at 0
- Says the derivative at 0 is 0 because the graph bottoms out there
- Assumes continuity guarantees differentiability
- Reports the derivative as 1 everywhere, ignoring the left branch
- Believes a two-sided limit exists when the one-sided limits differ