TITLE: Is Tolkien's Middle Earth flat?
QUESTION [45 upvotes]: In the first introductory chapter of his book Gravitation and cosmology: principles and applications of the general theory of relativity Steven Weinberg discusses the origin of non-euclidean geometries and the "inner properties" of surfaces.
He mentions that distances between all pairs of 4 points on a flat surface satisfy a particular relation:
$$\begin{align}
0 &= d_{12}^4d_{34}^2 + d_{13}^4d_{24}^2 + d_{14}^4d_{23}^2 + d_{23}^4d_{14}^2 + d_{24}^4d_{13}^2 + d_{34}^4 d_{12}^2\\
&\phantom{{}=} + d_{12}^2 d_{23}^2 d_{31}^2 + d_{12}^2 d_{24}^2d_{41}^2 + d_{13}^2d_{34}^2d_{41}^2 + d_{23}^2d_{34}^2d_{42}^2\\
&\phantom{{}=} - d_{12}^2d_{23}^2d_{34}^2- d_{13}^2d_{32}^2d_{24}^2 - d_{12}^2d_{24}^2d_{43}^2 -   d_{14}^2d_{42}^2d_{23}^2\\
&\phantom{{}=} - d_{13}^2d_{34}^2d_{42}^2 - d_{14}^2d_{43}^2d_{32}^2 - d_{23}^2d_{31}^2d_{14}^2 - d_{21}^2d_{13}^2d_{34}^2\\
&\phantom{{}=} - d_{24}^2d_{41}^2d_{13}^2 - d_{21}^2d_{14}^2d_{43}^2 - d_{31}^2d_{12}^2d_{24}^2 - d_{32}^2d_{21}^2d_{14}^2
\end{align}$$
and then presents the reader with the map of Tolkien's Middle Earth with distances between four cities indicated:

$d$(Hobbiton, Erebor) = 813 mi
$d$(Erebor, Dagorlad) = 735 mi
$d$(Dagorlad, City of Corsairs) = 780 mi
$d$(City of Corsairs, Hobbiton) = 1112 mi
$d$(Hobbiton, Dagorlad) = 960 mi
$d$(Erebor, City of Corsairs) = 1498 mi

Substituting these numbers into the rhs of the formula I got $588330312698242944 \ \rm{mi}^6 \approx (915.384 \ \rm{mi})^6$.
So my questions are:

If this is correct then what is the Middle Earth: surface of a ball or a hyperboloid? Is it possible to find its radius?

How did Weinberg get this relation? He just writes that it's "easy to show".

REPLY [36 votes]: Overview

Is the middle-earth flat? NO.
Can the middle-earth lies on the surface of a ball?
YES - In fact there are two radii that work.
How about the surface of a hyperboloid? NO.


Part I - Is middle-earth flat?
That complicated expression from Weinberg is proportional to something
called Cayley Menger determinant.
$$\Delta_{CM}(d_{ij}) \stackrel{def}{=} \det\begin{bmatrix}
0 & 1 & 1 & 1 & 1\\
1 & 0 & d_{12}^2 & d_{13}^2 & d_{14}^2\\
1 & d_{12}^2 & 0 & d_{23}^2 & d_{24}^2\\
1 & d_{13}^2 & d_{23}^2 & 0 & d_{34}^2\\
1 & d_{14}^2 & d_{24}^2 & d_{34}^2 & 0
\end{bmatrix}$$
Using the fact $d_{ij} = d_{ji}$, one can show that Weinberg's expression is simply $-\frac12 \Delta_{CM}(d_{ij})$.
Given any tetrahedron in $\mathbb{R}^3$ with vertices $\vec{x}_1, \ldots, \vec{x}_4$. It is known that the volume $V$ of that tetrahedron can be computed
by following formula.
$$288 V^2 = \Delta_{CM}( |\vec{x}_i - \vec{x}_j| )\tag{*1}$$
Conversely, if we are given a set of $6$ positive numbers $d_{ij}, 1 \le i < j \le 4$. It can be realized as the edge lengths of a tetrahedron when

the edge lenghts satisfy triangular inequalities. 
and the corresponding Cayley-Menger determinant $\Delta_{CM}(d_{ij})$ is non-negative.
(positive if we want a non-degenerate tetrahedron).

