# About the derivative of a function defined on rational numbers

I have found this problem:

Let $f : \mathbb{Q} → \mathbb{R}$ with property: $$|f(x) − f(y)| \le (x − y)^2 \tag1$$ for all $x, y \in \mathbb{Q}$. Prove $f$ is constant.

My idea is to consider the formal derivative of $f$ like this:

$$f'(x) = \lim_{h \rightarrow 0} \frac {f(x + h) - f(x)}{h}, h \in \mathbb{Q}$$

Using (1) it's easy to prove the limit exists and is equals $0$ for all $x \in \mathbb{Q}$. So $f$ has derivative and $f'(x)=0$ for all $x \in \mathbb{Q}$. It follows that $f$ is constant.

Unfortunately, it's not that simple because: $$f'\equiv 0 \implies \ f \ constant \tag 2$$ is a consequence of Mean Value Theorem which is valid only on real intervals.

My question: is (2) valid for $f: \mathbb{Q} \rightarrow \mathbb{R}$?

Obs. I don't need a proof for the problem.

• Is $f$ even continuous? – Henrik supports the community May 14 '16 at 11:04
• Hard to apply real analytic methods to $\mathbb Q$. More simply, though: to see that, say $f(0)=f(1)$ note that $|f(0)-f(1)|=|f(0)-f(.5)+f(.5)-f(1)|≤|f(0)-f(.5)|+|f(.5)-f(1)|≤\frac 12$ and so on, constantly dividing each subinterval by $2$. – lulu May 14 '16 at 11:10
• As an example of the difficulty in using real analytic methods, consider the function $g:\mathbb Q\to \mathbb R$ defined by $g(x)=0$ when $x<\pi$ and $g(x)=1$ when $x>\pi$. That has derivative $0$ everywhere (as it is locally constant) but it is not a constant. – lulu May 14 '16 at 11:35
• @lulu Your counter-example is very good, so (2) is not valid on rationals. – user261263 May 14 '16 at 11:40
• Right. As you pointed out, you can define the derivative of functions on $\mathbb Q$ but you really don't get to keep much of the geometry. Gets better if you require absolute continuity. – lulu May 14 '16 at 11:44

The desired version of the Mean Value Theorem is not generally true for functions $g:\mathbb Q\to \mathbb R$. To see that consider the function: $$g(x) = \begin{cases} 0, & \text{if x<\pi} \\ 1, & \text{if x>\pi} \end{cases}$$

That function has derivative $0$ everywhere (as it is locally constant) but it is not a constant.

We have $$|f(x)-f(y)|=|f(x)-f\left(\frac {x+y}2\right)+f\left(\frac {x+y}2\right)-f(y)|≤|f(x)-f\left(\frac {x+y}2\right)|+|f\left(\frac {x+y}2\right)-f(y)|$$ $$≤\frac {(x-y)^2}2$$
Repeat this using the stronger estimate to see that $$|f(x)-f(y)|≤\frac {(x-y)^2}4$$ and iterate to see that ($\forall n\in \mathbb N$) $$|f(x)-f(y)|≤\frac {(x-y)^2}{2^n}$$
And as $n\to \infty$ we see that $f(x)=f(y)$.
• You really need absolute continuity, which is stronger. The Cantor Function is uniformly continuous and has derivative 0 off a set of measure $0$, but it is not absolutely continuous. – lulu May 14 '16 at 12:21