# Intersection of random line segments on the sphere

This is actually two questions, that have a similar premise:

1. If points in $\mathbb{R}^2$ are chosen stereographically randomly (i.e. chosen uniformly randomly on the surface of the unit sphere and then projected via $(x,y,z) \mapsto (\dfrac{x}{1-z}, \dfrac{y}{1-z})$), then what is the probability that two random line segments (determined by their endpoints) in the plane will intersect?

2. If points on the surface of the unit sphere are connected by a geodesic, then what is the probability that two random geodesics on the sphere will intersect?

The first problem was easy enough for me to run a Monte Carlo simulation to obtain the answer—though I have no idea how to tackle it theoretically—and I believe I have an argument that the answer to #2 should be $\dfrac{1}{8}$ (just looking for verification). It is as follows:

If $P(g)$ is the probability that a random geodesic will intersect the given geodesic $g$, then we observe that $P(g) = \dfrac{1}{2} \cdot \dfrac{\theta}{2\pi}$, where $\theta$ is the length of $g$ (probability of $\dfrac{1}{2}$ that the random geodesic will have endpoints on opposite hemispheres of the great circle induced by $g$, multiplied by the proportion of this great circle that $g$ covers). As can be computed, the probability that a random geodesic will have length $\leq \theta$ (for $0 \leq \theta \leq \pi$) is $\dfrac{2\pi(1-\cos(\theta))}{4\pi} = \dfrac{1-\cos(\theta)}{2}$; differentiating, we get the probability density function $D(\theta) = \dfrac{\sin(\theta)}{2}$. We combine these results with Fubini's theorem to get

$$\int_0^\pi \dfrac{\theta D(\theta)}{4\pi}~~d\theta = \dfrac{1}{8}$$

In short, is my answer for #2 correct, and how do I solve #1?

Edit: Problem 1 reposted here.

• You could provide the result of your simulation for 1. so that we could check any theoretical results we might obtain. – joriki Jul 8 '18 at 20:41
• @joriki The answer, provided there were no flaws in my implementation, appeared to be exactly 1/5. – Feryll Jul 9 '18 at 2:45
• That's very interesting! I didn't expect it to have such a nice answer. It seems very difficult to derive that, but a first step would be to determine the density for $r$ in the plane. We have $$r^2=\frac{1+z}{1-z}$$ and thus $$z=\frac{r^2-1}{r^2+1}=1-\frac2{r^2+1}\;.$$ Since on a sphere slices of equal height have equal area, $z$ is uniformly distributed over $[-1,1]$, so the density for $r$ is $$\frac12\frac{\mathrm dz}{\mathrm dr}=\frac{2r}{(r^2+1)^2}\;.$$ – joriki Jul 9 '18 at 5:52
• (In case you simulated points on the sphere and projected them to the plane, you could use this density to make the simulation a bit more efficient; note that it has a definite integral in closed form, so $r$ can be sampled by inverting the cumulative distribution function.) – joriki Jul 9 '18 at 5:56
• I also get $\frac15\pm10^{-5}$ from simulations. It's a bit unfortunate that you asked these two questions in one; there's now an answer to the question, which will cause it to get less attention, even though it only answers the easier part of it. You could remove the first part from the question and post it as a separate question. – joriki Jul 9 '18 at 6:35