Find whether the function is differentiable at x = 1 and x = 2
$f(x)=\left\{\begin{array}{cc}x & x \leq 1 \\ 2-x & 1 \leq x \leq 2 \\ -2+3 x-x^{2} & x>2\end{array}\right.$
$f(x)=\left\{\begin{array}{cc}x & x \leq 1 \\ 2-x & 1 \leq x \leq 2 \\ -2+3 x-x^{2} & x>2\end{array}\right.$
$\Rightarrow f^{\prime}(x)=\left\{\begin{array}{cc}1 & x \leq 1 \\ -1 & 1 \leq x \leq 2 \\ 3-2 x & x>2\end{array}\right.$
Now,
$\mathrm{LHL}=\lim _{x \rightarrow 1^{-}} f^{\prime}(x)=\lim _{x \rightarrow 1^{-}} 1=1$
$\mathrm{RHL}=\lim _{x \rightarrow 1^{+}} f^{\prime}(x)=\lim _{x \rightarrow 1^{+}}-1=-1$
Since, at $x=1, \mathrm{LHL} \neq \mathrm{RHL}$
Hence, $f(x)$ is not differentiable at $x=1$
Again,
$\mathrm{LHL}=\lim _{x \rightarrow 2^{-}} f^{\prime}(x)=\lim _{x \rightarrow 2^{-}}-1=-1$
$\mathrm{RHL}=\lim _{x \rightarrow 2^{+}} f^{\prime}(x)=\lim _{x \rightarrow 2^{+}} 3-2 x=3-4=-1$
Since, at $x=2, \mathrm{LHL}=\mathrm{RHL}$
Hence, $f(x)$ is differentiable at $x=2$