# Differentiability of piecewise function using the definition analytically

In the following example particularly $$f(x)= \begin{cases} (x-2)^2 + 5 \quad\text{when x\geq 2} \\ (x-2)^2 + 4 \quad\text{when x<2} \end{cases}$$ for the above function I know quite well graphically that the function is not differentiable as the when lim $h\to 0^-$ of difference quotient is approaching infinity.

But my question now is how to prove that analytically without graph (animation). In other words if we differentiate LHS and RHS at $x=2$ we will find the same value which is $2(x-2)=0$

For example for $f(x)=|x|$ in many videos on the internet, the tutor differentiate both sides independently but if we do this in my example it will yield the same real number which is zero though the left hand limit shouldn't exist?

• @coffeemath pls help – Eng_Boody Sep 29 '14 at 14:48
• We can show that the function is not continuous at $2$. Then automatically we have non-differentiability. – André Nicolas Sep 29 '14 at 14:57
• I know what you said quite well but how to show that using the definition – Eng_Boody Sep 29 '14 at 15:19

$$\frac{d}{dx}f(2)=\lim_{h\to 0} \frac{f(2+h)-f(2)}{h}$$ From the left of $0$, we have $$\lim_{h\to 0^-} \frac{(2+h-2)^2+4-(2-2)^2-5}{h}$$ $$=\lim_{h\to 0^-} \frac{h^2-1}{h}= \lim_{h\to 0^-} h-\frac{1}{h} =\infty$$ And now from the right of $0$, we have $$\lim_{h\to 0^+} \frac{(2+h-2)^2+5-(2-2)^2-5}{h}$$ $$=\lim_{h\to 0^+} \frac{h^2}{h}= \lim_{h\to 0^+} h =0$$ Therefore, $f(x)$ is not differentiable at $x=2$.
• @Eng_Boody, in both limits, $f(2)$ is the same because it doesn't depend on $h$. However for $f(2+h)$, we must notice that $h$ is negative from the left of $0$ and $h$ is positive from the right of $0$. – k170 Sep 29 '14 at 17:35