*(This post continues where we left off in Parts 3a and 3b and provides an alternative solution to the problem that is more useful in practice.)*

We saw that using spherical coordinates to generate random points on the surface of a sphere required us to transform one of our angles to obtain a uniform distribution. In Part 3a we performed this transformation with the help of map projections, and in Part 3b we found it directly by using calculus. What would happen if we wanted to generalize this procedure to higher dimensions?

First of all, this may sound crazy. The sphere is in three-dimensional space, right? How could we even think about it in four dimensions let alone more? We won’t be able to visualize any of these things, but we will generalize the idea of the familiar sphere into any number of dimensions.

Think of the unit sphere we have seen so far. It is the collection of points in three-dimensional space such that each point is one unit distance from the origin^{[1]}. We’ve also seen that this surface is two-dimensional—i.e., we only need two numbers (latitude and longitude) to specify any point on the sphere. Therefore we call this particular sphere , where the “2” signifies that it is a two-dimensional surface. We also say that this surface is embedded in , a space where each point is described by three real numbers (coordinates)—i.e., the space is three-dimensional. If we consider the n-dimensional space , the points that are one unit away from the origin again make up the unit sphere that we will call . So again for we have our familiar sphere . For we have the unit circle in . Ask yourself: what is in , the real numbers?^{[2]} We can also go the other way and now consider the unit sphere in any number of dimensions. Even though we cannot plot these things, some problems in applied mathematics require generating uniform points on these higher dimensional surfaces.

We could try to extend the approach taken in the earlier posts. That is, we could define points in by their distance from the origin and angles. We call these *hyperspherical coordinates*. Just as in the case of the familiar sphere, moving from the lower dimensional space of spherical angles to the surface in higher dimensional space will create distortion. We will need to analyze the distortion and correct it. This gets more complicated as we increase the number of dimensions. Instead we would prefer a simple technique that would apply generally to in .

So instead let’s consider a vector (point) in . We say that it has coordinates to . The *(Euclidean) norm *of the vector is simply the length of the straight line connecting the point to the origin. By using the distance formula we find that

where is the norm of . Notice that if we multiply by a constant —i.e, we multiply each coordinate by —the norm . Also note that our definition of the sphere means that if we define a new vector it will lie on the sphere since . This is called

*normalizing*the vector to unit length.

Now we will consider a random vector ^{[3]} in that has random coordinates to . We choose to generate each coordinate by using a *standard normal (Gaussian) distribution. *This distribution has the familiar shape of the bell curve. Also notice that we are generating each coordinate *independently*—i.e., the value of one coordinate has no effect on the value of any other coordinate. I claim that the random vector given by has the uniform distribution on the surface of the sphere .

To prove this claim we need to show that:

- The random vector lies on the sphere
- The distribution of is uniform

From the description of non-random vectors above we can easily see that , and so it must lie on the sphere. In order to show that it is distributed uniformly, we will use a different characterization of uniformity than earlier. Look at Figure 1, the result of the solution presented in Part 3.

**Figure 1:** Top view (left) and front view (right) of uniform points on the surface of

Notice that both images look roughly the same. From these pictures we are not able to distinguish which viewpoint is which. Mathematically we say that the uniform distribution on the sphere is invariant under rotations. If we rotate the sphere (or our viewpoint) in space, the distribution remains exactly the same. This makes sense in terms of our previous equal mass/equal area rule. Consider one of the rectangular patches in the above image. If we hold that patch fixed in our view and rotate the sphere under it, this is equivalent to moving the patch somewhere else on the sphere without changing its area. The equal mass/equal area rule then tells us that each time we rotate the sphere, the expected mass in our view does not change. Conversely if the expected mass in view doesn’t change as we rotate the sphere, then the distribution must be invariant under rotations.

Armed with our new characterization of uniformity, we can now show that is indeed uniformly distributed on the sphere. First notice that if we rotate any vector its length remains the same.^{[4]} Since is defined only in terms of and its length, it suffices for us to show that the distribution of does not change under rotations. In other words, the probability density at any point remains the same if we rotate . Since each coordinate of is chosen independently, the density function of is the product of the density functions of all the .^{[5]} By looking up the density of the standard normal distribution^{[6]} we find that

where is the “product” symbol. We have shown that only depends on . Since this quantity does not change when we rotate then we have also shown that the density function of is invariant under rotations. This is exactly what we needed to do, and so we conclude that the distribution of is uniform over the surface of the sphere.

The explanation of this solution may not have seemed any simpler than the ones in Parts 3a and 3b, but notice that the method of generation is much simpler. For any dimension , all we must do is take draws from a standard normal distribution and normalize^{[7]}. All mathematics and statistics software have this capability and can perform the operations quickly. It is really a clever trick and allows the solution of this problem easily for spheres in any dimension.

That concludes this series of posts. If you have made it the entire way, I hope that you have learned something about this particular problem as well as its connection to cartography. Thanks for reading!

Mathematicians like to work with dimensionless quantities. That is, we don’t specify whether it’s one inch, meter, etc. It’s just one away from the origin. ↩^{[1]}The points on the real line that are one away from the origin (zero) are 1 and –1. Therefore is just these two points. ↩^{[2]}Recall that we use capital letters to refer to random variables. ↩^{[3]}This fact is something we could prove, but the proof does not add to the discussion. We will just consider it true based on our intuition of rotations. ↩^{[4]}In the interest of space, I will not explain this. If you are unfamiliar with probability, you should take this as fact. ↩^{[5]}↩^{[6]}This is sometimes called projecting the points onto the sphere. ↩^{[7]}