All distances are rational prove the set is countable

Question:

Assume $E$ is a subset of $R^n$, and $x,y\in E\Rightarrow d(x,y)\in \mathbb Q$, show that $E$ is at most countable. ($d$ is the Euclidean distance)

I believe I've solved the $n=2$ case, which was 2013 real analysis qualifying exam problem at UCI. For general $n$ it was stated on the exam that the statement is true, without asking a proof. I'm wondering if anyone can give a more general solution because my solution for $n=2$ is difficult to extend to any $n$.

My solution for $n=2$:

If $E=\emptyset$ we are done. If not, take $x\in E$, by the assumption $E\subset \underset{q\geq0,q\in Q}{\cup}\partial B(x,q)$ where $\partial B(x,q)=\{y\in R^2\mid d(x,y)=\sqrt{x^2+y^2}=q\}$. Because countable union of countable sets is countable, and $Q$ is countable, it's sufficient to prove $C_q=E\cap \partial B(x,q)$ is countable for each $q$.

For any given $q$, if $C_q=\emptyset$ we are done. If not, let $p_1\in C_q$, if $p_2\in C_q$, we can define $\theta=\angle p_2xp_1$, $d(p_1,p_2)=2q\sin{\frac{\theta}{2}}\in Q\Rightarrow \sin{\frac{\theta}{2}}\in Q$. Therefore it's sufficient to prove at most countably many $\theta$ satisfies $\sin{\frac{\theta}{2}}\in Q$.

To prove the last statement, for any given $s\in Q$ The solution set of $\sin{\frac{\theta}{2}}= s$ is $\emptyset$ (when $|s|>1$) or $\{\theta\mid \theta=2\arcsin{s}+4n\pi\}\cup \{\theta\mid \theta=2\pi-2\arcsin{s}+4n\pi\}$ where $n\in Z$. The solution set is clearly countable, because $Q$ is countable, the solution set of $\sin{\frac{\theta}{2}}\in Q$ is countable union of countable set, therefore countable.


You can do induction on $n$. If $n=1$, it is easy. Assume that the following statement $S(n)$ is true:

If $E\subset \mathbb R^n$ satisfies $d(x, y) \in \mathbb Q$ for all $x, y\in E$, then $E$ is countable.

Now let $E \subset \mathbb R^{n+1}$ so that $d(x, y) \in \mathbb Q$ for all $x, y\in E$. Assume it is uncountable. Then, like what you did, there is $x\in E$ and $r\in \mathbb Q$ so that $E_r = E \cap \partial B(x, r)$ is uncountable. Let $y\in E_r$. Then again, there is $p \in \mathbb Q$ so that

$$E_{r, q} = E_r \cap \partial B(y, p)$$

is uncountable. However, this $E_{r, p}$ lies in a intersection of two spheres in $\mathbb R^{n+1}$, thus lies in a hyperplane of $\mathbb R^{n+1}$. But by induction hypothesis $E_{r, p}$ has to be countable. This contradiction forces that $E$ is countable.

Thus the induction is done and $S(n)$ is true for all $n$.