Unit Sphere

SphereHere we look at the average distance between two points inside the unit sphere.

Here are the results of 1000\,000 trials repeated 10 times:

    \begin{equation*}\begin{array}{ccccc}1.0284367 & 1.0280168 & 1.0278736 & 1.0292733 & 1.0276101 \\1.0278368 & 1.0281429 & 1.0286623 & 1.0292128 & 1.0295579\end{array}\end{equation*}

If \rho, \theta, and \phi are picked uniformly in the intervals 0\leq \rho \leq 1, 0\leq \theta \leq 2\pi, and 0\leq \phi \leq \pi,
then as was the case in the circle, the spherical points \left( \rho,\theta ,\phi \right) in the unit sphere are far from being uniformly
distributed. Assume that r, s, and t are uniformly in the intervals 0\leq r\leq 1, 0\leq s\leq 1, and 0\leq t\leq 1. Then the points \left( \rho ,\theta ,\phi \right) given by

    \begin{eqnarray*}\rho &=&\sqrt[3]{r} \\\theta &=&2\pi s \\\phi &=&\arccos \left( 2s-1\right)\end{eqnarray*}


are uniformly distributed in the unit sphere.

Sphere2

Why the cube root? In order to get the points uniformly distributed, the value of \rho
corresponding to 1/2 should yield a sphere whose volume is half the volume of the unit sphere. Indeed,

    \begin{equation*}\frac{4}{3}\pi \rho ^{3}=\frac{4}{3}\pi \left( \sqrt[3]{1/2}\right) ^{3}=\frac{4}{3}\pi \left( \frac{1}{2}\right)\end{equation*}


is half the volume of the unit sphere.

In order to find an integral that represents the average distance between to points in the unit sphere, assume that one of the points is on the positive z-axis, so the point \left( 0,0,\sqrt[3]{v}\right) where v is randomly distributed in the unit interval. Pick r, s, and t in the unit interval, then set \theta =2\pi r, \phi =\arccos \left( 2s-1\right), \rho =\sqrt[3]{t}. The second point is given by

    \begin{eqnarray*}x &=&\rho \sin \phi \cos \theta =\sqrt[3]{t}2\sqrt{s-s^{2}}\cos 2\pi r \\y &=&\rho \sin \phi \sin \theta =\sqrt[3]{t}2\sqrt{s-s^{2}}\sin 2\pi r \\z &=&\rho \cos \phi =\sqrt[3]{t}\left( 2s-1\right)\end{eqnarray*}

Then the distance between the two points is

    \begin{equation*}\sqrt{\left( \sqrt[3]{t}2\sqrt{s-s^{2}}\cos \left( 2\pi r\right) \right)^{2}+\left( \sqrt[3]{t}2\sqrt{s-s^{2}}\sin \left( 2\pi r\right) \right)^{2}+\left( \sqrt[3]{t}\left( 2s-1\right) -\sqrt[3]{v}\right) ^{2}}\end{equation*}


and the average distance is given by

    \begin{eqnarray*}&&\int_{0}^{1}\int_{0}^{1}\int_{0}^{1}\int_{0}^{1}\sqrt{\left( \sqrt[3]{t}2\sqrt{s-s^{2}}\cos \left( 2\pi r\right) \right) ^{2}+\left( \sqrt[3]{t}2\sqrt{s-s^{2}}\sin \left( 2\pi r\right) \right) ^{2}+\left( \sqrt[3]{t}\left( 2s-1\right) -\sqrt[3]{v}\right) ^{2}}\,dr\,ds\,dt\,dv \\&& \\&=&\int_{0}^{1}\int_{0}^{1}\int_{0}^{1}\sqrt{4\sqrt[3]{t}^{2}\left(s-s^{2}\right) +\left( \sqrt[3]{t}\left( 2s-1\right) -\sqrt[3]{v}\right) ^{2}}\,ds\,dt\,dv \\&=&\frac{36}{35}\approx 1.\,028\,571\,429\end{eqnarray*}