# Erroneous proof that derivative of function is always continuous

Suppose that $$f:\mathbb{R}\to \mathbb{R}$$ is differentiable on the entire real line. (It is not difficult to give an example when $$f'(x)$$ is not continuous.)

Find the flaw in the following "proof" that $$f'(x)$$ is continuous.

Proof: Let $$x_0$$ be an arbitrary point on $$\mathbb{R}$$ and $$f'(x_0)$$ the derivative of $$f$$ at the point $$x_0$$. By definition of the derivative and Lagrange's(aka MVT) theorem $$f'(x_0)=\lim \limits_{x\to x_0}\dfrac{f(x)-f(x_0)}{x-x_0}=\lim \limits_{x\to x_0}f'(\xi)=\lim \limits_{\xi \to x_0}f'(\xi), \qquad \qquad (*)$$ where $$\xi$$ is a point between $$x_0$$ and $$x$$ and therefore tends to $$x_0$$ as $$x\to x_0$$.

I have some difficulties to point out to the mistake in this "proof". But here is I was thinking.

The first equality in $$(*)$$ is just the definition of the derivative. The second equality follows from MVT. I do not think that the third equality is true. So basically we need to show the following:

If $$\lim \limits_{x\to x_0}f'(\xi)=f'(x_0)$$ then $$\lim \limits_{\xi\to x_0}f'(\xi)=f'(x_0)$$

I was trying to show it via $$\varepsilon-\delta$$ formalist and the fact that for any $$x\in \mathbb{R}$$ so that $$x\neq x_0$$ the $$\xi$$ is in between $$x$$ and $$x_0$$ but I failed.

1. Am I right that the third equality in $$(*)$$ is not valid.
2. And where is the flaw in this "proof"?

EDIT: Suppose that $$\lim \limits_{x\to x_0}f'(g(x))=f'(x_0)$$, where $$g:\mathbb{R}\to \mathbb{R}$$ defined by $$g(x)= \begin{cases} \xi_x, & \text{if } x\neq x_0, \\ x_0, & \text{if } x=x_0, \end{cases}$$ and $$g(x)$$ has Intermediate Value property (every value between $$g(x)$$ and $$x_0$$ is taken somewhere between $$x$$ and $$x_0$$ by $$g$$). Then $$\lim \limits_{y\to x_0}f'(y)=f'(x_0).$$

Remark: I am trying to prove it in a rigorous way via $$\varepsilon-\delta$$ formalism but I have some issues.

My approach: Let $$\varepsilon>0$$ be given then $$\exists \delta>0$$ such that $$\forall x\in \mathbb{R} (0<|x-x_0|<\delta \Rightarrow |f'(g(x))-f'(x_0)|<\varepsilon)$$. I have no idea how to invoke the Intermediate value property to obtain the desired result.

• Comments are not for extended discussion; this conversation has been moved to chat. Apr 15, 2021 at 22:46

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.

• Yes, AC would suffice. For each $x$ the set of suitable $\zeta$ is nonempty, so you can use a Choice function to pick one and only one $\zeta_x$ for each $x$, and thus you get your function. Apr 15, 2021 at 3:17
• You said "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)$. I thought that this is valid if $f'$ is continuous not $\xi(x)$. Am I wrong? Could explain this please?
– ZFR
Apr 15, 2021 at 3:23
• @ZFR: The equality would be valid (for different reasons) if either $f'(x)$ or $\xi(x)$ (or both) were continuous at $x_0$. But that doesn't help when neither is. Apr 15, 2021 at 3:29
• @ZFR: Continuity of $f’(x)$ is of course known to imply that you can “pass the limit through” (in fact, that’s one way to define continuity). Continuity of $\xi(x)$ would also suffice because it would imply the “intermediate value property” (IVP): not only does $\xi(x)$ take a value between $x$ and $x_0$, but every value between $\xi(x)$ and $x_0$ is taken somewhere between $x$ and $x_0$ by $\xi$; that would allow you to deduce that the limit exist, because then $\xi$ couldn’t be “skipping over” the points that mess you up.The IVP would suffice, and is weaker than continuity. Apr 15, 2021 at 3:34
• @ArturoMagidin, thanks for your reply! I've spent some time trying to understand and I guess I know how to prove it when $g(x)$ is continuous (btw we need continuity only at $x_0$, right?). But I have issues in the case when $g(x)$ has Intermediate Value property. I actually added an edit to my post. Please take a look, Arturo.
– ZFR
Apr 15, 2021 at 21:08

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.

The two other answers sufficiently address the initial query of the post and ably explain the problems, and how to find/highlight them by using a known counterexmaple.

In comments, I noted that if we knew that the association from $$x$$ to $$\xi_x$$ were continuous, then the argument would go through, and also noted that the Intermediate Value Property would suffice. This answer is only intended to address this minor point.

Again: $$f(x)$$ is assumed to be everywhere differentiable; we pick $$x_0$$. By the Intermediate Value Theorem, for every $$x\neq x_0$$, there exists $$\xi_x$$ between $$x$$ and $$x_0$$ such that $$f'(\xi_x) = \frac{f(x)-f(x_0)}{x-x_0}.\tag{1}$$ Using AC, we define a function $$g\colon \mathbb{R}\to \mathbb{R}$$ by $$g(x) = \left\{\begin{array}{ll} \xi_x &\text{if }x\neq x_0\\ x_0 &\text{if }x=x_0, \end{array}\right.$$ where $$\xi_x$$ is any point between $$x$$ and $$x_0$$ where $$(1)$$ holds.

In particular, $$f'(x_0) = \lim_{x\to x_0}\frac{f(x)-f(x_0)}{x-x_0} = \lim_{x\to x_0}f'(g(x)).$$

In general, we cannot claim that because $$\lim_{x\to x_0}g(x)=x_0$$ (which it plainly does, by the Squeeze Theorem for example) this implies that $$\lim_{y\to x_0}f'(y)=f'(x_0)$$. It certainly does if $$f'(x)$$ is continuous at $$x_0$$ (but this is what we are "trying" to "establish" by the argument). So setting this aside, I stated it holds in two situations:

1. $$g(x)$$ is continuous on an open interval including $$x_0$$; and
2. $$g(x)$$ satisfies the Intermediate Value Property on an open interval including $$x_0$$.

The Intermediate Value Property on an interval $$I$$ is:

We say $$g(x)$$ has the Intermediate Value Property on $$I$$ if and only if for all $$a\lt b$$, $$a,b\in I$$, if $$k$$ is a value between $$g(a)$$ and $$g(b)$$, then there exists $$c$$, $$a\lt c\lt b$$, such that $$g(c)=k$$.

The Intermediate Value Property is implied by continuity (the Intermediate Value Theorem), but is weaker; for example, Darboux's Theorem shows that the derivative function of a continuous function has the intermediate value property, even though we know it need not be continuous.

Theorem. Let $$h$$ and $$g$$ be functions, and let $$a$$ be a real number. If:

1. $$g(a) = a$$; and
2. If $$x\neq a$$, then $$g(x)$$ is strictly between $$a$$ and $$x$$; and
3. $$g(x)$$ has the Intermediate Value Property on an open interval containing $$a$$; and
4. $$\lim_{x\to a}h(g(x)) = h(a)$$;

then $$h$$ is continuous at $$a$$; that is, $$\lim_{x\to a}h(x) = h(a)$$.

The idea is this: take $$\epsilon\gt 0$$. We know that any point sufficiently close to $$a$$ will make $$h(g(x))$$ $$\epsilon$$-close to $$h(a)$$. Pick any such $$x$$, and see where $$g(x)$$ is; then every point $$y$$ between $$g(x)$$ and $$a$$ is the value of $$g$$ at some point between $$x$$ and $$a$$, and so it is the value at a point “sufficiently close” to $$a$$. So then $$h(y)$$ is equal to $$h(g(z))$$ for some $$z$$ “sufficiently close” to $$a$$, which means $$h(y)$$ is $$\epsilon$$-close to $$h(a)$$. We now do this formally:

Proof. Consider $$\lim_{x\to a^+}h(x)$$.

Let $$\epsilon>0$$; we may assume $$\epsilon$$ is sufficiently small so that $$(a,a+\epsilon)$$ is contained inside the interval specified in item 3. We want to show that there exists $$\delta\gt 0$$ such that if $$0\lt x-a\lt\delta$$, then $$|h(x)-h(a)|\lt\epsilon$$.

We know that $$\lim_{x\to a^+}h(g(x))=h(a)$$, so there exists $$\delta_1\gt 0$$ (and again we may assume that $$(a,a+\delta_1)$$ is contained in the interval specified in item 3) such that: $$\text{if } 0\lt y-a\lt\delta_1,\text{ then }|h(g(y))-h(a)|\lt \epsilon.\tag{2}$$

Let $$x_1 = a+\frac{\delta_1}{2}$$. Then $$|h(g(x_1))-h(a)|\lt\epsilon$$. Let $$\delta = g(x_1)-a\gt 0$$. I claim that if $$0\lt x-a\lt\delta$$, then $$|h(g(x))-h(a)|\lt \epsilon$$.

Indeed, let $$x$$ be such that $$0\lt x-a\lt\delta$$. Because $$x$$ lies between $$g(x_1)$$ and $$g(a)$$, there exists $$y$$ between $$x_1$$ and $$a$$ where $$g(y)=x$$. In particular, $$0\lt y-a\lt x_1-a\lt\delta_1$$. Therefore, by $$(2)$$, we have $$|h(x)-h(a)| = |h(g(y))-h(a)| \lt \epsilon,$$ as desired. Thus, $$\lim_{x\to a^+}h(x)=h(a)$$, as claimed.

The argument for the limit from the left is similar, which proves the theorem. $$\Box$$

Corollary. Let $$h$$ and $$g$$ be functions, and let $$a$$ be a real number. If:

1. $$g(a) = a$$; and
2. If $$x\neq a$$, then $$g(x)$$ is strictly between $$a$$ and $$x$$; and
3. $$g(x)$$ is continuous on an open interval containing $$a$$; and
4. $$\lim_{x\to a}h(g(x)) = h(a)$$;

then $$h$$ is continuous at $$a$$; that is, $$\lim_{x\to a}h(x)=h(a)$$.

Proof. Continuity implies the intermediate value property. $$\Box$$

Now apply the theorem with $$a=x_0$$, $$h(x)=f'(x)$$ and $$g(x)$$ a function that picks a point satisfying the conclusion of the Mean Value Theorem to get the desired conclusion: if that function is continuous, or if it has the Intermediate Value Property, then $$f'$$ is continuous at $$x_0$$.

Note that continuity of $$g(x)$$ at $$a$$ is not enough: for example, consider the function defined on $$[0,1)$$ by $$g(x) = \left\{\begin{array}{ll} \frac{1}{n} &\text{if }\frac{1}{n+1}\leq x\lt \frac{1}{n}, n=1,2,\ldots\\ 0&\text{if }x=0. \end{array}\right.$$ Extend it to take value $$1$$ on $$[1,\infty)$$, and extend it to negative values by $$g(-x) = -g(x)$$ if $$x\gt 0$$. This function is continuous at $$0$$, since $$|g(x)|\lt|x|$$ for all $$x$$, and $$g(0)=0$$.

Now let $$h(x)$$ take value $$0$$ at all numbers of the form $$\frac{1}{n}$$ with $$n$$ a nonzero integer, and value $$1$$ elsewhere. Then $$\lim_{x\to 0}h(x)$$ does not exist. However, $$\lim_{x\to 0}h(g(x))=0$$, because $$h(g(x))=0$$ for all $$x\neq 0$$. Thus, the intermediate value property cannot be replaced with "$$g$$ is continuous at $$a$$" in the Theorem.

Of course, there is no way to show that we can pick the points $$\xi_x$$ in a manner that will make this theorem work, simply because the desired conclusion is not true in general. We cannot strengthen the MVT to get us the desired properties.

• Many thanks for your reply! I am reading it right now. I think this sentence "In general, we cannot claim that because $\lim_{x\to x_0}g(x)=x_0$ (which it plainly does, by the Squeeze Theorem for example) this implies that $\lim_{y\to x_0}f'(y)=f'(x_0)$." is a bit confusing. Maybe it is confusing since I am not English native speaker
– ZFR
Apr 15, 2021 at 22:44
• @ZFR: I’m not a native speaker either. Drop the parenthetical comment and read the statement. It is just an assertion that an implicationn does not hold. The parenthetical comment just says that in the specific case we are looking at, the premise does hold and can be justified, for instance, by the Squeeze Theorem. Apr 15, 2021 at 22:52
• Perfect answer and the counterexample is really good! Shortly the point of this problem is the following: MVT just picks such $\xi_x$ where $f'(\xi_x)\to 0$ as $x\to 0$ but does not take into account the points where $f'$ can have oscillation. This was a short summary of this really nice problem.
– ZFR
Apr 16, 2021 at 2:46
• Dear Arturo! All answers are perfect but the proof of the theorem and your counterexample helped me to grasp this problem. So I'll accept your answer as the best one. Thank so you much!
– ZFR
Apr 16, 2021 at 2:47