1

If I define a function as follows:

$$ f(x) = |x| , \: \text{if x $\neq$ 0}, \: \\ \text{and} \\ f(x) = 0 , \: \text{if $x = 0$}. \\ $$

Is $f$ differentiable?

I think it is. The absolute value function is differentiable everywhere except from $x=0$. The way $f$ is defined above, however, its derivative at $x=0$ is $f' = 0$ and thereby $f$ is differentiable.

Am I mistaken?

Jan
  • 5,552
  • 10
  • 19
  • 31
D_Lue
  • 13
  • 1
    its derivative at $x=0$ is $f'=0$ Are you sure? – Matthew Leingang Mar 02 '20 at 15:04
  • 2
    You don't need the second line of the definition: $f(x)=|x|$ is enough, because $|0|=0$. Think about that for a bit, and perhaps you will see where you have gone wrong. – TonyK Mar 02 '20 at 15:05

3 Answers3

1

What you have defined is the absolute value function, since $\lvert 0 \rvert = 0$. But the absolute value is not differentiable at $x = 0$, see for instance here.

Jan
  • 5,552
  • 10
  • 19
  • 31
1

You have some answers already, but let me just point out what might be a source of confusion: if a function is defined piecewise, it can be differentiated piecewise, except at the endpoints which must be checked individually.

For instance, your function is $$ f(x) = |x| = \begin{cases} x & x > 0 \\ -x & x < 0 \\ 0 & x = 0\end{cases} $$ It's tempting to say, “Well, $x$, $-x$, and $0$ are all differentiable functions, so $$ \color{red}{ f'(x) = \begin{cases} 1 & x > 0 \\ -1 & x < 0 \\ 0 & x = 0\end{cases} } $$ and therefore $f$ is differentiable for all $x$.”

But actually, we can only differentiate on the interior of the pieces. That is, $$ f'(x) = \begin{cases} 1 & x > 0 \\ -1 & x < 0 \end{cases} $$ is true. But to check whether $f$ is differentiable at $0$, we need to decide if $$ \lim_{h\to 0} \frac{f(0+h) - f(0)}{h} = \lim_{h\to 0} \frac{|h|}{h} $$ exists. In fact, this limit does not exist.

The moral of the story is that differentiability requires checking not just a point, but a neighborhood around that point. This is why when it can fail to be differentiable at the transition points of piecewise-defined functions.

0

For $t \ne 0$ we have $\frac{f(t)-f(0)}{t-0}= \frac{|t|}{t}.$

Hence $\lim_{t \to 0+0}\frac{f(t)-f(0)}{t-0}=1$ and $\lim_{t \to 0-0}\frac{f(t)-f(0)}{t-0}=-1$.

Consequence: $f$ is not differentiable at $0.$

Fred
  • 77,394