# Why is $|x|$ not differentiable at $x=0$?

The definition of a derivative is the slope of a function tangent to a point. It is also defined as $$\lim_{h\to0} \frac{f(x+h)-f(x)}{h}$$ If we apply this to $f(x)= |x|$, we get that it is $\lim\limits_{h\to 0} \dfrac{|h|}{h}$, which is undefined. However, if we look at the graph of $|x|$, we see that there can exist a tangent line at x=0, with slope 0. So why is the derivative undefined instead of 0?

• @MathN00b: What is your definition of a "tangent line"? :) Jan 18, 2015 at 20:26
• A line that touches a function at exactly 1 point in the neighborhood of the function.
– Teoc
Jan 18, 2015 at 20:27
• then there are infinitely many tangents for x=0 Jan 18, 2015 at 20:28
• This is not the definition of a tangent line.
– Did
Jan 18, 2015 at 20:28
• @MathN00b: By your definition, any line that crosses a graph would also be considered tangent to it. Informally, a tangent line at a point is the (that is, the unique) line that a graph looks like when you zoom-in really-really-REALLY closely on that point. If the graph doesn't look like a line up-close to a point, then it simply has no tangent there. The graph of $|x|$ doesn't look like a line at $x=0$; no matter how closely you zoom-in on $(0,0)$, the graph will look like a "V".
– Blue
Jan 18, 2015 at 20:43

Let $f(x) = |x|$. For $x > 0$, the gradient is $1$, whereas for $x < 0$, the gradient is $-1$. At $x = 0$, you have infinitely many lines, which are represented by the subgradient $[-1,1]$.
• @Did Sir, please explain why not to use "Infinitely many tangent lines"? If not Infinitely many then how many? Can't saying that, there is no tangent line implies there is No right hand and No left hand derivative at that point? (But clearly i think both right hand derivative and left hand derivative exists at $x=0$ for f(x)=|x|$) elaborate please. Dec 11, 2020 at 15:47 The following expressions could all be "tangent" lines of$|x|$at$x=0if one were to use a naive definition of tangent: \begin{align} y_1(x) &= \frac12x\\ y_2(x) &= 0\\ y_3(x) &= -\frac13x \end{align} since they all have exactly the point(0,0)$in common with$|x|$. So the derivative of$|x|$at$x=0$should be$1/2$,$0$, and$-1/3$? A tangent line only really makes sense as a limit of secant lines which you see by your limit does not make sense for$|x|$at$x=0$. By the way, the weak derivative of$|x|$is actually the function you described, which is$-1$when$x<0$,$0$when$x=0$, and$1$when$x>0$. Consider$f(x)=x$and$f(x)=-x$separately. Clearly the equation of the derivative has a discontinuity at$x=0$. • Yes, but why is it not defined to be$0$at$x=0$? With the limit definition I see it does not exist, but not with the slope of tangent definition. – Teoc Jan 18, 2015 at 20:26 • It is$0$at$f(x)=0$. This doesn't solve the discontinuity problem. Why the downvote by the way? – Alex Jan 18, 2015 at 20:27 • I meant the derivative at$x=0$And it is because it does not answer my question. – Teoc Jan 18, 2015 at 20:28 • I think it does. The function in your question is not differentiable at$x=0$because the derivative is not continuous at$x=0$, hence the derivative does not exist. – Alex Jan 18, 2015 at 20:29 • "The function in your question is not differentiable at x=0 because the derivative is not continuous at x=0, hence the derivative does not exist." Ouch! The derivative function could have a jump and still exist at the location of the jump. – Did Jan 18, 2015 at 20:31$f(x)=|x|=\begin{cases} x \text{ if } x>0\\ 0 \text{ if } x=0\\ -x \text{ if } x<0 \end{cases}\lim_{x\to 0^-}\frac{|x|}{x}=\lim_{x\to 0^-}=\frac{-x}{x}=-1$but similarly if we check the right hand limit, we see that we get$\lim_{x\to 0^+}\frac{|x|}{x}=1$, and since$1\neq -1$, we don't have have a derivative at the point$x=0$. • Yes, but why is it not defined to be$0$at$x=0$? With the limit definition I see it does not exist, but not with the slope of tangent definition. – Teoc Jan 18, 2015 at 20:27 • You might want to see this: math.stackexchange.com/questions/166474/… Jan 18, 2015 at 20:30 What does "tangent line" mean? Intuitively, it means a line that provides a good linear approximation to the function near that point. More precisely, suppose$f: \mathbb{R} \to \mathbb{R}$is a function,$L: \mathbb{R} \to \mathbb{R}$is a function whose graph is a line, and$p \in \mathbb{R}$is a point. We say "$L$is tangent to$f$at$p$" if and only if, as$x \to p$, we have $$f(x) = L(x) + o(x - p).$$ In other words, the difference between$f(x)$and$L(x)$shrinks faster than linearly as$x$approaches$p$. (One can check that this is equivalent to the usual definition of derivative; however, this formulation also generalizes more readily to higher dimensions.) The reason$f(x) = \lvert x \rvert$has no tangent line at$x = 0$is that there is no such "good linear approximation". For example, consider the line$L(x) = 0$with slope zero: we have$f(x) - L(x) = \lvert x \rvert$, which shrinks linearly as$x$approaches zero. Similarly, if we chose$L(x) = -x$, then we'd have$f(x) - L(x) = \lvert x \rvert + x$, which is equal to$2x$, a linear function, for$x > 0$. If you draw the graph of the equation, you will get a v-shaped configuration with the vertex located at x=0, y=0. If you try to put a tangent at that vertex point, you will see that the line can take on one of innumerable slopes and still be "touching at one point". It's undefined. • "If you try to put a tangent at that vertex point, you will see that the line can take on one of innumerable slopes and still be "touching at one point"" That's true also for$f(x) = x^3$at$x = 0$. So your argument is unconvincing. Jan 20, 2015 at 2:14 • No Peter. You are wrong. dy/dx would be 3x^2. At x=0 there is one and only one tangent. That would be a tangent with slope = 0 Jan 20, 2015 at 2:26 • First, please do not call me "Peter". Second: the point of my comment is that the function I gave has a tangent line but satisfies the property that I quoted: namely, there is more than one line passing through the point$(0,0)$which intersects the curve at only one point. Therefore this "touching at one point" business cannot be the definition of the tangent line. For another kind of counterexample, consider$f(x) = x^2 \sin(1/x)\$. Jan 20, 2015 at 2:55