# Digging a tunnel between random locations

Romeo and Juliet are each placed uniformly at random locations on a spherical planet, meaning that each square meter of surface area of the planet is equally likely.

Romeo decides to dig a straight-line tunnel through the planet towards Juliet.

What is the most likely distance Romeo has to dig?

In other words, what is the mode of the probability distribution of straight-line distances?

• when they are standing 1 meter apart, I guess that it means a straight-line tunnel of 1 meter even though he doesn't actually have to dig? – Ivo Beckers Dec 30 '14 at 11:40
• @IvoBeckers Pedant! :-) – Rand al'Thor Dec 30 '14 at 11:43
• I wonder if it is even possible to distribute points evenly on a sphere. I don't think there is a universal method to this. Of course you could take a random latitude and a random longitude but that will result in the points near the poles being closer to each other than near the equator – Ivo Beckers Dec 30 '14 at 12:13
• @IvoBeckers You may be interested in reading this question, there is also an interesting article on MathWorld. – GOTO 0 Dec 30 '14 at 12:20
• I ran a computer simulation selecting 1 billion pairs of points on the surface of a sphere of diameter=1. The results indicate the mean is 2/3 and the mode is 1. – David Dubois Dec 30 '14 at 16:30

Answer: The most likely distance is the diameter of the planet, when Romeo and Juliet are antipodal.

Assume WLOG Romeo is on the North Pole. Juliet's position is uniformly random on the sphere.

Lemma 1: For the uniform distribution over the sphere, the marginal distribution over the $z$ coordinate is also uniform.

This is a surprising and non-obvious fact about spheres. It's not true for circles or for higher dimensions.

In other words, if you make a slice of an apple that's a fixed width, you always get the same amount of peel. Slices closer to the poles will have a smaller radius, but the peel will be tilted inwards letting more of it fit, and these two effects exactly compensate.

(In this picture, the slices are different widths, but I hope it gets the idea across.)

Proof

See the calculation from Mathworld for the surface area of a zone.

