Why is $f(x)=|x|$ not differentiable?

309 Views Asked by At

Consider the function $f(x)=|x|$, I know that $f$ is not differentiable at $x=0$, but still, when you try to differentiate $f(x)=\sqrt{x^2}$ (which is exactly the same), you get: $f'(x)=\frac{2x}{2\sqrt{x^2}}=\frac{x}{\sqrt{x^2}}=\frac{x}{x}=1$.
How is it possible that the fact that $f$ is not differentiable at $x=0$ did not ruin things up?

5

There are 5 best solutions below

1
On BEST ANSWER

You wrote

$$f'(x)=\frac{2x}{2\sqrt{x^2}}=\color{blue}{\frac{x}{\sqrt{x^2}}=\frac{x}{x}}=1$$

But didn't you say $\sqrt{x^2} = |x|$? Then shouldn't it be $\frac{x}{|x|}$ instead? And is that $1$?

0
On

Well $f(x) = \sqrt{x}$ is defined for all $x \ge 0$, so in $0$ there is only one tangent! Meanwhile if you try to compute the derivative of $g(x) = |x|$ in $0$ you'll get $2$ different tangents ( $-1$ and $+1$).

0
On

What you have written: $$f'(x)=\frac{2x}{2\sqrt{x^2}}=\frac{x}{\sqrt{x^2}}=\frac{x}{x}=1,$$ holds only for $x>0$.

Note that $$ \sqrt{x^2}=\lvert x\rvert. $$ Hence, for $x<0$, we have that $\sqrt{x^2}=-x$, and thus $$f'(x)=\frac{2x}{2\sqrt{x^2}}=\frac{x}{\sqrt{x^2}}=\frac{x}{-x}=-1.$$

0
On

The chain rule states that if $f$ is differentiable at $x_0$ and $g$ is differentiable at $f(x_0)$, then the composition $f(g)$ is differentiable at $x_0$. However, if we consider $x_0 = 0$, then the square root function is not differentiable at $x_0^2$: Thus, the chain rule does not apply to the function $\sqrt{x^2}$.


To see why $|x|$ isn't differentiable at $0$, consider left and right handed difference quotients:

$$\lim_{h \to 0^+} \frac{|h| - |0|}{h} = 1$$

while

$$\lim_{h \to 0^-} \frac{|h| - 0}{h} = -1$$

0
On

First, it is not exactly the same...not even close. In fact:

$$\sqrt{x^2}=|x|:=\begin{cases}\;\;\,x&,\;\;x\ge 0\\{}\\-x&,\;\;x<0\end{cases}$$

Second:

$$\lim_{x\to 0}\frac{|x|-|0|}{x-0}=\lim_{x\to 0}\frac{|x|}x=\lim_{x\to 0}\begin{cases}\frac xx=1&,\;\;x> 0\\{}\\\frac{-x}x=-1&,\;\;x<0\end{cases}$$

so that both one-sided limits defining the assumed derivative at $\;x=0\;$ are different and then the limit, and thus the derivative at zero, of the function doesn't exist.