<s>[INST] Let $f(x) = |x − 1| + |x − 2|^3$ for $x\in \mathbb{R}$ . Then examine the differentiability of $f$ at x = 1 and x = 2 and rest of $x\in \mathbb{R}$ . Let $f(x) = |x − 1| + |x − 2|^3$ for $x\in \mathbb{R}$ . Then examine the differentiability of $f$ at x = 1 and x = 2 and rest of $x\in \mathbb{R}$ .
derivative of the function f at a: $f'(a)=\lim\limits_{h\to 0}\dfrac{f(a+h)-f(a)}{h}$
$f'(1)=\lim\limits_{h\to 0}\dfrac{|h| + |h-1|^3-0+1}{h}=\lim\limits_{h\to 0}\dfrac{|h| - (h^3-1-3h^2+3h)-0+1}{h}=0$
Because $\lim\limits_{h\to 0}|h-1|<0$
$f'(2)=\lim\limits_{h\to 0}\dfrac{|1+h| + |h|^3-1-0}{h}=\lim\limits_{h\to 0}\dfrac{1+h + |h|^3-1-0}{h}=0$
Because $\lim\limits_{h\to 0}|1+h|>0$
So, the function is differentiable everywhere. 
I plotted the above curve in geogebra. There is a "kink" at $x=1$. So, it seems that it should NOT be differentiable at $x=1$
Did I solve this correctly ?
 [/INST] For $x=1+h$, i.e $1<x<2$, $f(x)=x-1+(2-x)^3$
$\begin{aligned}
\lim\limits_{x\to 1^+}\dfrac{(1+h-1)+ (2-(1+h))^3-0-1}{h} & = \lim\limits_{h\to 0}\dfrac{h+ (1-h)^3-0-1}{h} \\
& = \lim\limits_{h\to 0}\dfrac{h+ (1-h^3+3h^2-3h)-0-1}{h} \\
& = \lim\limits_{h\to 0}\dfrac{h-h^3+3h^2-3h}{h} \\ 
& = -2
\end{aligned}$
For $x=1-h$, i.e. $x<1$, $f(x)=1-x +(2-x)^3$
$\begin{aligned}
\lim\limits_{x\to 1^-}\dfrac{(1-(1-h))+(2-(1-h))^3-0-1}{-h} & = \lim\limits_{h\to 0}\dfrac{h+(1+h)^3-0-1}{-h} \\
& = \lim\limits_{h\to 0}\dfrac{h+ (1+h^3+3h^2+3h)-0-1}{-h} \\
& = \lim\limits_{h\to 0}\dfrac{h+h^3+3h^2+3h}{-h} \\ 
& = -4
\end{aligned}$
So we see that, $\lim\limits_{x\to 1^+}\dfrac{f(x)-f(1)}{x-1}\neq\lim\limits_{x\to 1^-}\dfrac{f(x)-f(1)}{x-1}$
Hence, the derivative does not exist at $x=1$.
For $x=2+h$, i.e. $x>2$, $f(x)=x-1+(x-2)^3$
$\begin{aligned}
\lim\limits_{x\to 2^+}\dfrac{(2+h-1)+ ((2+h)-2)^3-1-0}{h} & = \lim\limits_{h\to 0}\dfrac{1+h+ h^3-1-0}{h} \\
& = 1
\end{aligned}$
For $x=2-h$, i.e. $1<x<2$, $f(x)=x-1+(2-x)^3$
$\begin{aligned}
\lim\limits_{x\to 2^-}\dfrac{(2-h-1)+ (2-(2-h))^3-1-0}{-h} & = \lim\limits_{h\to 0}\dfrac{1-h+ h^3-1-0}{-h} \\
& = 1
\end{aligned}$
So we see that, $\lim\limits_{x\to 2^+}\dfrac{f(x)-f(2)}{x-2}= \lim\limits_{x\to 2^-}\dfrac{f(x)-f(2)}{x-2}$
Hence, the derivative exists at $x=2$.
Everywhere else, the function is a single polynomial and hence, is differentiable.
</s>