Demonstrate that a differentiable function $f: \mathbb Q\rightarrow \mathbb Q$ is not uniformly continuous

analysisreal-analysis

Following the scheme given by mercio in the answer to this question, one can construct a function $f: \mathbb Q \rightarrow \mathbb Q$, differentiable everywhere, with derivative function
$$
f'(x) = \begin{cases}
0, & (x \neq 0),\\
1, & (x = 0).
\end{cases}\tag{1}\label{one}
$$

Such function cannot be uniformly continuous, because otherwise, in any closed interval containing $0$, $f$ could be extended to a continuous function on $\mathbb R$. Such extended function would give
\begin{equation}
\lim_{h \rightarrow 0} \frac{f(h)-f(0)}{h} = 1
\end{equation}

and, at the same time,
\begin{equation}
\lim_{x\rightarrow 0}f'(x) = 0,
\end{equation}

which would contradict de l'Hôpital's rule.

My question is whether it is possible or not to demonstrate that $f$ is not uniformly continuous by using only condition \eqref{one} and the definition of uniform continuity, i.e. (for the sake of completeness)
\begin{equation}
\forall \epsilon,\ \exists \delta:\ \forall x,\ y \in \mathbb Q,\ |x-y|<\delta \Rightarrow |f(x)-f(y)|<\epsilon .
\end{equation}

EDIT: Wojowu pointed out to me that the function may not be differentiable once extended on $\mathbb R$ (thus not contradicting de l'Hôpital's rule) . So either $f$ is not uniformly continuous or its extension to the reals fails to be differentiable. So the question now is whether this can be estabished only by means of \eqref{one} or not, and how.

Best Answer

Actually $f$ can be uniformly continuous.

Edit: A hugely simplified and cleaned up version of what I posted earlier:

Oops: I just realized that what's below is not quite a counterexample to the assertion in the OP. We construct a uniformly continuous $f:\Bbb R\to\Bbb R$ such that $f'(0)=1$ and $f'(r)=0$ for every non-zero rational $r$, but there's no reason to think that $f(\Bbb Q)\subset\Bbb Q$. I'm leaving this here anyway because (i) the construction is quite simple, (ii) it does serve to show that the OP's argument purporting to show that $f$ cannot be uniformly continous is wrong, since that argument would work just as well for $f:\Bbb Q\to\Bbb R$, and (iii) come to think of it it's not hard to fix it to give a literal counterexample (see Fix below).

Say $r_1,r_2,\dots$ is an enumeration of the non-zero rationals. For each $n$ choose $\delta_n\in(0,|r_n|/2)$ in such a way that if $I_n=(r_n-\delta_n,r_n+\delta_n)$ and $$E=\Bbb R\setminus\bigcup I_n$$then $$\lim_{\rho\to0}\frac1\rho m(E\cap(0,\rho)) =\lim_{\rho\to0}\frac1\rho m(E\cap(-\rho,0)) =1.$$(It's clear that happens if $\delta_n\to0$ fast enough; Details below if it's not clear). Let $$f(x)=\int_0^x\chi_E(t)\,dt.$$Then $f:\Bbb R\to\Bbb R$ is Lipshitz, hence uniformly continuous, $f'(r_n)=0$ because $f$ is constant on $I_n$, and the condition on density of $E$ at the origin implies that $f'(0)=1$.


Details: We will show that if $\delta_n\to0$ fast enough then $f'(0)=1$ (that being what we care about - it's equivalent to the statement that $0$ is a point of density for $E$.) In fact

If $\sum\delta_n/|r_n|<\infty$ then $f'(0)=1$.

Note first that since $0<\delta_n<|r_n|/2$ that condition is equivalent to $\sum\frac{\delta_n}{|r_n|-\delta_n}<\infty$.

Let $$g(x)=x-f(x)$$ and $$G(x)=\sum g_n(x),$$ where $$g_n(x)=\int_0^x\chi_{I_n}.$$ We will avoid worrying about $\int_0^x$ for $x<0$ by showing only that the right-hand derivative of $g$ at the origin vanishes; of course the same applies to the left-hand derivative. Since $$0\le\frac{g(x)-g(0)}{x}\le\frac{G(x)}{x}\quad(x>0)$$it's enough to show that $$\lim_{x\to0^+}\frac{G(x)}{x}=0.$$Define $D_n(x)$ for $x\ge0$ by $$D_n(x)=\begin{cases}\frac{g_n(x)}{x},&(x>0), \\0,&(x=0).\end{cases}$$Since $g_n'(0)=0$ it follows that $D_n$ is continuous on $[0,\infty)$. It's clear that $$D_n(x)=0\quad(0\le x\le|r_n|-\delta_n)$$ and $$|D_n(x)|\le\frac{2\delta_n}{|r_n|-\delta_n}\quad(x>|r_n|-\delta_n).$$So the series $\sum D_n$ converges uniformly on $[0,\infty)$, and hence $$D=\sum D_n$$ is continuous on $[0,\infty)$. But $$D(x)=\begin{cases}\frac{G(x)}{x},&(x>0),\\0,&(x=0);\end{cases}$$hence $\lim_{x\to0^+}G(x)/x=0$.

Fix: A patch for the problem mentioned in Oops above:

Lemma. Suppose $(y_n)$ is a sequence of non-zero reals. There exists a uniformly continuous $\psi:\Bbb R\to\Bbb R$ such that $\psi(0)=0$, $\psi'(0)=1$, and $\psi(y_n)$ is rational for every $n$.

That seems quite clear, since we're not requiring more than continuity except at one point. Anyway:

Proof: Suppose $y_n\ne y_m$ for $n\ne m$. For each $n$ choose an open interval $I_n$ with $0\notin I_n$, $y_n\in I_n$ and $y_k\notin I_n$, $1\le k<n$. Let $\phi_n$ be a continuous function supported in $I_n$ with $\phi_n(y_n)\ne0$. We will let $$\phi=\sum c_n\phi_n$$for suitable constants $c_n$.

First, if $c_n\to0$ fast enough then the series converges uniformly, hence $\phi$ is uniformly continuous, since the partial sums are uniformly continuous.

Second, if $c_n\to0$ fast enough then $$|\phi(x)|\le x^2.$$(For example, if $c_n$ is small enough then $|c_n\phi_n(x)|\le x^2/2^n$ for all $x$.)

Finally, it's clear that we may choose the $c_n$ one by one, "small enough" as in the previous two paragraphs, so that $$y_n+\sum_{j=1}^n c_j\phi_j(y_n)\in\Bbb Q$$ for all $n$. Since $y_n\notin I_j$ for $j>n$ this implies that $$y_n+\phi(y_n)=y_n+\sum_{j=1}^n c_j\phi_j(y_n)\in\Bbb Q.$$

Now let $\psi(x)=x+\phi(x)$. QED.

Now to fix the construction above: Let $E$ and $f$ be as above. Say the connected components of $E$ are $J_1,J_2,\dots$. Note that $f$ is constant on each $J_n$; let $y_n$ be this constant. Choose $\psi$ as in the lemma and let $F=\psi\circ f$.

Then $F'(0)=1$. Also $F(0)=0\in\Bbb Q$, while if $r$ is a non-zero rational then there exists $n$ with $r\in J_n$; hence $F'(r)=0$, since $F$ is constant on $J_n$, and also $F(r)=\psi(y_n)\in\Bbb Q$.