# Where is the function $f(x) = |x| + |x+1| + e^x$ not differentiable

While plotting the function mentioned below using a graphing software quickly gives the answer, I am unable to understand how one must solve it. I have studied some properties of modulus functions and would have been able to draw the graph if the $$e^x$$ was missing.

Find where the function defined on the real line given by $$f(x) = |x| + |x+1| + e^x$$ is not differentiable.

Could you please let me know how this question must be approached. Moreover, a hint regarding how a question such as the one mentioned above can be solved if $$e^x$$ was replaced by some other function like $$\log(x)$$ or $$\sin(x)$$

• If $f(x) = g(x)$ on a given open interval, where $g(x)$ is differentiable, then $f(x)$ is differentiable on that interval as well. So for example, since $f(x) = 2x+1 + e^x$ for $x > 0$, we know $f(x)$ is differentiable for $x > 0$. Similarly you can show $f(x)$ is differentiable on two other intervals. Finally, show that on the points outside of those three intervals that $f(x)$ is explicitly not differentiable. Jun 1, 2021 at 20:17
• Be aware that it could happen that neither $f$ nor $g$ are differentiable at $x=a$ but their sum is... doesn't happen here mind. Jun 2, 2021 at 1:21

Basically, $$e^x$$ is differentiable everywhere. So this term causes no issues in the differentiability of $$f$$. The absolute value terms each cause an issue at the points where their arguments are zero. If $$e^x$$ was replaced by $$\sin(x)$$ or $$\cos(x)$$, the same argument just given holds. If you replaced $$e^x$$ by $$\log(x),$$ then the same argument holds $$\textit{for x in the domain of the logarithm.}$$

I would start this problem by breaking up the derivative of $$f(x)$$ into multiple terms: $$f'(x) = \dfrac{d}{dx} |x| + \dfrac{d}{dx} |x + 1| + \dfrac{d}{dx} e^x$$ This does a good job of showing that if there are any points where one of the three terms is undefined, $$f'(x)$$ must also be undefined at that point.

As (it sounds like) you know, $$|x|$$ and $$|x+1|$$ cannot be differentiated at $$x=0$$ and $$x=-1$$ respectively. So, neither can $$f(x)$$ at $$0$$ or $$-1$$.

$$e^x$$ is differentiable everywhere so you don't need to worry about it for this problem in particular.

This same reasoning also applies to the function $$g(x) = |x| + |x+1| + \sin x$$ .

But what about $$h(x) = |x| + |x+1| + \log x$$ ?

Just ask yourself: where is the logarithm function not differentiable? Answer: for the range of values $$x \le 0$$ . So $$h'(x)$$ does not exist for $$x \le 0$$ and $$x = 0$$ and $$x = -1$$ , i.e. just $$x \le 0$$.

In this sort of context it's well to be aware that $$|x|$$ is itself not differentiable at $$x = 0$$. The reason is because on the left of $$0$$ the derivative is $$-1$$ and on the right of $$0$$ it's $$1$$.

So knowing that, you can see that at $$x = -1$$ it is also not differentiable, for the same reasons.

But $$e^x$$ is differentiable everywhere.

Then you can use a result which says that if $$f_1$$ and $$f_2$$ and $$f_3$$ are differentiable on an interval $$I$$, then their sum is also differentiable on that interval.

So you have that the function is differentiable on $$x < -1$$, and on $$-1 < x < 0$$, and on $$x > 0$$.

But at the points $$-1$$ and $$0$$ it is not.

I will leave it up to you to make the argument rigorous.

EDIT: As for $$\log (x)$$, be aware that on real $$x$$ it is not defined on $$x \le 0$$. So it can't be differentiable on that part of the real number line.

As for $$\sin x$$, that is of course differentiable everywhere.