Feasibility of a list of prescribed distances in R^3

Let us label the points $x_0,x_1,\dots,x_m$. For each pair $(x_i,x_j)$ prescribe the a value from your list; denote it by say $d(x_i,x_j)$. If there are no repititions then all together you have $N=[m{\cdot}(m+1)]!$ ways to do this.

Note that $d(x_i,x_j)$ completely determine "$m\times m$-matrix of scalar products" $$a_{ij}=\tfrac12\cdot[d^2(x_0,x_i)+d^2(x_0,x_j)-d^2(x_i,x_j)].$$

You need to answer two questions for each of obtained $N$ matrices:

  • $(a_{ij})$ defines a non-negative quadratic form

  • $\mathop{\rm rank}(a_{ij})\leqslant 3$.

If for one matrix the answers are YES to both then the answer to your question is also YES (and vise versa).

P.S. Apparently the statement I used is called Schoenberg criterion; thanks to Piotr Hajlasz for pointing this out.


What did not seem to be mentioned in this old thread is that this is a well-studied problem that goes under the name distance geometry, which Wikipedia defines as "the characterization and study of sets of points based only on given values of the distances between member pairs." The problem has applications especially to molecular structure. Crippen and Havel published a book on this in 1988: Distance geometry and molecular conformation (Research Studies Press, Taunton, Somerset, England), with an update by Crippen later ("Chemical distance geometry: Current realization and future projection"). There are many papers on the topic, published in venues like the Journal of Computational Chemistry, e.g., "Molecular conformations from distance matrices" (Volume 14, Issue 1, pages 114–120, January 1993). Because of the many applications, there are software packages developed to solve the problem; the Wikipedia article has a list. The problem is computationally intractable; the proof that one version is NP-hard goes back to a 1979 paper by Saxe, "Embeddability of weighted graphs in $k$-space is strongly NP-hard."


Embedded in Anton's answer are the following two aspects of the problem:

  • You first need to decide (or be given) the combinatorial structure of the graph you want to embed, i.e., assign the n distances to the n pairs of points in some way. There will be some symmetries, but not enough to avoid this step; even when m = 4, n = 6, you need to decide which pairs of edges of the tetrahedron will be opposite.

  • Once you have done that, checking the triangle inequality for all triples of points is not sufficient. For example, consider 5 points in R4 which do not lie in a hyperplane. The 10-tuple of distances between these points determines the set of 5 points up to a rigid motion (or reflection) of R4. In particular, we cannot find 5 points in R3 with the prescribed distances between pairs. Yet obviously all the triangle inequalities are satisfied.