Question:
Write the value of the derivative of $f(x)=|x-1|+|x-3|$ at $x=2$.
Solution:
Given: $f(x)=|x-1|+|x-3|$
$\Rightarrow f(x)=\left\{\begin{array}{lc}-(x-1)-(x-3), & x<1 \\ x-1-(x-3), & 1 \leq x<3 \\ (x-1)+(x-3), & x \geq 3\end{array}\right.$
$\Rightarrow f(x)= \begin{cases}-2 x+4, & x<1 \\ 2, & 1 \leq x<3 \\ 2 x-4, & x \geq 3\end{cases}$
We check differentiability at x = 2
(LHD at x = 2)
$\lim _{x \rightarrow 2^{-}} \frac{f(x)-f(2)}{x-2}$
$=\lim _{h \rightarrow 0} \frac{f(2-h)-f(2)}{2-h-2}$
$=\lim _{h \rightarrow 0} \frac{2-2}{-h}$
$=0$