# Distance geometry

Distance geometry is the branch of mathematics concerned with characterizing and studying sets of points based only on given values of the distances between pairs of points. More abstractly, it is the study of semimetric spaces and the isometric transformations between them. In this view, it can be considered as a subject within general topology.
Historically, the first result in distance geometry is Heron's formula in 1st century AD. The modern theory began in 19th century with work by Arthur Cayley, followed by more extensive developments in the 20th century by Karl Menger and others.
Distance geometry problems arise whenever one needs to infer the shape of a configuration of points (relative positions) from the distances between them, such as in biology, sensor networks, surveying, navigation, cartography, and physics.

## Introduction and definitions

The concepts of distance geometry will first be explained by describing two particular problems.

### First problem: hyperbolic navigation

Consider three ground radio stations A, B, C, whose locations are known. A radio receiver is at an unknown location. The times it takes for a radio signal to travel from the stations to the receiver, $t_{A},t_{B},t_{C}$, are unknown, but the time differences, $t_{A}-t_{B}$ and $t_{A}-t_{C}$, are known. From them, one knows the distance differences $c(t_{A}-t_{B})$ and $c(t_{A}-t_{C})$, from which the position of the receiver can be found.

### Second problem: dimension reduction

In data analysis, one is often given a list of data represented as vectors $\mathbf {v} =(x_{1},\ldots ,x_{n})\in \mathbb {R} ^{n}$, and one needs to find out whether they lie within a low-dimensional affine subspace. A low-dimensional representation of data has many advantages, such as saving storage space, computation time, and giving better insight into data.

### Definitions

Now we formalize some definitions that naturally arise from considering our problems.

#### Semimetric space

Given a list of points on $R=\{P_{0},\ldots ,P_{n}\}$, $n\geq 0$, we can arbitrarily specify the distances between pairs of points by a list of $d_{ij}>0$, $0\leq i<j\leq n$. This defines a semimetric space: a metric space without triangle inequality.
Explicitly, we define a semimetric space as a nonempty set $R$ equipped with a semimetric $d:R\times R\to [0,\infty )$ such that, for all $x,y\in R$,
* Positivity: $d(x,y)=0$ if and only if $x=y$.
* Symmetry: $d(x,y)=d(y,x)$.
Any metric space is a fortiori a semimetric space. In particular, $\mathbb {R} ^{k}$, the $k$-dimensional Euclidean space, is the canonical metric space in distance geometry.
The triangle inequality is omitted in the definition, because we do not want to enforce more constraints on the distances $d_{ij}$ than the mere requirement that they be positive.
In practice, semimetric spaces naturally arise from inaccurate measurements. For example, given three points $A,B,C$ on a line, with $d_{AB}=1,d_{BC}=1,d_{AC}=2$, an inaccurate measurement could give $d_{AB}=0.99,d_{BC}=0.98,d_{AC}=2.00$, violating the triangle inequality.

#### Isometric embedding

Given two semimetric spaces, $(R,d),(R',d')$, an isometric embedding from $R$ to $R'$ is a map $f:R\to R'$ that preserves the semimetric, that is, for all $x,y\in R$, $d(x,y)=d'(f(x),f(y))$.
For example, given the finite semimetric space $(R,d)$ defined above, an isometric embedding from $R$ to $\mathbb {R} ^{k}$ is defined by points A$_0$, A$_1$, …, A$_n$∈R$^k${\textstyle A_{0}, A_{1}, \ldots , A_{n}\in \mathbb {R} ^{k}}, such that $d(A_{i},A_{j})=d_{ij}$ for all $0\leq i<j\leq n$.

#### Affine independence

Given the points A$_0$, A$_1$, …, A$_n$∈R$^k${\textstyle A_{0}, A_{1}, \ldots , A_{n}\in \mathbb {R} ^{k}}, they are defined to be affinely independent, iff they cannot fit inside a single $l$-dimensional affine subspace of $\mathbb {R} ^{k}$, for any $\ell <n$, iff the $n$-simplex they span, $v_{n}$, has positive $n$-volume, that is, $\operatorname {Vol} _{n}(v_{n})>0$.
In general, when $k\geq n$, they are affinely independent, since a generic n-simplex is nondegenerate. For example, 3 points in the plane, in general, are not collinear, because the triangle they span does not degenerate into a line segment. Similarly, 4 points in space, in general, are not coplanar, because the tetrahedron they span does not degenerate into a flat triangle.
When $n>k$, they must be affinely dependent. This can be seen by noting that any $n$-simplex that can fit inside $\mathbb {R} ^{k}$ must be "flat".

## Cayley–Menger determinants

