# Where is the function h(x)=abs(x-1)+abs(x+2) differentiable?

Aug 18, 2017

It is differentiable everywhere except the zeros of the expressions in absolute value. Everywhere except $1$ and $- 2$

#### Explanation:

The short answer statement is correct. Functions incolving terms that have absolute value tend to be non-differentiable at the zeros of the expression in absolute value. This is not true if the expression as always non-negative or always non-positive.

But let's analyze this function.

$\left\mid x - 1 \right\mid = \left\{\begin{matrix}x - 1 & \text{ " & 1 <= x \\ -x+1 & " } & x < 1\end{matrix}\right.$

$\left\mid x + 2 \right\mid = \left\{\begin{matrix}x + 2 & \text{ " & -2 <= x \\ -x-2 & " } & x < - 2\end{matrix}\right.$

We cut the number line at $- 2$ and at $1$ and look at $h \left(x\right)$ on each of the resulting 3 intervals, $\left(- \infty , - 2\right)$, $\left(- 2 , 1\right)$, and $\left(1 , \infty\right)$.

$x \le - 2$ $\Rightarrow$ $x \le 1$ as well, so

$h \left(x\right) = \left(- x + 1\right) + \left(- x - 2\right) = - 2 x - 1$

$- 2 < x < 1$

$h \left(x\right) = \left(- x + 1\right) + \left(x + 2\right) = 3$

$x > 1$ $\Rightarrow$ $x > - 2$, so

$h \left(x\right) = \left(x - 1\right) + \left(x + 2\right) = 2 x + 1$.

Combining, we have

$h \left(x\right) - \left\{\begin{matrix}- 2 x - 1 & \text{ " & " "x <= -2 \\ " "" "3 & " " & -2 < x < 1 \\ " "2x+1 & " " & " } 1 \le x\end{matrix}\right.$

Differentiating, we get

$h ' \left(x\right) - \left\{\begin{matrix}- 2 & \text{ " & " "x < -2 \\ " "0 & " " & -2 < x < 1 \\ " "2 & " " & " } 1 < x\end{matrix}\right.$

Because the derivatives do not agree at the joints (the left and right derivatives are distinct), the function is not differentiable at the joints.

Although we did not use it, here is the graph of $h$.

graph{abs(x-1)+abs(x+2) [-11.235, 11.265, -1.74, 9.51]}