# Random point uniform on a sphere

If $X=(x,y,z)$ is a random point uniform on the unit sphere in $\mathbb{R}^3$, Are the coordinates $x$, $y$, $z$ uniform in interval $(-1,1)$?

-
for a cube perhaps? –  James S. Cook Aug 22 '12 at 3:10
should use a rejection method? paulbourke.net/geometry/spherepoints –  craftsman.don Aug 22 '12 at 3:15
I stand corrected! –  James S. Cook Aug 22 '12 at 3:25
+1 Nice question! –  Sasha Aug 22 '12 at 3:41
–  Henry Aug 22 '12 at 22:37

The probability that the $x$-coordinate lies in an infinitessimal interval $[x,x+dx]$ is proportional to the area of the slice of the sphere consisting of points with $x$-coordinate in the interval. Since the sphere is the a surface of revolution of the curve $y=f(x):=\sqrt{1-x^2}$, we compute that this area is \begin{eqnarray*} 2\pi f(x) \sqrt{1+f'(x)^2}\,dx&=&2\pi\sqrt{1-x^2}\sqrt{1+\left(\frac{-x}{\sqrt{1-x^2}}\right)^2}\,dx\\ &=&2\pi\,dx \end{eqnarray*} Because this does not depend on $x$, the $x$ coordinate is uniformly distrubuted in $[-1,1]$

-
@zemora: And as a corollary, a slick way to generate random points uniformly distributed on $S^2$ is to generate $z$ uniformly in $[-1,1]$ and a ‘longitude’ $\theta$ uniformly in $[0,2\pi)$. –  Brian M. Scott Aug 22 '12 at 3:24
Maybe add somewhere that this is quite specific to dimension 3... :-) (And maybe${}^2$ that one also knows the density in every dimension.) –  Did Aug 22 '12 at 8:33

Let $Z_1$,$Z_2$, $Z_3$ be independent identically distributed standard normal random variables. Then the random vector $$\vec{X} = \left( \frac{Z_1}{\sqrt{Z_1^2+Z_2^2+Z_3^2}}, \frac{Z_2}{\sqrt{Z_1^2+Z_2^2+Z_3^2}}, \frac{Z_3}{\sqrt{Z_1^2+Z_2^2+Z_3^2}} \right)$$ is uniformly distributed on a unit sphere (e.g. sphere point picking on MathWorld).

The distribution of components of $\vec{X}$ is clearly symmetric, so for $-1<x<0$:
$$\begin{eqnarray} \mathbb{P}\left( \frac{Z_1}{\sqrt{Z_1^2+Z_2^2+Z_3^2}} \leqslant x \right) &=& \mathbb{P}\left( Z_1^2 \geqslant x^2 (Z_1^2+Z_2^2+Z_3^2) | Z_1 < 0\right) \\ &=& \frac{1}{2}\mathbb{P}\left( \frac{2 Z_1^2}{Z_2^2+Z_3^2} \geqslant \frac{2 x^2}{1-x^2} \right) \end{eqnarray}$$

The ratio $\frac{2 Z_1^2}{Z_2^2+Z_3^2}$ follows $F_{1,2}$-distribution (wiki), hence: $$\mathbb{P}\left( \frac{Z_1}{\sqrt{Z_1^2+Z_2^2+Z_3^2}} \leqslant x \right) = \frac{1}{2}\left(1 - \sqrt{\frac{\frac{2x^2}{1-x^2}}{2+ \frac{2x^2}{1-x^2}}}\right) = \frac{1}{2} \left(1- \sqrt{x^2}\right) = \frac{1+x}{2}$$ which the cumulative distribution function of the uniform distribution indeed.

As suggested by @did, consider the case of $\mathbb{R}^d$. In that case the cumulative distribution function of the component, for $-1<x<0$ reads: $$\mathbb{P}\left( \frac{Z_1}{\sqrt{Z_1^2+Z_2^2+\cdots+Z_d^2}} \leqslant x\right) = \frac{1}{2}\mathbb{P}\left(\frac{(d-1) Z_1^2}{Z_2^2+\cdots+Z_d^2} \geqslant \frac{(d-1)x^2}{1-x^2} \right)$$ The ratio $\frac{(d-1) Z_1^2}{Z_2^2+\cdots+Z_d^2}$ follows $F$-distribution with $1$ and $d-1$ degrees of freedom, thus: $$\mathbb{P}\left( \frac{Z_1}{\sqrt{Z_1^2+Z_2^2+\cdots+Z_d^2}} \leqslant x\right) = \frac{1}{2} \frac{\operatorname{B}\left(1-x^2 ;\frac{d-1}{2}, \frac{1}{2}\right)}{\operatorname{B}\left(\frac{d-1}{2}, \frac{1}{2}\right)}$$ where $\operatorname{B}\left(z ;a, b\right)$ is the incomplete Beta function. Differentiating we get the probability density: $$f(x) = \frac{1}{\operatorname{B}\left(\frac{d-1}{2}, \frac{1}{2}\right)} \left(1-x^2\right)^{\tfrac{d-3}{2}} [-1<x<1]$$ This clearly shows that the distribution is not uniform for $d\not=3$.
@did I have added the discussion of $\mathbb{R}^d$ per your suggestion. –  Sasha Aug 22 '12 at 13:13
More specifically: if we cut an infinitesimal slice of the sphere, along the coordinate $X$ (vertical in the figure) it's seen that the surface over the sphere equals that of the slice over the surrounding cylinder (this happens only in 3 dimensions, because only in that case the bigger radius for the cilinder compensates the smaller "height" of the slice). Because the random point is uniform over the sphere, then the probability that fall in a interval $[x,x+dx]$ is proportional to the surface, and then you're done.