How to see if this piecewise function is differentiable at x = 2, using the definition of derivatives

calculusderivativespiecewise-continuity

I have a function $f(x)$, which is defined as $x^2 + 1$ for $x \leq 2$ and as $4x-3$ for $x > 2$

I found the left hand and right hand derivative at $x = 2$; however, I ended up with the left hand being $4$ and the right hand evaluating to $0$. I used the definition with $(x+h)$ etc. With what I got the function is not differentiable, however, according to the answer key from the text book, this function is differentiable, as $\lim_{h \to 0} = 4$.

Best Answer

$f(x) = \begin {cases} x^2+1 & x\le 2\\4x-4&x>2\end{cases}$

Check continuity:

$\lim_\limits{x\to 2^-} f(x) = \lim_\limits{x\to 2} x^2+1 = 5$
$\lim_\limits{x\to 2^+} f(x) = \lim_\limits{x\to 2} 4x-3 = 5$

The function is continuous. If the function is not continuous, it is not differentiable. So, this is an important check.

Check differentiability (by the definition)

$\lim_\limits{h\to 0^-} \frac {f(2+h) - f(2)}{h}\\ \lim_\limits{h\to 0} \frac {(2+h)^2 + 1 - 5}{h}\\ \lim_\limits{h\to 0} \frac {4+4h + h^2 + 1 - 5}{h}\\ \lim_\limits{h\to 0} \frac {4h + h^2}{h} = 4$

And from the other side...
$\lim_\limits{h\to 0^+} \frac {f(2+h) - f(2)}{h}\\ \lim_\limits{h\to 0} \frac {4(2+h) - 3 - 5}{h}\\ \lim_\limits{h\to 0} \frac {4h}{h} = 4$

The function is differentiable.