I heard the following two questions recently from [Carl Mummert](http://users.marshall.edu/~mummertc/), who encouraged me to spread them around. Part of his motivation for the questions was to give the subject of computable model theory some traction on complete metric spaces, by considering the countable objects as stand-ins for the full spaces, to the extent that they are able to do so. 


**Question 1.** Is there a countable subset $D$ of the real plane $\mathbb{R}^2$ that is dense and has the property that the Euclidean distance $d(x,y)$ is a rational number for all $x,y\in D$? 


The one dimensional analogue of this question has an easy affirmative answer, since the rationals $\mathbb{Q}$ sits densely in $\mathbb{R}$ and the distance between any two rationals is rational. 


**Question 2.** More generally, does every separable complete metric space have a countable dense set $D$ with all distances between elements of $D$ rational? [Edit: Tom Leinster has pointed out that if the space has only two points, at irrational distance, this fails. So let us consider the case of connected spaces, generalizing the situation of Question 1.]


If one is willing to change to an equivalent metric (giving rise to the same topology), then the answer to Question 1 is Yes, since the rational plane $\mathbb{Q}\times\mathbb{Q}$ is dense in the real plane $\mathbb{R}\times\mathbb{R}$, and has all rational distances under the Manhattan metric, which gives rise to the same topology. Is the answer to the correspondingly weakened version of Question 2 also affirmative, if one is willing to change the metric?


Note that one cannot find an equivalent metric such that *all* distances in $\mathbb{R}^2$ become rational, since omitted values in the distance function lead to disconnectivity in the space. This is why the questions only seek to find a dense subset with the rational condition.


The question seems related to the question of whether it is possible to find large non-linear arrangements of points in the plane with all pair-wise distances being integers. For example, this is true of the integers $\mathbb{Z}$ sitting inside $\mathbb{R}$, but can one find a 2 dimensional analogue of this? Clearly, some small arrangements (triangles, etc.) are possible, but I am given to understand that there is a finite upper bound on the size of such arrangements. What is the precise statement about this that is known?



Is there a dense subset of the real plane with all pairwise distances rational?
Let me answer Question 2.


Strong version: no. Consider $[0,1]$ with distance $d(x,y)=|x-y|^{1/3}$. There is no even a triple of points with rational distances - otherwise there would be a nonzero rational solution of $x^3+y^3=z^3$.


Weak version: yes. Let $(X,d)$ be the space in question. Construct sets $S\_1\subset S\_2\subset\dots$ such that each $S\_k$ is a maximal $(2^{-k})$-separated net in $X$. Let $S$ be the union of these nets; then $S$ is countable and dense in $X$.


Now construct the following metric graph on $S$. For every $k$, connect every pair of points $x,y\in S\_k$ by an edge whose length is $(1-10^{-k})d(x,y)$ rounded down to a multiple of $10^{-2k}$. The new distance $d'$ on $S$ is the induced length distance in this graph. It is easy to see that the edges outside $S\_k$ do not affect the distances in $S\_k$, hence all these distances are rational (multiples of $10^{-2k}$). The new metric $d'$ on $S$ satisfies $\frac12d\le d'\le d$, hence the completion of $(S,d')$ is the same set $X$ with an equivalent metric.


**UPDATE**.
Here is a more detailed description without the term "metric graph".


For each $k$, define a function $f\_k:\mathbb R\_+\to\mathbb R\_+$ by
$$
 f\_k(t) = 10^{-2k}\left\lfloor 10^{2k}(1-10^{-k})t \right\rfloor .
$$
The actual form of $f\_k$ does not matter, we only need the following properties:


* $f\_k$ takes only rational values with bounded denominators (by $10^{-k}$).
* Let $a\_k$ and $b\_k$ denote the infimum and the supremum of $f\_k(t)/t$ over the set $\{t\ge 2^{-k}\}$. Then $\frac12\le a\_k\le b\_k\le a\_{k+1}\le 1$ for all $k$. (Indeed, we have $1-2\cdot10^k\le a\_k\le b\_k\le 1-10^k$.)


For every $x,y\in S\_k$, define $\ell(x,y)=f\_k(d(x,y))$ where $k=k(x,y)$ is the minimum number such that $x,y\in S\_k$. Note that
$$
 a\_k d(x,y) \le \ell(x,y) \le b\_k d(x,y)
$$
for all such pairs $x,y$, since $S\_k$ is a $(2^{-k})$-separated set. For a finite sequence $x\_0,x\_1,\dots,x\_n\in S$ define
$$
 \ell(x\_0,x\_1,\dots,x\_n) = \sum\_{i=1}^n \ell(x\_{i-1},x\_i) .
$$
I will refer to this expression as the $\ell$-*length* of the sequence $x\_0,\dots,x\_n$. Define
$$
d'(x,y) = \inf\{ \ell(x\_0,x\_1,\dots,x\_n) \}
$$
where the infimum is taken over all finite sequences $x\_0,x\_1,\dots,x\_n$ in $S$ such that $x\_0=x$ and $x\_n=y$. Clearly $d'$ is a metric and $\frac12d\le d'\le d$. It remains to show that $d'$ takes only rational values.


**Lemma**: If $x,y\in S\_k$, then $d'(x,y)$ equals the infimum of $\ell$-lengths of sequences contained in $S\_k$. 


*Proof*: Consider any sequence $x\_0,\dots,x\_n$ in $S$ such that $x\_0=x$ and $y\_0=y$. Remove all points that do not belong to $S\_k$ from this sequence. I claim that the $\ell$-length became shorter. Indeed, it suffices to prove that
$$
 \ell(x\_r,x\_s) \le \ell(x\_r,x\_{r+1},\dots,x\_{s-1},x\_s)
$$
if $x\_r$ and $x\_s$ are in $S\_k$ and the intermediate points are not. By the second property of the functions $f\_k$, the left-hand side is bounded above by $b\_k d(x\_r,x\_s)$ and every term $\ell(x\_i,x\_{i+1})$ in the right-hand side is bounded below by $b\_k d(x\_i,x\_{i+1})$. So it suffices to prove that
$$
 b\_k d(x\_r,x\_s) \le b\_k\sum\_{i=r}^{s-1} d(x\_i,x\_{i+1}),
$$
and this is a triangle inequality multiplied by $b\_k$. Q.E.D.


All $\ell$-lengths of sequences in $S\_k$ are multiples of some fixed rational number (namely $10^{-2k}$). Hence $d'(x,y)$ is a multiple of the same number if $x,y\in S\_k$. Thus all values of $d'$ are rational.


