Erroneous proof that derivative of function is always continuous
Solution 1:
What follows from the MVT is that for every $x \neq x_0$ there exists $\xi$ such that $x < \xi < x_0$ (if $x < x_0$) or $x_0 < \xi < x$ (if $x_0 < x$) and such that $$ \frac{f(x) - f(x_0)}{x - x_0} = f'(\xi). $$
But you want to write an equation with $\lim_{x\to x_0} f'(\xi)$, not just $f'(\xi)$, on the right-hand side. Can we do that? What does it mean?
I suppose with some additional mechanism (axiom of choice?) we might conclude that not only is there a suitable $\xi$ for every $x \neq x_0,$ but there is a suitable function $x \mapsto \xi(x)$ on $\mathbb R \setminus\{x_0\}$ such that $$ \frac{f(x) - f(x_0)}{x - x_0} = f'(\xi(x)) $$ for all $x \neq x_0.$ And now we can write
$$ \lim_{x\to x_0} \frac{f(x) - f(x_0)}{x - x_0} = \lim_{x\to x_0} f'(\xi(x)). $$
But your suspicions about the third equation are still good. If the function $x \mapsto \xi(x)$ were a continuous function, we could conclude that
$$ \lim_{x\to x_0} f'(\xi(x)) = \lim_{\xi\to x_0} f'(\xi). $$
As pointed out in a comment, you don't even need $\xi(x)$ to be continuous; it would be sufficient if $\xi(x)$ had the intermediate value property, that is, not only is $\xi(x)$ strictly between $x_0$ and $x,$ but every value between $x_0$ and $\xi(x)$ is equal to $\xi(t)$ for some $t$ between $x_0$ and $x.$
But there's nothing in the MVT or any reasonable extension of it (like the one that gave us the function $\xi(x)$) that says the function $x \mapsto \xi(x)$ is continuous or has the intermediate value property or any other conceivable property that would justify the third equation. Perhaps the value of $\xi(x)$ "skips over" infinitely many real numbers as $x$ approaches $x_0.$ Perhaps the values of $f'$ evaluated at those "skipped" numbers do not converge to the limit $f'(x_0).$
That's what happens with the function $$ f(x) = \begin{cases} x^2 \sin\left(\dfrac1x\right) & x \neq 0, \\ 0 & x = 0 \end{cases} $$ when $x_0 = 0.$ We know that $f'(0) = 0$ (see Show that the function $g(x) = x^2 \sin(\frac{1}{x}) ,(g(0) = 0)$ is everywhere differentiable and that $g′(0) = 0$), and it is true that as $x$ approaches $0$ from above (for example) there is always a $\xi$ such that $x_0 < \xi < x$ and $$ \frac{f(x) - f(x_0)}{x - x_0} = f'(\xi). $$
But in any neighborhood of $0$ there are other numbers $x$ such that $f'(x) > \frac12$ and numbers $x$ such that $f'(x) < -\frac12,$ and it is not possible that $f'(x)$ could converge to any limit as $x$ approaches $0$.
As $x$ approaches $0,$ the MVT just happens to pick and choose small values of the derivative $$ f'(\xi) = 2\xi \sin\left(\dfrac1\xi\right) - \cos\left(\dfrac1\xi\right) $$ where $0 < \xi < x$ and skips over the ones that are too large -- that is, it skips the values of $f'(\xi)$ that prevent the limit from existing.
Working backward from a counterexample is a way to find the flaws in a "proof" like this one. What is it about the counterexample that the "proof" is not accounting for? In the counterexample above, it's all the peaks and troughs of $f'(x)$ in the neighborhood of $x_0 = 0.$ The MVT keeps picking $\xi$ near the $x$ axis and ignoring the parts of $f'(x)$ that cause non-convergence. And this points directly to the flaw in the third equation.
Solution 2:
The key here is that whenever the derivative exists in a neighborhood of $x_0$ (including at $x_0$) there is always a sequence $x_n\to x_0$ such that $f′(x_n)\to f′(x_0)$. The sequence $x_n$ can be made by the values of $\xi$ obtained from mean value theorem. But one can't guarantee that this works for every sequence tending to $x_0$. Thus the limit of $f′(x)$ may not exist even though $f′(\xi)$ tends to a limit as $x\to x_0$.
You have correctly identified the invalid argument used in the proof in question. Let us analyze the situation in more detail and with some rigor.
The value $\xi$ obtained from mean value theorem is dependent on $x$ and if we use some particular value of $\xi$ then we can very well think of $\xi$ as a function of $x$ so let $\xi=g(x) $ and we have a further constraint that $\xi$ lies between $x$ and $x_0$ so that $g(x) \to x_0$ as $x\to x_0$.
It is given that $\lim_{x\to x_0}f'(g(x))$ exists and equals $f'(x_0)$. Does that mean that $\lim_{y\to x_0}f'(y)=f'(x_0)$ via the substitution $y=x_0$? No!!!
The rule of substitution in limits works in reverse. If it were given that $f'(x) \to f'(x_0)$ as $x\to x_0$ then we could replace $x$ with some other function like $g(x) $ where $g(x) \to x_0$.
Let's get to the $\epsilon$ stuff to see the real problem. For every $\epsilon>0$ we have a $\delta >0$ such that $0<|x-x_0|<\delta$ implies $|f'(g(x)) - f'(x_0)|<\epsilon$. Now consider the set $A_{\delta} $ of all the values of $g(x) $ when $0<|x-x_0|<\delta$. The fact that $g(x) \to x_0$ ensures that the set $A_{\delta}$ is contained in some neighborhood of $x_0$ and more importantly given any neighborhood of $x_0$ we can make $A_{\delta}$ contained in that neighborhood by taking suitable $\delta$.
The problem is however that one can't guarantee that $A_{\delta}$ itself becomes a neighborhood of $x_0$ and can't capture the essence of an arbitrary neighborhood of $x_0$ which is very crucial when we try to do the substitution $y=g(x) $ and analyze the behavior of $f'(y) $ in neighborhood of $y=x_0$.
The expression $\lim_{y\to x_0}f'(y)$ deal with all values of $y$ in arbitrary neighborhoods of $x_0$ but $\lim_{x\to x_0}f'(g(x))$ deals with all values of $y$ of a very specific form $y=g(x) $ in arbitrary neighborhoods of $x_0$. Clearly the first expression is more general (inclusive) than the second expression and it is quite possible that the first one does not exist and the second one exists. The rule of substitution in limits says that if the first limit exist then the second one also exists with same value. The proof in question was trying to do the reverse.
Let us also look at a few simple examples. If $x\to 0$ and $g(x) = x^2$ then $y=g(x) $ only deals with positive values of $y$ and does not make a full neighborhood of $y=0$. But $g(x) =x^3$ does the job and things would work fine.