Algorithm Search⌘K

Definitioncore

Cayley-Menger determinant

Also called Cayley-Menger matrix.

A bordered determinant of squared distances. It gives the squared volume of a simplex and tests whether given distances can be realized in d dimensions.

The Cayley-Menger determinant turns a table of squared distances into a volume. For k+1k + 1 points it is a single determinant of size k+2k + 2, built only from the squared distances between the points, and it equals the squared kk-dimensional volume of their simplex times a fixed constant. So it needs no coordinates. Its sign tells whether the distances can come from real points, and its vanishing tells whether the points fit in fewer dimensions. In geometric constraint solving it is the standard way to write a distance constraint system without coordinates.

Definition

Let p0,p1,…,pkp_0, p_1, \ldots, p_k be points in Rd\mathbb{R}^d and put Dij=∥pi−pj∥2D_{ij} = \lVert p_i - p_j \rVert^2. The Cayley-Menger matrix is the symmetric (k+2)×(k+2)(k + 2) \times (k + 2) matrix

M=(011⋯110D01⋯D0k1D100⋯D1k⋮⋮⋮⋱⋮1Dk0Dk1⋯0),M = \begin{pmatrix} 0 & 1 & 1 & \cdots & 1 \\ 1 & 0 & D_{01} & \cdots & D_{0k} \\ 1 & D_{10} & 0 & \cdots & D_{1k} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & D_{k0} & D_{k1} & \cdots & 0 \end{pmatrix},

the matrix DD of squared distances with a border of ones and a zero in the corner. Its determinant is the Cayley-Menger determinant, written CM(p0,…,pk)\mathrm{CM}(p_0, \ldots, p_k). The same formula applies to any symmetric table DD with zero diagonal, whether or not it comes from points. Then CM(D)\mathrm{CM}(D) is a polynomial of degree k+1k + 1 in the entries of DD.

Let VkV_k be the kk-dimensional volume of the simplex with vertices p0,…,pkp_0, \ldots, p_k: the length of a segment for k=1k = 1, the area of a triangle for k=2k = 2, the volume of a tetrahedron for k=3k = 3.

Theorem. For all points p0,…,pkp_0, \ldots, p_k,

CM(p0,…,pk)=(−1)k+1 2k (k!)2 Vk2.\mathrm{CM}(p_0, \ldots, p_k) = (-1)^{k + 1} \, 2^k \, (k!)^2 \, V_k^2 .

For k=1,2,3k = 1, 2, 3 this reads CM=2L2\mathrm{CM} = 2 L^2 for a segment of length LL, CM=−16A2\mathrm{CM} = -16 A^2 for a triangle of area AA, and CM=288V2\mathrm{CM} = 288 V^2 for a tetrahedron of volume VV.

Proof for the triangle. Write a=D12a = D_{12}, b=D02b = D_{02} and c=D01c = D_{01} for the squared side lengths. Expansion of the 4×44 \times 4 determinant gives

CM(p0,p1,p2)=det⁡(011110cb1c0a1ba0)=a2+b2+c2−2ab−2bc−2ca.\mathrm{CM}(p_0, p_1, p_2) = \det \begin{pmatrix} 0 & 1 & 1 & 1 \\ 1 & 0 & c & b \\ 1 & c & 0 & a \\ 1 & b & a & 0 \end{pmatrix} = a^2 + b^2 + c^2 - 2ab - 2bc - 2ca .

Now put u=p1−p0u = p_1 - p_0 and v=p2−p0v = p_2 - p_0. The parallelogram on uu and vv has area 2A2A, so 4A2=∥u∥2∥v∥2−(u⋅v)24A^2 = \lVert u \rVert^2 \lVert v \rVert^2 - (u \cdot v)^2. From ∥u−v∥2=∥u∥2+∥v∥2−2u⋅v\lVert u - v \rVert^2 = \lVert u \rVert^2 + \lVert v \rVert^2 - 2 u \cdot v we get u⋅v=(b+c−a)/2u \cdot v = (b + c - a)/2, with ∥u∥2=c\lVert u \rVert^2 = c and ∥v∥2=b\lVert v \rVert^2 = b. So

16A2=4bc−(b+c−a)2=2ab+2bc+2ca−a2−b2−c2=−CM(p0,p1,p2).16 A^2 = 4bc - (b + c - a)^2 = 2ab + 2bc + 2ca - a^2 - b^2 - c^2 = -\mathrm{CM}(p_0, p_1, p_2) .

This is Heron's formula written in squared lengths. □\square

