Can every set of points with rational distance squares be isometrically embedded in $\Bbb Q^d$? Suppose we are given a finite family of points $p_1,...,p_n\in \Bbb R^d$, so that any two points have a rational distance square, that is,
$$\|p_i-p_j\|^2\in\Bbb Q,\quad\text{for all $i,j\in\{1,...,n\}$}.$$
Is it know whether these points can be isometrically embedded into $\Bbb Q^{D}$ for some sufficiently large $D\ge d$? That is, are there $q_1,...,q_n\in\smash{\Bbb Q^D}$ so that
$$\|p_i-p_j\|=\|q_i-q_j\|,\quad\text{for all $i,j\in\{1,...,n\}$}?$$
If yes, what are reasonable lower/upper bounds for $D$?
 A: Yes. It's well-known fact due to Schönberg that a negative definite kernel on a finite set $X$ (with zero diagonal) can be realized as set of square distances on a Euclidean space. The latter is constructed with an explicit (possibly indefinite) positive scalar product on $\mathbf{R}^X$, which depends linearly on coefficients of the kernel, and modding out by the kernel of this scalar product to get the Euclidean space. So if the kernel is rational, everything remains rational.
A: The following argument gives a bound of $D =4d$, based on a suggestion of LSpice in the comments.
Set $p_1=0$. Using the distances and the fact that $p_1=0$, we can find the dot products $p_i \cdot p_j$, which are all rational.
Assume we've embedded $p_1,\dots,p_k$ in $\mathbb Q^m$ and let's embed $p_{k+1}$. The result will then follow by induction on $k$.
Among $p_2,\dots, p_k$ we can find $r$ of them that form a basis for the space $V_k$ generated by $p_2,\dots, p_k$. Then every vector in $V_k$ whose dot products with these $r$ vectors are rational is a rational linear combination of these vectors (invert the matrix) and thus lies in $\mathbb Q^m$. Hence the projection of $p_{k+1}$ onto $V_k$ lies in $\mathbb Q^m$.
If $p_{k+1}$ lies in $V_k$, we are done. Otherwise, $p_{k+1}$ is equal to its projection onto $V_k$ plus a vector orthogonal to $V_k$. The length-squared of this orthogonal vector is rational. Choose a vector of that length-squared in $\mathbb Q^4$, and let $p_{k+1}$ equal its projection plus this vector in $\mathbb Q^{m+4}$.
The total value of $D$ produced this way is $4d$ since $D$ goes up by $4$ every time $d$ goes up by $1$.

For a better value of $D=d+3$, we can use the following trick to reduce the dimension:
Let $W$ be the orthogonal complement in $\mathbb Q^{4d}$ of the vector space generated by $p_1,\dots, p_n$. If we find a vector in $W$ with length $1$, its orthogonal complement is isomorphic, as a vector space over $\mathbb Q$ with quadratic form, to $\mathbb Q^{4d-1}$. Iterating this, we can embed $p_1,\dots, p_n$ into $\mathbb Q^N$ for some $N$ in such a way that $p_1=0$ and the orthogonal complement to the vector space generated by $p_1,\dots, p_n$ contains no vectors of length $1$.
By the Hasse-Minkowski theorem, the only way a positive definite quadratic form over the rationals can fail to represent $1$ is if there is a $p$-adic obstruction for some $p$, which can only happen if the dimension is at most $3$, so the dimension of the orthogonal complement is at most $3$ and $N \leq d+3$, as desired.
