Show that f(x) = |x − 2| is continuous but not differentiable at x = 2.
Given: $f(x)=|x-2|= \begin{cases}x-2, & x \geq 2 \\ -x+2, & x<2\end{cases}$
Continuity at x=2: We have,
$(\mathrm{LHL}$ at $x=2)$$(\mathrm{LHL}$ at $x=2)$
$=\lim _{x \rightarrow 2^{-}} f(x)$
$=\lim _{h \rightarrow 0} f(2-h)$
$=\lim _{h \rightarrow 0}(-2+h)+2$
$=0$
$(\mathrm{RHL}$ at $x=2)$
$=\lim _{x \rightarrow 2^{+}} f(x)$
$=\lim _{h \rightarrow 0} f(2+h)$
$=\lim _{h \rightarrow 0} 2+h-2$
$=0$
and $f(2)=0$
Thus, $\lim _{x \rightarrow 2^{-}} f(x)=\lim _{x \rightarrow 2^{+}} f(x)=f(2) f(2)$.
Hence, $f(x)$ is continuous at $x=2$.
Differentiability at $x=2$ : We have,
(LHD at $x=2$ )
$=\lim _{x \rightarrow 2^{-}} \frac{f(x)-f(2)}{x-2}$
$=\lim _{x \rightarrow 2} \frac{(-x+2)-0}{x-2}$
$=\lim _{x \rightarrow 2} \frac{-(x-2)}{x-2}$
$=\lim _{x \rightarrow 2}(-1)$
$=-1$
(RHD at x=2)
$==\lim _{x \rightarrow 2^{+}} \frac{f(x)-f(2)}{x-2}$
$=\lim _{x \rightarrow 2} \frac{(x-2)-0}{x-2}$
$=\lim _{x \rightarrow 2} 1$
$=1$
Thus, $\lim _{x \rightarrow 2^{-}} f(x) \neq \lim _{x \rightarrow 2^{+}} f(x)$
Hence, $f(x)$ is not differentiable at $x=2$