TITLE: Why is/isn't the derivative of a differentiable function continuous?
QUESTION [12 upvotes]: I am confused about the following Theorem:
Let $f: I \to \mathbb{R}^n$, $a \in I$. Then the function $f$ is differentiable at $a$ if and only if there exists a function $\varphi: I \to \mathbb{R}^n$ that is continuous in $a$, and such that $f(x) - f(a) = (x - a)\varphi(x)$, for all $x \in I$; furthermore, $\varphi(a) = f'(a)$.
I understand the proof of this theorem, but something confuses me. Doesn't this theorem state that the derivative of a function in a point is always continuous in that point, since $f'(a) = \varphi(a)$ is continuous in $a$? This would mean that the derivative of a function is always continuous on the domain of the function, but I have encountered counterexamples. I have probably misinterpreted something; any help would be welcome.

REPLY [3 votes]: 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.