Why is this counterexample to an established result wrong?

74 Views Asked by At

It is a well known fact that, for a real function $f$, if $f'(x)$ has a limit as $x\to x_0$, then $f$ is differentiable at $x_0$. In fact, there has been some questions on this site about proving this fact. However, consider the function $$f(x)=\begin{cases} x, x\neq 0 \\ 1, x=0 \end{cases}.$$ It seems to me that the condition is satisfied: $f'(x)=1$ everywhere except $x=0$ and so $\lim\limits_{x\to 0}f'(x)=1$. However this function is clearly not differentiable at $0$. Where did I go wrong in this reasoning, or is there perhaps an extra constraint on the function $f$ (maybe it has to be surjective)?