In mathematics, a Euclidean distance matrix is an matrix representing the spacing of a set of points in Euclidean space.For points
x1,x2,\ldots,xn
\begin{align} A&=(aij);\\ aij&=
2 | |
d | |
ij |
= \lVertxi-
2 \end{align} | |
x | |
j\rVert |
where
\| ⋅ \|
A=\begin{bmatrix} 0&
2 | |
d | |
12 |
&
2 | |
d | |
13 |
&...&
2 | |
d | |
1n |
2 | |
\\ d | |
21 |
&0&
2 | |
d | |
23 |
&...&
2 | |
d | |
2n |
2 | |
\\ d | |
31 |
&
2 | |
d | |
32 |
&0&...&
2 | |
d | |
3n |
\\ \vdots&\vdots&\vdots&\ddots&\vdots&
2 | |
\\ d | |
n1 |
&
2 | |
d | |
n2 |
&
2 | |
d | |
n3 |
&...&0\\ \end{bmatrix}
In the context of (not necessarily Euclidean) distance matrices, the entries are usually defined directly as distances, not their squares.However, in the Euclidean case, squares of distances are used to avoid computing square roots and to simplify relevant theorems and algorithms.
Euclidean distance matrices are closely related to Gram matrices (matrices of dot products, describing norms of vectors and angles between them).The latter are easily analyzed using methods of linear algebra.This allows to characterize Euclidean distance matrices and recover the points
x1,x2,\ldots,xn
In practical applications, distances are noisy measurements or come from arbitrary dissimilarity estimates (not necessarily metric).The goal may be to visualize such data by points in Euclidean space whose distance matrix approximates a given dissimilarity matrix as well as possible — this is known as multidimensional scaling.Alternatively, given two sets of data already represented by points in Euclidean space, one may ask how similar they are in shape, that is, how closely can they be related by a distance-preserving transformation — this is Procrustes analysis.Some of the distances may also be missing or come unlabelled (as an unordered set or multiset instead of a matrix), leading to more complex algorithmic tasks, such as the graph realization problem or the turnpike problem (for points on a line).
By the fact that Euclidean distance is a metric, the matrix has the following properties.
aij=aji
\sqrt{aij
aij\ge0
In dimension, a Euclidean distance matrix has rank less than or equal to . If the points
x1,x2,\ldots,xn
Distances can be shrunk by any power to obtain another Euclidean distance matrix. That is, if
A=(aij)
({aij
The Gram matrix of a sequence of points
x1,x2,\ldots,xn
G=(gij)
xi
gij=xi ⋅ xj=\|xi\|\|xj\|\cos\theta
\theta
xi
xj
gii=
2 | |
\|x | |
i\| |
xi
x1,x2,\ldots,xn
Let
X
x1,x2,\ldots,xn
G=Xsf{T}X
gij=
sf{T}x | |
x | |
j |
xi
Xsf{T}X
X
To relate the Euclidean distance matrix to the Gram matrix, observe that
2 | |
d | |
ij |
=\|xi-
2 | |
x | |
j\| |
=(xi-
sf{T}(x | |
x | |
i |
-xj)=
sf{T}x | |
x | |
i |
-
sf{T}x | |
2x | |
j |
+
sf{T}x | |
x | |
j |
=gii-2gij+gjj
That is, the norms and angles determine the distances.Note that the Gram matrix contains additional information: distances from 0.
Conversely, distances
dij
x0,x1,\ldots,xn
xi-x0
gij=(xi-x0) ⋅ (xj-x0)=
1 | |
2 |
\left(\|xi-x
2 | |
0\| |
+\|xj-x
2 | |
0\| |
-\|xi-
2 | |
x | |
j\| |
\right)=
1 | |
2 |
2 | |
(d | |
0i |
+
2 | |
d | |
0j |
-
2) | |
d | |
ij |
For a matrix, a sequence of points
x1,x2,\ldots,xn
x1=0
-x1
This follows from the previous discussion because is positive semidefinite of rank at most if and only if it can be decomposed as
G=Xsf{T}X
The statement of theorem distinguishes the first point
x1
Other characterizations involve Cayley–Menger determinants.In particular, these allow to show that a symmetric hollow matrix is realizable in if and only if every principal submatrix is.In other words, a semimetric on finitely many points is embedabble isometrically in if and only if every points are.[3]
In practice, the definiteness or rank conditions may fail due to numerical errors, noise in measurements, or due to the data not coming from actual Euclidean distances.Points that realize optimally similar distances can then be found by semidefinite approximation (and low rank approximation, if desired) using linear algebraic tools such as singular value decomposition or semidefinite programming.This is known as multidimensional scaling.Variants of these methods can also deal with incomplete distance data.
Unlabeled data, that is, a set or multiset of distances not assigned to particular pairs, is much more difficult to deal with.Such data arises, for example, in DNA sequencing (specifically, genome recovery from partial digest) or phase retrieval.Two sets of points are called homometric if they have the same multiset of distances (but are not necessarily related by a rigid transformation).Deciding whether a given multiset of distances can be realized in a given dimension is strongly NP-hard.In one dimension this is known as the turnpike problem; it is an open question whether it can be solved in polynomial time.When the multiset of distances is given with error bars, even the one dimensional case is NP-hard.Nevertheless, practical algorithms exist for many cases, e.g. random points.[4] [5] [6]
Given a Euclidean distance matrix, the sequence of points that realize it is unique up to rigid transformations – these are isometries of Euclidean space: rotations, reflections, translations, and their compositions.
Rigid transformations preserve distances so one direction is clear.Suppose the distances
\|xi-xj\|
\|yi-yj\|
x1=y1=bf{0}
-x1
-y1
xi=xi-x1
yi
Xsf{T}X=Ysf{T}Y
xi
yi
T(x)=Q(x-x1)+y1
In applications, when distances don't match exactly, Procrustes analysis aims to relate two point sets as close as possible via rigid transformations, usually using singular value decomposition.The ordinary Euclidean case is known as the orthogonal Procrustes problem or Wahba's problem (when observations are weighted to account for varying uncertainties).Examples of applications include determining orientations of satellites, comparing molecule structure (in cheminformatics), protein structure (structural alignment in bioinformatics), or bone structure (statistical shape analysis in biology).