# Limit of sequences equals $f'(0)$

I'm working on a question that states:

Consider a differentiable function $$f:\mathbb{R}\to\mathbb{R}$$. Furthermore consider the sequences $$(x_n)_n$$ and $$(y_n)_n$$ which both have limit $$0$$ and $$x_n < y_n$$ for all $$n\in\mathbb{N}$$. Is the following true?

$$\lim_{n\to\infty} \frac{f(y_n)-f(x_n)}{y_n-x_n} = f'(0).$$

If yes give a proof, if no give a counter example and find the extra requirements for it to be true.

I thought it was true and as a proof I did the following:

Given that $$f$$ is differentiable and that $$x_n < y_n$$, by the mean value theorem there exists a $$c_n \in (x_n,y_n)$$ such that

$$\frac{f(y_n)-f(x_n)}{y_n-x_n} = f'(c_n).$$

As $$x_n$$ and $$y_n$$ both converge to $$0$$ we have that $$c_n$$ will also converge to $$0$$. Therefore, by taking the limit for $$n$$ to infinity we find that

$$\lim_{n\to\infty} \frac{f(y_n)-f(x_n)}{y_n-x_n} = \lim_{n\to\infty}f'(c_n) = f'(0).$$

At this point I realised that I had used the continuity of $$f'$$ which was not given in the question. I am now wondering if this is a necessary condition for the problem or if it can be solved without using the continuity of $$f'$$. If it is a necessary condition what is a suitable counter example where $$f'$$ isn't continuous? Any help is appreciated.

• You are correct that continuity of $f'$ is not needed. For counterexamples, search for "differentiable at one point" (here is one example); $f'$ may not even exist outside of zero. Aug 3, 2021 at 18:59
• Sorry, I missed that condition in your post, so you are right that my counterexample does not apply. Still, I think one can come up with an example where $f'$ is not continuous at $0$; you can probably find one with some effort. In any case, the claim only requires differentiability at $0$; see the duplicate question marked by José Carlos Santos. Aug 3, 2021 at 19:21
• There is a few typos: it has to be $[f(x_n) - f(y_n)] / (x_n-y_n)$. You have $[f(y_n) - f(x_n)]$ in the numerators so your limit is off by a minus sign compared to what you want. Aug 5, 2021 at 9:39
• You could try to find a counterexample with $f(x) = x^2\sin(1/x)$, which has a discontinuous derivative at $0$. I think $x_n = 1/n$, $y_n=e^{1/n}-1$ might work. Aug 5, 2021 at 9:58
• I though of using the suggested function $f(x)=x^2\sin(1/x)$ at $x \neq 0$ and $f(x)=0$ at $0$ with the sequences $x_n = 1/(2\pi n)$ and $y_n = 1/(2\pi (n+1/4)$. That way the limit tends to $2/\pi$ which is not equal to $f'(0)=0$. Is this correct? Aug 6, 2021 at 8:22

A counterexample has been given in the comment: $$f(x) = x^2 \sin (1/x)$$. Actually, any differentiable functions so that $$f'(x)$$ does not converge to $$f'(0)$$ as $$x\to 0$$ suffices: in this case, there is $$\epsilon_0>0$$ and a sequence $$x_n \to 0$$ so that $$|f'(x_n) - f'(0)| >\epsilon_0$$ for all $$n$$. For each $$n$$, one can find by the definition of $$f'(x_n)$$, $$y_n\in (x_n, x_n+1/n)$$ so that
$$\left| \frac{f(y_n)-f(x_n)}{y_n-x_n} - f'(x_n)\right| < \frac 12 \epsilon_0.$$ Then $$y_n\to 0$$, $$x_n < y_n$$. Also,
\begin{align} \epsilon_0 &< |f'(x_n) - f'(0)|\\ & <\left| \frac{f(y_n)-f(x_n)}{y_n-x_n} - f'(x_n)\right| +\left|\frac{f(y_n)-f(x_n)}{y_n-x_n} - f'(0)\right| \\ &< \frac 12 \epsilon_0 +\left|\frac{f(y_n)-f(x_n)}{y_n-x_n} - f'(0)\right| \end{align} and this implies $$\left| \frac{f(y_n)-f(x_n)}{y_n-x_n} - f'(0)\right|> \frac 12 \epsilon_0.$$
Thus $$\frac{f(y_n)-f(x_n)}{y_n-x_n}$$ does not converge to $$f'(0)$$.
Together with what you did, the limit holds for all such sequences $$(x_n), (y_n)$$ if and only if $$f'$$ is continuous at $$0$$.