Does the function $f(x) = |x|e^x$ have a derivative at $x = 0$?

506 Views Asked by At

Does the function $f(x) \ = \ |x|e^x$ have a derivative at $x = 0$?

If we split it into two sides

$$f(x) = \begin{cases} xe^x, & \text{if $\geq 0$} \\ -xe^x, & \text{if $x<0$} \end{cases} $$ & $$f'(x) = \begin{cases} (x+1)e^x, & \text{if $x \geq 0$} \\ -(x+1)e^x, & \text{if $x<0$} \end{cases} $$ so

$\lim\limits_{x \to 0^+} \ (x+1)e^x = 1$,

and

$\lim\limits_{x \to 0^-} \ -(x+1)e^x = -1$

so we can say that the function doesn't have derivative a derivative at zero? Is this correct?

4

There are 4 best solutions below

4
On BEST ANSWER

You are correct that the function does not have a derivative at $x = 0$. Since the derivative of $xe^x, x \geq 0$ is defined in the open interval $(0, \infty)$ and the derivative of $-xe^x, x < 0$ is defined in the open interval $(-\infty, 0)$, we cannot write $$f'(x) = \begin{cases} (x + 1)e^x & \text{if $x \color{red}{\geq} 0$}\\ -(x + 1)e^x & \text{if $x < 0$} \end{cases} $$ What you should have written is $$f'(x) = \begin{cases} (x + 1)e^x & \text{if $x > 0$}\\ -(x + 1)e^x & \text{if $x < 0$} \end{cases} $$ then tested the left- and right-sided limits, as you later did, to determine whether $f'(0)$ exists.

1
On

$f$ is not differentiable at $x=0$ because $$ \frac{f(x)-f(0)}{x-0} = \frac{|x|e^x}{x} = \begin{cases} e^x & \text{if $x > 0$}\\ -e^x & \text{if $x < 0$} \end{cases} $$ does not have a limit for $x \to 0$.

It is not necessary to compute $f'(x)$ for $x\ne 0$ in order to draw this conclusion, or to investigate its limit behavior at $x=0$. And actually the implication $$ \lim_{x \to 0}f'(x) \text{ does not exist } \implies \text{ $f$ is not differentiable at $x=0$ } $$ is wrong, as the following example shows: $$ f(x) = \begin{cases} x^2 \cos(\frac 1x) & \text{if $x \ne 0$}\\ 0 & \text{if $x = 0$} \end{cases} $$

It is however true that if $f'(x)$ has both left-sided limit and right-sided limit at $x=0$, and if those one-sided limits are different, then $f'(0)$ does not exist. That follows e.g. from the “intermediate value property for derivatives.” But again: it is not needed here.

0
On

The function is not differentiable at $x=0$ because the right derivative is $1$ while the left derivative is $-1$.

However, the function is continuous at $x=0$ thus it is a good example of a continuous function which is not differentiable at a point.

0
On

If $f$ were differentiable at $0$, then so would $f(x)e^{-x} = |x|$ be. That's a contradiction, though.