Solutions to $f'=f$ over the rationals The problem is as follows:
Let $f: \mathbb{Q} \to \mathbb{Q}$ and consider the differential equation $f' = f$, with the standard definition of differentiation. Do there exist any nontrivial solutions?
(Note that of course $f \equiv 0$ is a solution - by "nontrivial solutions", I mean anything else).
Observations:
Differentiation and continuity are much weaker concepts on the rationals. For example, $H(x-\sqrt{2}) : \mathbb{Q} \to \mathbb{Q}$ is continuous and everywhere differentiable, where $H$ is the Heaviside step function.
If there exists a nontrivial solution $f_0$, then there are uncountably many solutions. For example, $H(x-\alpha)f_0$ is also a solution for any irrational $\alpha$ (which already gives uncountably many solutions), and thus any* linear combination $k_0 f_0 + \sum_{\alpha \in A} H(x-\alpha)k_\alpha f_0$ (with $A \subset \mathbb{R}\setminus\mathbb{Q}$) is also a solution, by linearity of the DE.
We can answer in the negative if there is a way to show that any such solution could be extended to a solution to $f' = f$ on $\mathbb{R}$, because those solutions are simply $ke^x$, which takes irrational values over the rationals unless $k = 0$. Unfortunately, the solutions $f : \mathbb{Q} \to \mathbb{Q}$ for the a differential equation $\mathcal{L}y = 0$ are not, in general, a subset of the real solutions. e.g. $y' = 0$ has solution $H(x-\sqrt{2})$ but every solution on $\mathbb{R}$ must be constant.
If the answer is "yes", maybe we'd hope to be able to construct a solution via some iterative method, but since Cauchy sequences are not in general convergent, we'd need some sort of machinery to guarantee rational limits.
*you can either insert the word "finite" here, or stipulate that the $k_\alpha$ are such that the quantity $\sum_{\alpha<q} k_\alpha$ is finite and rational for all $q \in \mathbb{Q}$, but the point is that we can construct a bunch of "different looking" solutions.
 A: There are non-trivial solutions $f:\mathbb Q\rightarrow\mathbb Q$ to any differential equation of the form $f'(q)=g(q,f(q))$. Somewhat more strongly, we may find a solution $f$ such that for every $q\in \mathbb Q$ there is some $\delta>0$ such that $\left|\frac{f(q')-f(q)}{q'-q}-g(q,f(q))\right|<(q'-q)^2$ for every $q'$ with $|q'-q|<\delta$.
In this spirit, define the following subsets of $\mathbb Q^2$
$$S(x,y,\delta)=\left\{(x',y'):\left|y'-y-g(x,y)(x'-x)\right|<\left|x'-x\right|^3\text{ or }|x'-x|>\delta\right\}\cup \{(x,y)\}.$$
When $|x'-x|\leq \delta$, this is a region bounded by two parabolas tangent at $(x,y)$ with slope $m$ at that point, which is related to the condition we are requiring on $f$. We will define the function by defining it at particular points and choosing a suitable open set $S$ in which we place every further point. This will suffice to ensure differentiability.
In particular, let $\{p_n\}_{n=1}^{\infty}$ be an enumeration of the rationals. We will construct a sequence $\{q_n\}_{n=1}^{\infty}$ of rationals such that $f(p_n)=q_n$ defines a suitable function. We will, during the construction, use an auxiliary sequence $U_n$ of open subsets of $\mathbb Q^2$, letting $U_0=\mathbb Q^2$. At each step in the construction, we will demand the following of $U_{n}$ for all $n$:


*

*Property 1: $U_{n}=U_{n-1}\cap S(p_n,q_n,\delta)$ for some $\delta>0$

*Property 2: $U_{n}\setminus \{(p_1,q_1),(p_2,q_2),\ldots,(p_n,q_n)\}$ is open.

*Property 3: For all rational $p\in\mathbb Q$ there exists $q\in \mathbb Q$ such that $(p,q)\in U_{n}$.

