TITLE: Prove $f$ is differentiable when $h\to 0$ in definition along rationals.
QUESTION [5 upvotes]: Let $f:\Bbb{R}\to \Bbb{R}$ be continuous such that for some $x_o\in \Bbb{R}$, $$\lim_{h\to 0,h\in \Bbb{Q}} \frac{f(x_o+h)-f(x_o)}{h}$$ exists and is finite.Prove $f$ is differentiable at $x_o$

I tried to use continuity at $x_o$ to make $f(x_o+h)-f(x_o)$ small but couldn't go further!

REPLY [5 votes]: Let $$g(h)=\frac{f(x_0+h)-f(x_0)}{h},$$
and note that $g$ is a continuous function alway from the origin. Let $c=\lim_{h\to 0,\ h\in \mathbb{Q}} g(h)$. Let $\epsilon>0$ and choose $\delta>0$ such that $$|g(h)-c|<\epsilon/2,\ |h|<\delta,\ h\neq 0,\ h\in \mathbb{Q}.\tag{1}$$
For any $h\neq 0$ with $|h|<\delta/2$, take $h'\in\mathbb{Q}$ such that $|h'|<\delta $ and $|g(h)-g(h')|<\epsilon/2$, thus, from $(1)$ we have that $$|g(h)-c|\le |g(h')-g(h)|+|g(h')-c|\le \epsilon.$$