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?
 A: 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$.
A: 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|$.
