# Differentiability of a Piecewise Function $f(x)$ based on the continuity of $f(x)$ and $f'(x)$

I know that, in order for a function $$f(x)$$ to be differentiable at a value $$x=a$$, the derivative $$f'(a)$$ must exist, i.e. $$\lim\limits_{x \to a} \frac{f(x)-f(a)}{x-a}$$ must exist.

So, one would use the left- and right-hand limits in order to determine the differentiability at $$a$$ of a piecewise function such as:

$$f(x) = \begin{cases} g(x), & \text{if x\geqslant a} \\ m(x), & \text{if x

But, I have seen most examples online and in textbooks that state that this function can be shown to be differentiable by showing that: (i) The function $$f(x)$$ is continuous at $$a$$ and (ii) The left- and right-hand derivatives at $$a$$ are equal. (in other words, $$g'(a) = m'(a)$$)

I don't believe that these conditions are sufficient to show that $$f(x)$$ is differentiable at $$a$$. For example:

$$f(x) = \begin{cases} x^2\cos(\frac{1}{x}), & \text{if x\geqslant 0} \\ x^2\sin(\frac{1}{x}), & \text{if x<0} \end{cases}$$

This function is continuous at $$x=0$$ (where both limits are 0), and the limits of the difference quotients from the definition both equal 0 as well (for example, $$\lim\limits_{x \to 0}\frac{x^2\sin(\frac{1}{x})}{x-0}$$=0 by the squeeze theorem), but the left and right-hand derivatives "at 0" are undefined since the resulting derivatives of both pieces of the function do not have 0 in their domains. (for example, $$\sin(\frac{1}{x})+2x\cos\frac{1}{x}$$ is undefined at $$x=0$$)

So, my question is, in what situations are the two conditions that I listed sufficient? When can one conclude that a function is differentiable at a value by examining continuity of the function and its derivative at that value? Because sometimes that is much simpler than attempting to use the definition (as in the example below at the value $$x=1$$):

$$f(x) = \begin{cases} (x^2-2)^5, & \text{if x<1} \\ -1, & \text{if x=1} \\ -\sqrt{3x-2}+13x-13 & \text{if x>1} \\ \end{cases}$$

(In this case, differentiating the functions that define the left- and right- pieces of the piecewise function and then finding their values at $$x=1$$ is must easier than using the definition, which involves factoring a 10th degree polynomial, which is tedious)

• Would it be correct to say that a third condition would be: (iii) if the left- and right-hand derivatives exist and are equal, the function is differentiable, otherwise: If either limit does not exist, then this method is inconclusive and the definition must be used? – analysischallenged Oct 30 '18 at 1:30
• After doing some research and some thinking, I've come up with the following: If f is a function that is continuous at a, and the derivative of f is continuous at a, then f is differentiable at a. If f is a function that is not continuous at a, then f is not differentiable at a. If if is a function that is continuous at a but the derivative of f is not continuous at a, then no conclusion can be made about the differentiability of f at a. Does this sound correct? – analysischallenged Oct 30 '18 at 2:50