Proof in general. The same idea works for every kk, through the Gram matrix. Put ui=pi−p0u_i = p_i - p_0 for i=1,…,ki = 1, \ldots, k and let GG be the k×kk \times k Gram matrix Gij=ui⋅ujG_{ij} = u_i \cdot u_j. As above, Gij=(D0i+D0j−Dij)/2G_{ij} = (D_{0i} + D_{0j} - D_{ij})/2.

Step 1: CM=(−1)k+12kdet⁡G\mathrm{CM} = (-1)^{k + 1} 2^k \det G. Index the rows and columns of the Cayley-Menger matrix by ∗,0,1,…,k\ast, 0, 1, \ldots, k, where ∗\ast is the border. For each i≥1i \ge 1 subtract row 00 from row ii, and then for each j≥1j \ge 1 subtract column 00 from column jj. These operations do not change the determinant. In the border row, the entries in columns j≥1j \ge 1 become 1−1=01 - 1 = 0, and in the border column the entries in rows i≥1i \ge 1 become 00 too. Row 00 keeps the entries 11, 00 and D0jD_{0j}. For i,j≥1i, j \ge 1 the entry becomes Dij−D0j−Di0+D00=−2GijD_{ij} - D_{0j} - D_{i0} + D_{00} = -2 G_{ij}. In block form, with δ=(D01,…,D0k)\delta = (D_{01}, \ldots, D_{0k}),

det⁡(01010δT0δ−2G).\det \begin{pmatrix} 0 & 1 & 0 \\ 1 & 0 & \delta^T \\ 0 & \delta & -2G \end{pmatrix} .

The border row has its only nonzero entry, a 1, in column 00, at position (1,2)(1, 2), so the expansion along it gives the factor −1-1 times the minor without row ∗\ast and column 00. That minor is block triangular, (1δT0−2G)\begin{pmatrix} 1 & \delta^T \\ 0 & -2G \end{pmatrix}, with determinant det⁡(−2G)=(−2)kdet⁡G\det(-2G) = (-2)^k \det G. So CM=−(−2)kdet⁡G=(−1)k+12kdet⁡G\mathrm{CM} = -(-2)^k \det G = (-1)^{k + 1} 2^k \det G.

Step 2: det⁡G=(k!)2Vk2\det G = (k!)^2 V_k^2. Choose an orthonormal basis of a kk-dimensional subspace that contains u1,…,uku_1, \ldots, u_k, and let UU be the k×kk \times k matrix of the coordinates of the uiu_i in it. Then G=UTUG = U^T U and det⁡G=(det⁡U)2\det G = (\det U)^2. The volume of the parallelepiped on u1,…,uku_1, \ldots, u_k is ∣det⁡U∣\lvert \det U \rvert, and the simplex is 1/k!1/k! of it, so ∣det⁡U∣=k! Vk\lvert \det U \rvert = k! \, V_k. □\square

Realizability. A symmetric table DD with zero diagonal on n+1n + 1 points is realizable in Rd\mathbb{R}^d if there are points p0,…,pnp_0, \ldots, p_n in Rd\mathbb{R}^d with ∥pi−pj∥2=Dij\lVert p_i - p_j \rVert^2 = D_{ij} for all i,ji, j. For a set S⊆{1,…,n}S \subseteq \{1, \ldots, n\} write CMS\mathrm{CM}_S for the Cayley-Menger determinant of DD restricted to {0}∪S\{0\} \cup S.

Theorem (Schoenberg 1935, in Cayley-Menger form). DD is realizable in some Euclidean space if and only if (−1)∣S∣+1CMS≥0(-1)^{\lvert S \rvert + 1} \mathrm{CM}_S \ge 0 for every nonempty SS. It is realizable in Rd\mathbb{R}^d if and only if, in addition, CMS=0\mathrm{CM}_S = 0 for every SS with ∣S∣=d+1\lvert S \rvert = d + 1.