Cayley–Menger determinants, named after Arthur Cayley and Karl Menger, are determinants of matrices of distances between sets of points.
Let A$_0$, A$_1$, …, A$_n${\textstyle A_{0}, A_{1}, \ldots , A_{n}} be n + 1 points in a semimetric space, their Cayley–Menger determinant is defined by
    $\operatorname {CM} (A_{0},\cdots ,A_{n})={\begin{vmatrix}0&d_{01}^{2}&d_{02}^{2}&\cdots &d_{0n}^{2}&1\\d_{01}^{2}&0&d_{12}^{2}&\cdots &d_{1n}^{2}&1\\d_{02}^{2}&d_{12}^{2}&0&\cdots &d_{2n}^{2}&1\\\vdots &\vdots &\vdots &\ddots &\vdots &\vdots \\d_{0n}^{2}&d_{1n}^{2}&d_{2n}^{2}&\cdots &0&1\\1&1&1&\cdots &1&0\end{vmatrix}}$
If A$_0$, A$_1$, …, A$_n$∈R$^k${\textstyle A_{0}, A_{1}, \ldots , A_{n}\in \mathbb {R} ^{k}}, then they make up the vertices of a possibly degenerate n-simplex $v_{n}$ in $\mathbb {R} ^{k}$. It can be shown that the n-dimensional volume of the simplex $v_{n}$ satisfies
    $\operatorname {Vol} _{n}(v_{n})^{2}={\frac {(-1)^{n+1}}{(n!)^{2}2^{n}}}\operatorname {CM} (A_{0},\ldots ,A_{n}).$
Note that, for the case of $n=0$, we have $\operatorname {Vol} _{0}(v_{0})=1$, meaning the "0-dimensional volume" of a 0-simplex is 1, that is, there is 1 point in a 0-simplex.
A$_0$, A$_1$, …, A$_n${\textstyle A_{0}, A_{1}, \ldots , A_{n}} are affinely independent iff $\operatorname {Vol} _{n}(v_{n})>0$, that is, $(-1)^{n+1}\operatorname {CM} (A_{0},\ldots ,A_{n})>0$. Thus Cayley–Menger determinants give a computational way to prove affine independence.
If $k<n$, then the points must be affinely dependent, thus $\operatorname {CM} (A_{0},\ldots ,A_{n})=0$. Cayley's 1841 paper studied the special case of $k=3,n=4$, that is, any five points $A_{0},\ldots ,A_{4}$ in 3-dimensional space must have $\operatorname {CM} (A_{0},\ldots ,A_{4})=0$.

## History

The first result in distance geometry is Heron's formula, from 1st century AD, which gives the area of a triangle from the distances between its 3 vertices. Brahmagupta's formula, from 7th century AD, generalizes it to cyclic quadrilaterals. Tartaglia, from 16th century AD, generalized it to give the volume of tetrahedron from the distances between its 4 vertices.
The modern theory of distance geometry began with Arthur Cayley and Karl Menger. Cayley published the Cayley determinant in 1841, which is a special case of the general Cayley–Menger determinant. Menger proved in 1928 a characterization theorem of all semimetric spaces that are isometrically embeddable in the n-dimensional Euclidean space $\mathbb {R} ^{n}$. In 1931, Menger used distance relations to give an axiomatic treatment of Euclidean geometry.
Leonard Blumenthal's book gives a general overview for distance geometry at the graduate level, a large part of which is treated in English for the first time when it was published.

## Menger characterization theorem

Menger proved the following characterization theorem of semimetric spaces:
   A semimetric space $(R,d)$ is isometrically embeddable in the $n$-dimensional Euclidean space $\mathbb {R} ^{n}$, but not in $\mathbb {R} ^{m}$ for any $0\leq m<n$, if and only if:
   * $R$ contains an $(n+1)$-point subset $S$ that is isometric with an affinely independent $(n+1)$-point subset of $\mathbb {R} ^{n}$;
   * any $(n+3)$-point subset $S'$, obtained by adding any two additional points of $R$ to $S$, is congruent to an $(n+3)$-point subset of $\mathbb {R} ^{n}$.
A proof of this theorem in a slightly weakened form (for metric spaces instead of semimetric spaces) is in.

## Characterization via Cayley–Menger determinants

The following results are proved in Blumethal's book.

### Embedding n + 1 points in the real numbers

