# If the condition of differentiability holds for the rationals then the function is differentiable?

$f:\mathbb{R}\rightarrow\mathbb{R}$ continuous, $a\in\mathbb{R}$. Suppose that there exists $L\in\mathbb{R}$ such that for every $\varepsilon>0$ there exists $r(\varepsilon)>0$ such that $|\frac{f(x)-f(a)}{x-a}-L|<\varepsilon$ for every $x\in\mathbb{Q}$ and $|x-a|<r(\varepsilon)$. I have to show that $f$ is differentiable at $a$ with $f^\prime(a)=L$. I know that this should be a trick using the density of the rational, but I can't see it, could you help me please?

-
Is the $L$ meant to be independent of $x$? That makes the derivative constant at all rational points (and ultimately, constant everywhere over the reals). – Srivatsan Oct 26 '11 at 19:34
Here's a hint: For $x \in {\mathbb R}$, take $y \in {\mathbb Q}$ close to $x$ (where you can decide how close in terms of $\varepsilon$ later) and write $\frac{f(x)-f(a)}{x-a} = \frac{f(x)-f(y)}{x-a} + \frac{f(y)-f(a)}{x-a}$ and use the continuity of $f$. – Jeff Oct 26 '11 at 19:42
@SrivatsanNarayanan Yes $L$ is independent of $x$, the OP is taking the derivative at $a$, not $x$. – Jeff Oct 26 '11 at 19:44
@Srivatsan: It looks like $L$ is independent of $x$ but not of $a$. By the way, a function whose derivative is constant at all rational points, doesn't necessarily have constant derivative everywhere. Minkowski's question mark function is a counterexample. – Henning Makholm Oct 26 '11 at 19:45

Fix a point $x\neq a$ such that $0 < |x - a| < r(\epsilon/2)$. Then, at the point x, the function $$g(y) = \frac{f(y) - f(a)}{y - a}$$ is continuous. Now, pick a point $p \in Q$ near $x$ such that $0< |p-a| < r(\epsilon/2)$ and $|g(p) - g(x)| < \epsilon/2$. This is possible by continuity. Now, use your condition to conclude via the triangle inequality, that $$\left|\frac{f(x) - f(a)}{x - a} - L\right| = |g(x) - L| \le |g(x) - g(p)| + |g(p) - L| < \epsilon/2 + \epsilon/2 = \epsilon.$$

It follows by definition that $f$ is differentiable at $a$ with $f'(a) = L$.

-
It says at the point $x$ the function $g(y)=...$ is continuous what the $x$ has to do with the $y$? – user17090 Oct 26 '11 at 20:07
The function $g$ is defined and continuous at all points $y\neq a$, in particular, at the point $x$ I picked. – Justin Young Oct 26 '11 at 20:23

Since the variable name $x$ is already "taken" as ranging over the rationals, we use $z$ to range over the reals. Note that $$\frac{f(z)-f(a)}{z-a}-L= \frac{(f(x)-f(a))-(f(x)-f(z))}{z-a}-L.$$ The right-hand side above is equal to $$\left(\frac{f(x)-f(a)}{x-a}\frac{x-a}{z-a}-L\right)-\frac{f(x)-f(z)}{z- a}.$$

Let $z_1, z_2, z_3\dots$ be any sequence of reals with limit $a$, where the distance of $z_n$ from $a$ decreases monotonically. If we can find a sequence $(x_n)$ of rationals with limit $a$ such that $$\lim_{n\to\infty}\frac{x_n-a}{z_n-a}=1 \qquad \text{and}\qquad \lim_{n\to\infty}\frac{f(x_n)-f(z_n)}{z_n-a}=0,$$ the result will follow.

So $x_n$ has to be chosen far nearer to $z_n$ than $z_n$ is to $a$. We look at the second limit, because it is a little harder to achieve. By the continuity of $f$, and the fact that the rationals are dense in the reals, we can find for each $z_n$ a rational $x_n$ such that $|f(x_n)-f(z_n)|<(1/n)|z_n-a|$.

-
@Didier Piau: Thank you. I had fixed it while you were typing. – André Nicolas Oct 26 '11 at 20:58