Proof. Define GG from DD by Gij=(D0i+D0j−Dij)/2G_{ij} = (D_{0i} + D_{0j} - D_{ij})/2 for i,j=1,…,ni, j = 1, \ldots, n. Step 1 above used only the entries of DD, so it gives (−1)∣S∣+1CMS=2∣S∣det⁡GS(-1)^{\lvert S \rvert + 1} \mathrm{CM}_S = 2^{\lvert S \rvert} \det G_S for the principal submatrix GSG_S. A symmetric matrix is positive semidefinite exactly when all of its principal minors are nonnegative, so the sign condition says that GG is positive semidefinite. If DD comes from points, then GG is the Gram matrix of the vectors pi−p0p_i - p_0, which is positive semidefinite of rank at most dd. Conversely, if GG is positive semidefinite of rank rr, write G=UTUG = U^T U with UU of size r×nr \times n, from an eigenvalue decomposition. Put p0=0p_0 = 0 and let pip_i be column ii of UU. Then pi⋅pj=Gijp_i \cdot p_j = G_{ij}, so ∥pi−pj∥2=Gii+Gjj−2Gij=Dij\lVert p_i - p_j \rVert^2 = G_{ii} + G_{jj} - 2 G_{ij} = D_{ij} and ∥pi∥2=Gii=D0i\lVert p_i \rVert^2 = G_{ii} = D_{0i}. These points lie in Rr\mathbb{R}^r. Finally, a positive semidefinite matrix has rank at most dd exactly when all of its principal minors of order d+1d + 1 vanish, which is the condition CMS=0\mathrm{CM}_S = 0 for ∣S∣=d+1\lvert S \rvert = d + 1. □\square

The proof is also the algorithm used in practice: build GG, take an eigenvalue decomposition, and read off coordinates. This is classical multidimensional scaling, which on noisy data keeps the dd largest eigenvalues.

Examples and non-examples

All values are exact.

  • A segment. For p0=(0,0)p_0 = (0, 0) and p1=(3,4)p_1 = (3, 4), D01=25D_{01} = 25 and CM=det⁡(01110251250)=50=2⋅52\mathrm{CM} = \det \begin{pmatrix} 0 & 1 & 1 \\ 1 & 0 & 25 \\ 1 & 25 & 0 \end{pmatrix} = 50 = 2 \cdot 5^2.
  • The 3, 4, 5 triangle. For (0,0)(0, 0), (4,0)(4, 0) and (0,3)(0, 3), the squared sides are 1616, 99 and 2525. Then a2+b2+c2=962a^2 + b^2 + c^2 = 962 and 2(ab+bc+ca)=15382(ab + bc + ca) = 1538, so CM=−576=−16⋅62\mathrm{CM} = -576 = -16 \cdot 6^2. The area is 6.
  • Tetrahedra. The tetrahedron (0,0,0)(0, 0, 0), (1,0,0)(1, 0, 0), (0,1,0)(0, 1, 0), (0,0,1)(0, 0, 1) has volume 1/61/6 and CM=8=288/36\mathrm{CM} = 8 = 288 / 36. The tetrahedron (0,0,0)(0, 0, 0), (2,0,0)(2, 0, 0), (0,3,0)(0, 3, 0), (0,0,4)(0, 0, 4) has volume 4, Gram determinant 576=(3!⋅4)2576 = (3! \cdot 4)^2, and CM=4608=288⋅16\mathrm{CM} = 4608 = 288 \cdot 16.
  • Flat simplices. Points 0,1,30, 1, 3 on a line have squared distances 1,9,41, 9, 4, and CM=98−98=0\mathrm{CM} = 98 - 98 = 0. The four corners of the unit square give CM=0\mathrm{CM} = 0, as does any set of five points in R3\mathbb{R}^3, since their simplex has no 4-dimensional volume.
  • Lengths that are not a triangle. The lengths 1,1,31, 1, 3 break the triangle inequality. The squared lengths 1,1,91, 1, 9 give CM=83−38=45>0\mathrm{CM} = 83 - 38 = 45 > 0, so −16A2=45-16 A^2 = 45 has no real solution and no triangle has these sides. For three points the sign condition of the realizability theorem is exactly the triangle inequality.
  • A distance constraint from a determinant. Take the rectangle A=(0,0)A = (0, 0), B=(4,0)B = (4, 0), C=(4,3)C = (4, 3), D=(0,3)D = (0, 3) and forget x=∣BD∣2x = \lvert BD \rvert^2. The other five squared distances are ∣AB∣2=16\lvert AB \rvert^2 = 16, ∣BC∣2=9\lvert BC \rvert^2 = 9, ∣CD∣2=16\lvert CD \rvert^2 = 16, ∣DA∣2=9\lvert DA \rvert^2 = 9 and ∣AC∣2=25\lvert AC \rvert^2 = 25. Four points in the plane need CM(A,B,C,D)=0\mathrm{CM}(A, B, C, D) = 0, which as a function of xx is
−50x2+1348x−2450=−2(25x2−674x+1225)=0,-50 x^2 + 1348 x - 2450 = -2 (25 x^2 - 674 x + 1225) = 0,