The surface area is computed to be $2 \pi r h$ (where $r$ is the sphere's radius), which is proportional to the thickness $h$ and independent the position of the slice given by $a$ and $b$.

So, Juliet's position can be randomly generated by picking a uniformly random $z$-coordinate. Therefore, the most likely distance is the one corresponding to the infinitesimal slice $\mathrm{d}z$ that compresses to the smallest range of distances $\left| \mathrm{d}D \right|$, maximizing the probability density. This problem is unchanged if we instead consider points on a two-dimensional circle.

The distance $D$ between Romeo's position $(0, r)$ and Juliet's position $(\sqrt{r^2-z^2},z)$ is given by

$$D^2 = r^2 - z^2 + (z-r)^2 = 2r(r-z)$$

Then, taking the derivative with respect to $z$ gives

$$2 D \thinspace \mathrm{d}D = -2r \thinspace \mathrm{dz}$$

and so the infinitesimal range of distances

$$\left| \mathrm{d}D \right| = r \thinspace \mathrm{dz} / D$$

This is minimized when $D$ is maximized. So, the most likely distance is the maximum one of the diameter, when Romeo and Juliet are antipodal.

We've also shown that the distribution of distance squared is uniform.

• I don't have time to read your answer in full yet, but lemma 1 appears to be in error. The z coordinate is not equal to latitude. – frodoskywalker Dec 30 '14 at 16:05
• @frodoskywalker You're right, I mistakenly thought the latitude was uniform in height rather than angle. The lemma is true about heights and not latitudes. – xnor Dec 30 '14 at 16:07
• Nice to see this conclusion being arrived at this way. Well done! – Johannes Dec 30 '14 at 16:27
• So at D=0 the probability distribution of the distance is least dense, is that right? – Francis Davey Dec 30 '14 at 17:27
• @FrancisDavey Indeed, and the density is 0. A tiny decrease in height causes a large increase in distance. – xnor Dec 30 '14 at 17:42

Wlog, have Romeo at the North pole; consider that latitude zero. Latitudes increase from there to $\frac{\pi}{2}$ at the equator and ${\pi}$ at the South pole. I will assume that the planet has radius $1$, because that's all going to cancel. For a distance $x$, latitude ${\theta}$ is such that ${x}^2 = \sin^2{\theta} + (1 - \cos^2{\theta})$ (apologies for a lack of justifying diagram here).

Population density at distance $x$ will be proportional to $\sin{\theta}$ (which governs the size of the circle at distance $x$), and also proportional to $\frac{d\theta}{dx}$, how much latitude you cover for a given increase in $x$.

Substituting $\sin^2\theta + \cos^2\theta = 1$ into the distance equation, we get $\cos\theta = 1 - \frac{x^2}{2} = p$. So $\theta = \cos^{-1}p$, and $\sin\theta = \sqrt{1 - p^2}$.

Using the chain rule, $\frac{d\theta}{dx} = \frac{d\theta}{dp}.\frac{dp}{dx}$. So population density at distance $x$ is proportional to $\sin\theta.\frac{d\theta}{dp}.\frac{dp}{dx}$

From the definition of $p$, $\frac{dp}{dx} = -x$

Also, $\frac{d}{dx}(\cos^{-1}x) = \frac{-1}{\sqrt{1 - x^2}}$

So population density is proportional to $\sqrt{1 - p^2}.\frac{-1}{\sqrt{1 - p^2}}.(-x) = x$

So the further away you get, the higher the population. The mode, therefore, must be $2$ - the maximum distance.

Intuitively, this must be because at the South pole, you can move a long way without changing your distance to the North pole much. I am very surprised to see a linear relationship drop out of that, though.

(Although I can't say I'm surprised to see someone has beaten me to it).

• +1 Well done. Unfortunately, I can accept only one answer. Decided to accept the first correct answer. – Johannes Dec 30 '14 at 16:28

Edit: as noted by others, this answer is incorrect. It assumes (incorrectly) that the distance to the modal latitude is the modal distance.

$\frac{d}{\sqrt{2}}$

Assume, wlog, that Romeo is at the north pole. Form latitudinal rings, composed of the land equidistant from Romeo. The equatorial one is largest. Therefore, we just need the straight line distance to the equator, which is $\frac{d}{\sqrt{2}}$

• @Johannes I think this is the correct answer. Start with a ring of squares around the equator, each being one square metre. Then make a ring of trapezoids above this ring, still with one square metre each of area. These need to be trapezoids because as you move towards the poles, they need to get narrower. Since they are still each one square metre, there must be less of them in each row as you get closer to the poles. Thus, the ring at the equator is the largest. – Trenin Dec 30 '14 at 13:44
• @Trenin That shows that the most probable latitude (the mode of the random variable "latitude") is the equator. However, this does not directly mean that the most probable distance (the mode of the random variable "distance to north pole") would be the distance to the equator. – JiK Dec 30 '14 at 13:48
• For example, let $X$ be drawn from the uniform distribution over $[0,1]$. The mode of the random variable $Y=\sqrt{X}$ is $1$, but the mode of the random variable $Y^4$ is $0$. – JiK Dec 30 '14 at 13:52
• @FrancisDavey There are zero Juliets on the equator. The equator is a single line, so there is zero probability that Juliet lives there. This is not just nitpicking. To find the probability distribution function at distance $d$, you have to compute the amount of Juliets whose distance from you lies in a small interval of length $\epsilon$ surrounding $d$, divide that by $\epsilon$, and then take the limit as $\epsilon \to 0$. This is why Johannes said to think in ribbons, not rings. I can confirm that the equator answer is incorrect. – Lopsy Dec 30 '14 at 14:22
• @Lopsy but there are many Jullietts in the ring of 1 square metre squares that run around the sphere at the equator. In fact, there are the more Jullietts in this ring than in any other ring. – Trenin Dec 30 '14 at 14:38

A short argument based on a beautiful equation giving the area of a spherical cap, runs as follows:

For a spherical planet, regardless its diameter, the surface area reachable by a tunnel with length not exceeding $x$ is $\pi x^2$. So the area reachable by tunnels ranging in length from $x$ to $x+dx$ is $2 \pi x dx$. The mode (most likely $x$ value) is reached at maximum $x$ equal to the diameter of the planet.

So although only one unique position is antipodal to Romeo's position, it does correspond to the most likely tunnel length.

• There's something tantalizing in that the area reachable by straight-line distance $x$ on a sphere is the same as than on a plane. I wonder if there's a neat reason for this that doesn't require calculation. – xnor Dec 30 '14 at 23:58
• @xnor - seems a kind of a mathematical "coincidence" as this holds true for the area of a cap on a 2-sphere in 3D space but not for higher dimensions. – Johannes Dec 31 '14 at 5:03
• The 2-sphere also has the coincidence that a uniform distribution has uniform marginal in one coordinate. Are these two coincidences perhaps one and the same? – xnor Dec 31 '14 at 14:02
• @xnor - yes, it's one and the same relationship: having a uniform marginal is equivalent to stating that the area of a spherical cap is proportional to the radius times the thickness of the cap, and twice the radius times thickness is nothing else than the "tunnel length". – Johannes Jan 3 '15 at 12:05
• @xnor - I mean "the square of the tunnel length". – Johannes Jan 3 '15 at 12:50