# 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

## 2 Answers

$$\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$.

• I'd like to ask you; do you mean we substitute by f(x+h) by either side definition depending on whether h tends to 0 from + 0r - side BUT WE SUBSTITUTE IN BOTH LIMITS BY THE SAME F(X) DEPENDING ON WHERE THE POINT IT SELF IS DEFINED?? – Eng_Boody Sep 29 '14 at 16:08
• another question : lim x->0+ (h^2 -1 )/h = lim x->0+ (h - 1/h) isn't 0 - 1/0 = -inf not inf the negative here ?? – Eng_Boody Sep 29 '14 at 16:10
• @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

Whether or not this will help you depends on what the exact posing of the problem is, but you might find it helpful to recall that a function that is not continuous at a point cannot be differentiable at that point.

• I know what you said quite well but how to show that using the definition – Eng_Boody Sep 29 '14 at 15:18