*Property 4: For all $n'\leq n$ we have $(p_{n'},q_{n'})\in U_{n}$.
Given that the graph of the function being a subset of $S(p,f(p),\delta)$ for every $p$ implies that $f$ satisfies the differential equation, the only business we have is to show that such a triple of sequences exists.
To do so, suppose we are given the first $n-1$ terms of the sequences $\{q_n\}$ and $\{U_n\}$ along with the whole sequence $p_n$ and need to find a suitable $q_n$ and $U_n$ to extend the sequence. By property $3$ of $U_{n-1}$ there exists some $q$ such that $(p_n,q)\in U_{n-1}$. Set $q_n$ to any such $q$ and let $m=|g(p_n,q_n)|+1$. Now, using property 2 of $U_{n-1}$ choose some $\delta\in (0,1)$ such that $(p_n-\delta,p_n+\delta)\times (q_n-m\delta,q_n+m\delta)\subseteq U_{n-1}$. One can see that $$S(p_n,q_n,\delta)\cap(p_n-\delta,p_n+\delta)\times \mathbb R\subseteq(p_n-\delta,p_n+\delta)\times (q_n-m\delta,q_n+m\delta)\subseteq U_{n-1}.$$ Set $U_n=U_{n-1}\cap S(p_n,q_n,\delta)$. Now we check that we have satisfied the conditions:


*

*Property 1: Trivial, from definition of $U_n$.

*Property 2: Write $$U_n\setminus \{(p_1,q_1),\ldots,(p_n,q_n)\}=\left(U_{n-1}\setminus\{(p_1,q_1),\ldots,(p_{n-1},q_{n-1})\}\right)\cap \left(S(p_n,q_n,\delta)\setminus \{(p_n,q_n)\}\right).$$
Thus the given set is the intersection of two open sets and thus open.

*Property 3: Suppose that $|p-p_n|<\delta$. Then there is a $q$ such that $(p,q)$ is in $S(p_n,q_n,\delta)\cap (p_n-\delta,p_n+\delta)\times \mathbb R\subseteq U_n$. If $|p-p_n|\geq \delta$, then $(p,q)\in U_n$ exactly when $(p,q)\in U_{n-1}$, so the theorem is satisfied.

*Property 4: Due to property $1$, if there is a $q$ such that $(p_{n'},q)\in U_n$ then $q=q_n$. By property $3$, there is such a $q$.
This shows that we may extend the sequences given any finite prefix of it. It is then easy to check that the resulting function $f(p_n)=q_n$ satisfies the hypotheses.
A: More generally, for any function $g:\mathbb Q\rightarrow\mathbb Q$ and any point $(x_0,y_0)\in\mathbb Q^2$, there exists $f:\mathbb Q\rightarrow\mathbb Q$ such that $f'(x_0)=y_0$ and $f'(x)=g(f(x))$.
Choose an enumeration $x_0,x_1,\ldots$ of $\mathbb Q$ starting with $x_0$. Let $Q_n=\{x_0,\ldots,x_n\}$, so $\mathbb Q=\bigcup_n Q_n$. We will inductively construct continuous functions $a_n,b_n:\mathbb Q\rightarrow\mathbb Q$ with the properties


*

*$a_{n-1}(x)\leq a_n(x)\leq b_n(x)\leq b_{n-1}(x)$

*If $x\in Q_n$ then $a_n(x)=b_n(x)$ and $a_n'(x)=b_n'(x)=g(a_n(x))$.

*If $x\in\mathbb Q\setminus Q_n$ then $a_n(x)<b_n(x)$.


We'll use the parabolic functions $c(s,t)$ and $d(s,t)$ defined by
$$
  c(s,t)(x)=t+g(t)(x-s)-(x-s)^2,
$$
$$
  d(s,t)(x)=t+g(t)(x-s)+(x-s)^2.
$$
Note that $c(s,t)(x)<d(s,t)(x)$ for $x\neq s$ and both functions pass through $(s,t)$ with derivative $g(t)$. We can take $a_0=c(x_0,y_0)$ and $b_0=d(x_0,y_0)$.
Suppose $n>0$ and $a_{n-1},b_{n-1}$ are constructed. Then $a_{n-1}(x_n)<b_{n-1}(x_n)$, so choose $y_n$ strictly between these. Choose an open interval $I$ containing $x_n$ such that $c(x_n,y_n)>a_{n-1}$ and $d(x_n,y_n)<b_{n-1}$ on $I$. Shrink $I$ so that its closure doesn't intersect $Q_{n-1}$. Let $J$ be an open interval containing $x_n$ whose closure is inside $I$. We define $a_n$ to equal $a_{n-1}$ outside $I$, $c(x_n,y_n)$ inside $J$, and interpolate linearly between $I$ and $J$ so that the result is still continuous. Define $b_n$ similarly.
Since $\bigcup_n Q_n=\mathbb Q$, both $a_n$ and $b_n$ converge pointwise to a function $f$ as $n\rightarrow\infty$. For any $x\in\mathbb Q$ we have $x=x_n$ for some $n$, and $a_n\leq f\leq b_n$, so property 2 and the squeeze theorem imply that $f$ satisfies the required equation.
