# Differentiation of a function $f:\mathbb{Q}\to \mathbb{Q}$(Rational Calculus)

Assume that $f:\mathbb{Q}\to \mathbb{Q}$ is given such that $\forall a\in \mathbb{Q}$ the following limit, exists

\begin{equation} \lim_{x\to a} \frac{f(x)-f(a)}{x-a}\in \mathbb{R} \end{equation}

Is it true to say that the above limit is a rational number?

• But if $f(x),f(a)$ are both Rationals, and you can always approach $a$ by a sequence of Rationals, then you have a quotient of Rational numbers. Jun 23, 2014 at 23:26
• @user99680 but a limit of rational numbers is not necessarily a rational number. Jun 23, 2014 at 23:28
• Ah, never mind, I see your point, Duh, dumb me, let me rethink. Jun 23, 2014 at 23:35
• It's true if $f()$ is polynomial; such an $f()$ must have rational coefficients (by an easy interpolation argument - the coefficients of a degree-$n$ polynomial can be given explicitly in terms of rational arguments of its values at $n$ points), and so so does its derivative. It should be easy to extend to rational $f()$ by very similar arguments, but beyond that point things start getting murky fast. Jun 23, 2014 at 23:39

It is false: I would define something piecewise-constant and discontinuous at irrational $x$ such as $f : \mathbb{Q} \to \mathbb{Q}$ by:

$f(x) = 1$ for $x > \frac{1}{\sqrt{2}}$

$f(x) = \frac{1}{2}$ for $\frac{1}{3\sqrt{2}}<x<\frac{1}{2\sqrt{2}}$

$f(x) = \frac{1}{3}$ for $\frac{1}{4\sqrt{2}}<x<\frac{1}{3\sqrt{2}}$, and so on for positive $x$, and $f(0) = 0$.

Similarly for negative $x$ define:

$f(x) = -1$ for $x < -\frac{1}{\sqrt{2}}$

$f(x) = -\frac{1}{2}$ for $-\frac{1}{2\sqrt{2}}<x<-\frac{1}{3\sqrt{2}}$

$f(x) = -\frac{1}{3}$ for $-\frac{1}{3\sqrt{2}}<x<-\frac{1}{4\sqrt{2}}$ and so on. Then $f$ is differentiable (since constant) at all rational $x$ other than 0, and $f'(0) = \sqrt{2}$.

• thanks for your very interesting example Jun 24, 2014 at 0:01
• This is a great (counter)example. I never would have thought of a piecewise-constant function having non-zero derivative at a point - to the point where I might even add that to a 'false beliefs' list ('If a function is piecewise-constant, its derivative is 0 everywhere the derivative is defined'). Brilliant! Jun 24, 2014 at 0:05
• I have fixed the typos, thank you. Jun 24, 2014 at 0:08