Why is/isn't the derivative of a differentiable function continuous?

The theorem is simply stating that the function \begin{align*} \varphi(x) &= \begin{cases} \frac{f(x) - f(a)}{x - a} & \text{if}\;x\not = a; \\ f'(a) & \text{if}\;x = a \end{cases} \end{align*} is continuous. And it clearly is; the only point to check is $x = a$, and the condition $\lim_{x\to a} \varphi(x) = \varphi(a)$ is exactly the definition of $f'(a)$. The theorem is not claiming that $f = \varphi$ everywhere on $I$.

One of the classic examples of a differentiable function $f$ with $f'$ not continuous is $f(x) = x^2\sin (1/x)$ (with $f(x) = 0$). The derivative \begin{align*} f'(x) &= \begin{cases} 2x \sin (1/x) - \cos (1/x) & \text{if}\; x \not = 0; \\ 0 & \text{if}\; x = 0 \end{cases} \end{align*} exists everywhere, but it is not continuous at $0$.


The point is that $\varphi$ is not $f'$. They just coincide in one point, and it is easy to see that two functions coinciding in one point entails nothing about some relationship of differentiability/continuity etc between one another.


The theorem states that $\varphi(a)=f'(a)$ for this particular value of $a$. It doesn't say that $\varphi(x)=f'(x)$ for all $x$, or indeed for any value of $x$ besides the single value $x=a$. So the fact that $\varphi$ is continuous at $a$ doesn't tell you that $f'$ is continuous at $a$, since continuity depends on the values of the function at points near $a$, not just at $a$ itself.