# Injective uniform distribution on an n-sphere

For an application I'm working on, I need to go from some uniformly distributed variables to an uniform distribution on an n-sphere. The standard way to do this seems to be choose (n+1) normal distributed variables, and then divide by the norm.

However, I need to be able to, given a point on the sphere, extract the uniform values I would have used to get this point. There the standard method fails, at it is not injective. I think I have devised a way to do this, however, but would like someone with more statistical knowledge than me to confirm this. Or if anyone knows of an easier way to do it, that's also appreciated.

Now, here's the idea:

Let $x_1, \ldots, x_n$ be cartesian coordinates for $\mathbb{R}^n$, and choose spherical coordinates given as in the Wikipedia article for an n-sphere, i.e.

\begin{align} x_1 &= r\cos\phi_1 \\ x_2 &= r\sin\phi_1\cos\phi_2\\ x_3 &= r\sin\phi_1\sin\phi_2\cos\phi_3\\ &\qquad\vdots\\ x_{n-1} &= r\sin\phi_1\ldots\sin\phi_{n-2}\cos\phi_{n-1}\\ x_n &= r\sin\phi_1\ldots\sin\phi_{n-1} \end{align}

The volume element of an (n-1)-sphere of radius r is

$\mathrm{d}V = r^{n-1}sin^{n-2}\phi_1\sin^{n-3}\phi_2\ldots\sin\phi_{n-2} \mathrm{d}\phi_1\mathrm{d}\phi_2\ldots\mathrm{d}\phi_{n-1}.$

If we compute $\mathrm{d}x_i$ and $\mathrm{d}x_1\mathrm{d}x_2\ldots\mathrm{d}x_{n-2}$ I think we get that

$\mathrm{d}V = (-1)^nr\mathrm{d}x_1\ldots\mathrm{d}x_{n-2}\mathrm{d}\phi_{n-1}.$

I am then of the belief (and this is what I want confirmed by someone "in the know") that to choose points uniformly on the sphere, we can choose points $x_1, \ldots, x_{n-2}$ uniformly on the ball $x_1^2+\ldots x_{n-2}^2 \leq r^2$ and choose $\phi_{n-1}$ uniformly from $[0,2\pi)$.

If we can, we have reduced the problem to finding points uniformly on a (n-2)-ball. This can be done by choosing points uniformly on the boundary and multiplying by $u^{1/(n-2)}$, where $u$ is uniformly chosen from $[0,1]$. Choosing points uniformly on the boundary is the same as choosing points uniformly on an $n-3$-sphere, and we're back to the original problem, but now 2 dimensions lower. We can work our way down to either the 1-sphere or the 1-ball, where we can choose a point uniformly with no problem.

• Another way to frame your problem is that you are looking for an $n$-dimensional analog of equal-area (authalic) projections of the sphere. A straightforward way to check your proposal is to verify that the Jacobian of the transformation has constant nonzero determinant.
– whuber
Jun 12, 2014 at 14:32