For a proof of this, please see the paper Edge lengths determining tetrahedrons by Karl Wirth and Andre S. Dreiding.
Back to the question whether the middle-earth is flat. 
If it is flat, then we can embed the $4$ cities congruently in $\mathbb{R}^2$ and hence in $\mathbb{R}^3$. The corresponding tetrahedron will be degenerate and its volume vanishes. Using $(*1)$,
we find the distances between the cities need to satisfy $\Delta_{CM}( d_{ij} ) = 0$. 
However, if we substitute the supplied distances into the defining formula for $\Delta_{CM}(d_{ij})$, we get a negative number! This means the middle-earth is not only non-flat, we can't realize the supplied distances as Euclidean distances in $\mathbb{R}^3$.

Part II - Can the middle-earth lies on the surface of a ball?
The answer is YES, there are two radii $571.164553{\rm mi}$ and $693.660559{\rm mi}$ that work. For these two radii, we can realize the supplied distances on a sphere of that radius.
Before we start, let us look at a simplified problem:

Given any $6$ numbers $\alpha_{ij} \in (0,\pi)$, $0 \le i < j \le 3$ satisfying an appropriate set of triangular inequalities. What is the extra condition
  one need to satisfy in order to have $4$ point $q_0,\ldots q_3$ on the unit sphere $S^2$ such that the geodesic distance $d(q_i,q_j) = \alpha_{ij}$ ?

Parametrize the unit sphere $S^2$ by polar coordinates
$$[0,\pi] \times [-\pi,\pi) \ni (\theta,\phi) \quad\mapsto\quad (\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta ) \in S^2 \subset \mathbb{R}^3$$
Let $i, j, k$ be any permutation of $1, 2, 3$ such that $j < k$ and define
a bunch of variables:
$$
\begin{cases}
\theta_i &= \alpha_{0i},\\
\psi_i   &= \alpha_{jk}
\end{cases},
\quad
\begin{cases}
b_i &= \cos\psi_i\\
c_i &= \cos\theta_i,\\
s_i &= \sin\theta_i,\\
\end{cases}
\quad\text{ and }\quad
e_i = \frac{b_i - c_j c_k}{s_j s_k} = \frac{\cos\psi_i - \cos\theta_j\cos\theta_k}{\sin\theta_j\sin\theta_k}
$$
We can fulfill the requirement on $\alpha_{01}, \alpha_{02}, \alpha_{03}$ by placing 
$$q_0 \text{ at } (0,0),\quad
  q_1 \text{ at } (\theta_1, 0 ),\quad
  q_2 \text{ at } (\theta_2, \phi_{12} )\quad\text{ and }\quad
  q_3 \text{ at } (\theta_3, \phi_{13} )
