[Math] Can a non-continuous function be differentiable

calculusderivatives

I learnt that a function is called "differentiable " if the derivative (if it exists) of the function is continuous. Suppose a function $f: \mathbb{R}\to\mathbb{R}$ is differentiable, i.e., $f'(x)$ is continuous. Does that imply that $f(x)$ is also continuous?

I know that the answer is "yes", but cannot understand why. If we define $f(x)$ something like:
$$f(x) =\begin{cases}2 \text{ for all }x\leq5 \\3 \text{ elsewhere} \end{cases}$$

Then $$\lim_{x\to5^+}f'(x)= \lim_{x\to5^-}f'(x)=1$$
although $$\lim_{x\to5^+}f(x)\neq \lim_{x\to5^-}f(x)$$
Doesn't this make $f$ discontinuous but differentiable?

Best Answer

$$\lim_{x\to5^+} f'(x)=\lim_{x\to 5^-}f'(x)=1$$ First of all $1$ should be zero. Secondly, this does not change the fact that $$f'(5)=\lim_{h\to 0} \frac{f(5+h)-f(5)}h$$ is undefined. So, you cant talk about the continuity of $f'$ at $5$.

Also, having left limit equal to right limit only shows the existence of the limit, not the continuity of $f'$. Think about the following: Define $f:[2,4]\to\mathbb{R}$ by $f(x)=0$ if $x\ne3$ and $f(3)=1$. This function satisfies $\lim_{x\to 3^+}f(x)=\lim_{x\to 3^-}f(x)=0$, but, this equality does not mean anything, as $f(x)$ is not equal to that limit.