TOPICS

# Sphere Point Picking

To pick a random point on the surface of a unit sphere, it is incorrect to select spherical coordinates and from uniform distributions and , since the area element is a function of , and hence points picked in this way will be "bunched" near the poles (left figure above).

random points can be picked on a unit sphere in the Wolfram Language using the function RandomPoint[Sphere[], n].

To obtain points such that any small area on the sphere is expected to contain the same number of points (right figure above), choose and to be random variates on . Then

 (1) (2)

gives the spherical coordinates for a set of points which are uniformly distributed over . This works since the differential element of solid angle is given by

 (3)

The distribution of polar angles can be found from

 (4)

by taking the derivative of (2) with respect to to get , solving (2) for , and plugging the results back in to (4) with to obtain the distribution

 (5)

Similarly, we can pick to be uniformly distributed (so we have ) and obtain the points

 (6) (7) (8)

with and , which are also uniformly distributed over .

Marsaglia (1972) derived an elegant method that consists of picking and from independent uniform distributions on and rejecting points for which . From the remaining points,

 (9) (10) (11)

have a uniform distribution on the surface of a unit sphere. This method can also be extended to hypersphere point picking. The plots above show the distribution of points for 100, 1000, and 5000 initial points (where the counts refer to the number of points before throwing away).

Cook (1957) extended a method of von Neumann (1951) to give a simple method of picking points uniformly distributed on the surface of a unit sphere. Pick four numbers , , , and from a uniform distribution on , and reject pairs with

 (12)

From the remaining points, the rules of quaternion transformation then imply that the points with Cartesian coordinates

 (13) (14) (15)

have the desired distribution (Cook 1957, Marsaglia 1972). The plots above show the distribution of points for 100, 1000, and 5000 initial points (where the counts refers to the number of points before throwing away).

Another easy way to pick a random point on a sphere is to generate three Gaussian random variables , , and . Then the distribution of the vectors

 (16)

is uniform over the surface (Muller 1959, Marsaglia 1972).

Ball Triangle Picking, Circle Point Picking, Disk Point Picking, Great Circle, Hypersphere Point Picking, Noise Sphere, Sphere Line Picking, Sphere Tetrahedron Picking, Thomson Problem

## Explore with Wolfram|Alpha

More things to try:

## References

Cook, J. M. "Technical Notes and Short Papers: Rational Formulae for the Production of a Spherically Symmetric Probability Distribution." Math. Tables Aids Comput. 11, 81-82, 1957.Feller, W. An Introduction to Probability Theory and Its Applications, Vol. 2, 3rd ed. New York: Wiley, 1971.Knuth, D. E. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed. Reading, MA: Addison-Wesley, pp. 130-131, 1998.Marsaglia, G. "Choosing a Point from the Surface of a Sphere." Ann. Math. Stat. 43, 645-646, 1972.Muller, M. E. "A Note on a Method for Generating Points Uniformly on -Dimensional Spheres." Comm. Assoc. Comput. Mach. 2, 19-20, Apr. 1959.Rusin, D. "N-Dim Spherical Random Number Drawing." In The Mathematical Atlas. http://www.math.niu.edu/~rusin/known-math/96/sph.rand.Salamin, G. "Re: Random Points on a Sphere." math-fun@cs.arizona.edu posting, May 5, 1997.Stephens, M. A. "The Testing of Unit Vectors for Randomness." J. Amer. Stat. Assoc. 59, 160-167, 1964.von Neumann, J. "Various Techniques Used in Connection with Random Digits." NBS Appl. Math. Ser., No. 12. Washington, DC: U.S. Government Printing Office, pp. 36-38, 1951.Watson, G. S. and Williams, E. J. "On the Construction of Significance Tests on the Circle and Sphere." Biometrika 43, 344-352, 1956.

## Referenced on Wolfram|Alpha

Sphere Point Picking

## Cite this as:

Weisstein, Eric W. "Sphere Point Picking." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/SpherePointPicking.html