Given a semimetric space $(S,d)$ , with $S=\{P_{0},\ldots ,P_{n}\}$, and $d(P_{i},P_{j})=d_{ij}\geq 0$, $0\leq i<j\leq n$, an isometric embedding of $(S,d)$ into $\mathbb {R} ^{n}$ is defined by A$_0$, A$_1$, …, A$_n$∈R$^n${\textstyle A_{0}, A_{1}, \ldots , A_{n}\in \mathbb {R} ^{n}}, such that $d(A_{i},A_{j})=d_{ij}$ for all $0\leq i<j\leq n$.
Again, one asks whether such an isometric embedding exists for $(S,d)$.
A necessary condition is easy to see: for all $k=1,\ldots ,n$, let $v_{k}$ be the k-simplex formed by A$_0$, A$_1$, …, A$_k${\textstyle A_{0}, A_{1}, \ldots , A_{k}}, then
    $(-1)^{k+1}\operatorname {CM} (P_{0},\ldots ,P_{k})=(-1)^{k+1}\operatorname {CM} (A_{0},\ldots ,A_{k})=2^{k}(k!)^{k}\operatorname {Vol} _{k}(v_{k})^{2}\geq 0$
The converse also holds. That is, if for all $k=1,\ldots ,n$,
    $(-1)^{k+1}\operatorname {CM} (P_{0},\ldots ,P_{k})\geq 0,$
then such an embedding exists.
Further, such embedding is unique up to isometry in $\mathbb {R} ^{n}$. That is, given any two isometric embeddings defined by $A_{0},A_{1},\ldots ,A_{n}$, and $A'_{0},A'_{1},\ldots ,A'_{n}$, there exists a (not necessarily unique) isometry $T:\mathbb {R} ^{n}\to \mathbb {R} ^{n}$, such that $T(A_{k})=A'_{k}$ for all $k=0,\ldots ,n$. Such $T$ is unique if and only if $\operatorname {CM} (P_{0},\ldots ,P_{n})\neq 0$, that is, $A_{0},A_{1},\ldots ,A_{n}$ are affinely independent.

### Embedding n + 2 and n + 3 points

If $n+2$ points $P_{0},\ldots ,P_{n+1}$ can be embedded in $\mathbb {R} ^{n}$ as $A_{0},\ldots ,A_{n+1}$, then other than the conditions above, an additional necessary condition is that the $(n+1)$-simplex formed by $A_{0},A_{1},\ldots ,A_{n+1}$, must have no $(n+1)$-dimensional volume. That is, $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+1})=0$.
The converse also holds. That is, if for all $k=1,\ldots ,n$,
    $(-1)^{k+1}\operatorname {CM} (P_{0},\ldots ,P_{k})\geq 0,$
and
    $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+1})=0,$
then such an embedding exists.
For embedding $n+3$ points in $\mathbb {R} ^{n}$, the necessary and sufficient conditions are similar:
* For all $k=1,\ldots ,n$, $(-1)^{k+1}\operatorname {CM} (P_{0},\ldots ,P_{k})\geq 0$;
* $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+1})=0;$
* $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+2})=0;$
* $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+1},P_{n+2})=0.$

### Embedding arbitrarily many points

The $n+3$ case turns out to be sufficient in general.
In general, given a semimetric space $(R,d)$, it can be isometrically embedded in $\mathbb {R} ^{n}$ if and only if there exists $P_{0},\ldots ,P_{n}\in R$, such that, for all $k=1,\ldots ,n$, $(-1)^{k+1}\operatorname {CM} (P_{0},\ldots ,P_{k})\geq 0$, and for any $P_{n+1},P_{n+2}\in R$,
* $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+1})=0;$
* $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+2})=0;$
* $\operatorname {CM} (P_{0},\ldots ,P_{n},P_{n+1},P_{n+2})=0.$
And such embedding is unique up to isometry in $\mathbb {R} ^{n}$.
Further, if $\operatorname {CM} (P_{0},\ldots ,P_{n})\neq 0$, then it cannot be isometrically embedded in any $\mathbb {R} ^{m},m<n$. And such embedding is unique up to unique isometry in $\mathbb {R} ^{n}$.
Thus, Cayley–Menger determinants give a concrete way to calculate whether a semimetric space can be embedded in $\mathbb {R} ^{n}$, for some finite $n$, and if so, what is the minimal $n$.

## Applications

There are many applications of distance geometry.
In telecommunication networks such as GPS, the positions of some sensors are known (which are called anchors) and some of the distances between sensors are also known: the problem is to identify the positions for all sensors. Hyperbolic navigation is one pre-GPS technology that uses distance geometry for locating ships based on the time it takes for signals to reach anchors.
There are many applications in chemistry. Techniques such as NMR can measure distances between pairs of atoms of a given molecule, and the problem is to infer the 3-dimensional shape of the molecule from those distances.
Some software packages for applications are:
* DGSOL. Solves large distance geometry problems in macromolecular modeling.
* Xplor-NIH. Based on X-PLOR, to determine the structure of molecules based on data from NMR experiments. It solves distance geometry problems with heuristic methods (such as simulated annealing) and local search methods (such as conjugate gradient minimization).
* TINKER. Molecular modeling and design. It can solve distance geometry problems.
* SNLSDPclique. MATLAB code for locating sensors in a sensor network based on the distances between the sensors.