$$
for some $\phi_{12}$, $\phi_{13}$ to be determined.
To fulfill the requirement of $\alpha_{12}$ and $\alpha_{13}$, we need
$$\begin{cases}
b_3 &= \cos\alpha_{12} = \cos\theta_1\cos\theta_2 + \sin\theta_1\sin\theta_2\cos\phi_{12} = c_1 c_2 + s_1 s_2\cos\phi_{12}\\
b_2 &= \cos\alpha_{13} = \cos\theta_1\cos\theta_3 + \sin\theta_1\sin\theta_3\cos\phi_{13} = c_1 c_3 + s_1 s_3\cos\phi_{13}
\end{cases}
$$
This is equivalent to $\begin{cases}
\cos\phi_{12} &= e_3\\
\cos\phi_{13} &= e_2\\
\end{cases}
$ and we can do this by setting $
\begin{cases}
\phi_{12} &=  +  \cos^{-1}e_3\\
\phi_{13} &= \pm \cos^{-1}e_2
\end{cases}
$.
One may worry whether $\phi_{12}, \phi_{13}$ defined in this manner is well defined. It turns out when the appropriate set of triangular inequalities is satisfied, all the $|e_i| \le 1$. So $\phi_{12}$ is well defined and up to a sign, so does $\phi_{13}$.
To fix the sign of $\phi_{13}$ and fulfill the requirement $\alpha_{23}$, we need
$$b_1 = \cos\alpha_{23} = \cos\theta_2\cos\theta_3 + \sin\theta_2\sin\theta_3\cos(\phi_{12} - \phi_{13}) = c_2 c_3 + s_2 s_3\cos(\phi_{12} - \phi_{13})$$
This is equivalent to 
$$\begin{align}
e_1 
&= \cos(\phi_{12} - \phi_{13}) 
= \cos\phi_{12}\cos\phi_{13} + \sin\phi_{12}\sin\phi_{13}\\
&= e_3 e_2 + \text{sign}(\phi_{13})\sqrt{1-e_3^2}\sqrt{1-e_2^2}
\end{align}\tag{*2}
$$
This leads to following condition on $\alpha_{ij}$
$$(e_1 - e_2 e_3)^2 = (1-e_3^2)(1-e_2^2) 
\iff
1 - e_1^2 - e_2^2 - e_3^2 + 2e_1e_2e_3 = 0\tag{*3}$$
Working backwards, it is not hard to verify if $\alpha_{ij}$ satisfies $(*3)$, we can find a sign of $\phi_{13}$ to satisfy $(*2)$. 
What this means is $(*3)$ is the necessary and sufficient condition we are seeking
for placing the $4$ points $q_i$ on unit sphere.
Apply this to our problem of placing the 4 cities on a sphere of radius $R$.
Let $q_0, q_1, q_2, q_3$ be the locations of
"Hobbiton", "City of Corsairs", "Dagorlad" and "Erebor" respectively.
We have
$$( d_{01}, d_{02}, d_{03}, d_{23}, d_{13}, d_{12} ) = ( 1112, 960, 813, 735, 1498, 780 )$$
Let $\alpha_{ij} = \frac{d_{ij}}{R}$ and compute the value of the expression
$$1 - e_1^2 - e_2^2 - e_3^2 + 2e_1 e_2 e_3$$
as a function for $R \in [\frac{1498}{\pi}, \infty)$. We find this expression vanishes at two $R$. By the discussion above, we can place the 4 cites on two spheres, one for each radii.
The corresponding radius and sample location for the cities are:
$$
\begin{cases}
R   &\approx 571.164553{\rm mi}\\
q_0 &= (0^\circ,0^\circ)\\
q_1 &\approx (111.5491^\circ,0^\circ),\\
q_2 &\approx ( 96.3014^\circ,79.8187^\circ),\\
q_3 &\approx ( 81.5553^\circ, 152.2807^\circ)
\end{cases}
\quad\text{ OR }\quad
\begin{cases}
R   &\approx 693.660559{\rm mi}\\
q_0 &= (0^\circ,0^\circ)\\
q_1 &\approx (91.8503^\circ,0),\\
q_2 &\approx ( 79.2952^\circ,63.5359^\circ),\\
q_3 &\approx ( 67.1531^\circ, 126.1082^\circ).
\end{cases}
$$

Part III - How about the surface of a hyperboloid?
The answer is NO. We cannot realize the supplied distances on a hyperbolic plane,
no matter what Gaussian curvature it has.
Let $K = -\frac{1}{r^2}$ be the Gaussian curvature of the hyperbolic plane.
Let $q_0, q_1, q_2, q_4$ be any $4$ points on the hyperbolic plane.
Let $d_{ij}$ be the distance between them and $\displaystyle\;\alpha_{ij} = \frac{d_{ij}}{r}$.
We can compute the angles $\phi_{jk} = \angle q_j q_0 q_k$ using Hyperbolic law of cosines
$$\cosh\alpha_{jk}
= \cosh\alpha_{0j}\cosh\alpha_{0k} - \sinh\alpha_{0j}\sinh\alpha_{0k} \cos(\phi_{jk})$$
Let $i, j, k$ be any permutation of $1, 2, 3$ with $j < k$. If we define
$e_1, e_2, e_3$ by
$$e_i = \frac{\cosh\alpha_{0j}\cosh\alpha_{0k} - \cosh\alpha_{jk}}{\sinh\alpha_{0j}\sin\alpha_{0k}}$$
we find $\cos\phi_{i} = e_{jk}$. Repeat essentially the same argument as the spherical case, we find $e_1, e_2, e_3$ once again satisfy:
$$1 - e_1^2 - e_2^2 - e_3^2 + 2e_1e_2e_3 = 0$$
However, if we use the supplied distances and compute the value of LHS as a function of $r$, we find LHS is non-zero for all positive $r$. This implies we cannot realized the distances on a hyperbolic plane, no matter what Gaussian curvature it has.