with roots x=25x = 25 and x=49/25x = 49/25. The root 25 is the rectangle. The root 49/2549/25 belongs to the other placement of DD, its mirror image (72/25,−21/25)(72/25, -21/25) in the diagonal ACAC, which keeps ∣AD∣2=9\lvert AD \rvert^2 = 9 and ∣CD∣2=16\lvert CD \rvert^2 = 16. This is the two-solution choice of a circle-circle intersection, written without coordinates, and the choice between the roots is the root identification problem. For xx strictly between the roots, CM>0\mathrm{CM} > 0, which is 288V2288 V^2 of a real tetrahedron: the triangle ACDACD turned out of the plane about ACAC.

  • Non-example: unsquared distances. The determinant must be formed from squared distances. With the plain lengths 3,4,53, 4, 5 in place of 9,16,259, 16, 25 the identity fails, since the matrix entries enter the volume formula through the Gram matrix, which is linear in the squares.
  • Non-example: one sign condition is not enough. Take five points with squared distances D01=1D_{01} = 1, D02=6D_{02} = 6, D03=4D_{03} = 4, D04=1D_{04} = 1, D12=3D_{12} = 3, D13=8D_{13} = 8, D14=7D_{14} = 7, D23=1D_{23} = 1, D24=9D_{24} = 9 and D34=3D_{34} = 3. The Gram matrix has det⁡G=1101/16>0\det G = 1101/16 > 0, so CM=−1101\mathrm{CM} = -1101 has the sign of a real 4-simplex. Yet the face p0p1p4p_0 p_1 p_4 has lengths 1,1,71, 1, \sqrt 7, which break the triangle inequality, and its determinant is 51−30=21>051 - 30 = 21 > 0. A symmetric matrix with a positive determinant can have negative principal minors, which is why the theorem asks for the sign condition on every subset.
  • Gram matrix and distance matrix. The map D↦GD \mapsto G with Gij=(D0i+D0j−Dij)/2G_{ij} = (D_{0i} + D_{0j} - D_{ij})/2 and its inverse Dij=Gii+Gjj−2GijD_{ij} = G_{ii} + G_{jj} - 2G_{ij} convert between squared distances and inner products. Classical multidimensional scaling uses the centred form of the same map.
  • Distance geometry problem. When only some of the distances are given, realizability asks for values of the missing entries that make all the Cayley-Menger conditions hold. The missing entries enter the determinants as unknowns, so the conditions become polynomial equations and inequalities. Deciding them is NP-hard already on a line.
  • Rigidity matrix. The rigidity matrix is the derivative of the squared lengths with respect to coordinates. The Cayley-Menger approach drops the coordinates and works with the squared lengths themselves as unknowns.
  • Distance constraint solving. For a bar-and-joint framework built by adding one point at a time, as in constructive constraint solving, each new point in the plane lies on a triangle, and each in space on a tetrahedron, whose Cayley-Menger determinant gives the new distances in closed form.
  • Semidefinite relaxation. Realizability in some dimension is the positive semidefiniteness of GG, a linear matrix inequality in the unknown squared distances, so it can be handled by semidefinite programming. The rank condition for Rd\mathbb{R}^d is not convex, and dropping it is the usual relaxation.

References

  1. Arthur Cayley, On a theorem in the geometry of position, Cambridge Mathematical Journal 2, 267 to 271, 1841, the determinant relation between the ten distances of five points in space and the six of four points in a plane
  2. Karl Menger, Untersuchungen über allgemeine Metrik, Mathematische Annalen 100, 75 to 163, 1928, the bordered determinant of squared distances and the characterization of subsets of Euclidean space by distances alone
  3. I. J. Schoenberg, Remarks to Maurice Fréchet's article "Sur la définition axiomatique d'une classe d'espaces distanciés vectoriellement applicable sur l'espace de Hilbert", Annals of Mathematics 36(3), 724 to 732, 1935, a symmetric matrix with zero diagonal is a matrix of squared Euclidean distances if and only if the derived Gram matrix is positive semidefinite
  4. Leonard M. Blumenthal, Theory and Applications of Distance Geometry, Oxford, Clarendon Press, 1953, the chapters on Cayley-Menger determinants and on the embedding of semimetric spaces in Euclidean space
  5. Leo Liberti, Carlile Lavor, Nelson Maculan and Antonio Mucherino, Euclidean distance geometry and applications, SIAM Review 56(1), 3 to 69, 2014, the sections on Cayley-Menger determinants, Gram matrices and realizability

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/T3G9B4/text.yaml