Uniform Distribution on a Sphere: Part 2 (The Problem)

(This post continues where we left off in Part 1.)

In Part 1 we devised a method for choosing a point uniformly at random on a circle. When we tried to extend this to a sphere we saw that the chosen points were clumped together instead of spread out evenly upon the surface (see Figure 1).

Non-uniform points on a sphere
Figure 1: Top view (left) and front view (right) of points on a sphere with \theta and \phi chosen uniformly at random

Remember that each of our chosen points comes from two angles (like latitude and longitude) that are chosen uniformly at random. In order to confirm this, let’s plot 2,500 points on our two-dimensional coordinate axes. (Again, we are only using angles \phi from 0 to \pi/2 so that we get points on only one hemisphere. This makes the illustrations clearer.) In Figure 2, the value of the angle we call \theta is shown in the horizontal direction and the angle \phi in the vertical.

Uniform points in 2D
Figure 2: Uniformly random points in \theta and \phi

The chosen angles do seem to be chosen uniformly in this two-dimensional space. Each square has the same area and each has roughly the same number of points. So something must be happening in the transformation from this two-dimensional space to the three-dimensional space.

In the case of the circle, we made an argument that stated that subintervals of angles corresponded directly to subintervals of arc lengths of equal size. Now consider the subintervals of angles shown by the grid of rectangles in Figure 2. We need these rectangles to correspond directly to regions of equal size on the surface of the sphere. Do they?

No. Figure 3 transforms Figure 2 into three-dimensional space where every point has azimuth \theta, inclination \phi and r=1—i.e., every point lies on the surface of the sphere. As we can see, our definition of spherical coordinates ends up turning our equally sized rectangles into regions of varying size on the surface of the sphere. We will expect that each region will have the same number of points, and so our equal mass/equal area rule is violated.

Uniform points in 2D mapped to sphere
Figure 3: The points in Figure 2 are shown in our spherical coordinate system.

In fact you can perform these transformations yourself to actually see what is happening. For the polar coordinates, cut a strip of paper and use its razor-thin edge to represent the 1D interval (line) of polar angles \theta from 0 to 2\pi. Then use a ruler and pen to mark equidistant points on the line. In order to turn this 1D strip into the surface of the circle, we just bend it until the two ends touch. This is exactly the transformation that we performed when mapping angles to arcs in Part 1. You can see that all the marked intervals still have the same size following the transformation.

Step 1 Step 2
Figure 4: (a) strip representing 1D line; (b) strip wrapped into 2D circle

For spherical coordinates[1], take a tennis ball (or any other spherical object you have lying around). Cut a piece of paper with length equal to the circumference of the ball (~8 1/4 inches or 21 centimeters for a tennis ball) and height equal to half that amount. Make a grid on the piece of paper like in Figure 2 (but twice as tall and with double the number of boxes). We can perform the transformation shown in Figure 3 by first wrapping the piece of paper around the ball in the shape of a cylinder. (This represents mapping the azimuthal angle theta into our 3D space.) Then we have to wrap the top and bottom of our cylinder to lie flat on the ball. (This represents mapping the inclination angle \phi.) Notice that in doing this you will have to scrunch the paper into two points that we could call “poles” of the sphere. This transformation distorts the area of the rectangles on our grid creating smaller rectangles by the poles. This is exactly what we see in Figure 3 and explains the bunching up of points at the poles.

Step 1 Step 2 Step 3
Figure 5: (a) 2D rectangular grid and tennis ball; (b) grid wrapped around ball into cylinder; (c) cylinder wrapped into sphere (with "poles")

So the spherical coordinate transformation we performed doesn’t work, but why can’t we just pick another transformation? In other words why can’t we just find a way to wrap our single piece of paper smoothly around the tennis ball? We can’t. In fact it is impossible to do this. Try it! You must scrunch the paper up in at least one place on the ball. This results from the Hairy Ball Theorem proven by Brouwer in 1912. (Whichever mathematician came up with this name either had a great sense of humor or was oblivious. Both are equally likely when it comes to mathematicians.) The theorem tells us that we can’t comb all the hairs on a ball flat; there must be a cowlick at some point. Even nature has realized this: look at your own head (if you’re bald then at least you have been saved from this particular problem). When we are wrapping the paper around the tennis ball, imagine that the paper is made of a bunch of hairs/fibers that have been attached together in the same orientation (i.e. combed flat). Our failure to wrap the paper smoothly over the surface of the ball is a realization of the fact that we can’t “comb” these fibers flat. When we scrunch up the paper, we force the fibers to stick up at the pole(s).[2]

A more familiar version of this problem is that of making a map of the earth. Cartographers since antiquity have known that it is impossible to map the Earth on a flat surface without distorting angles, distances or area. (Christopher Columbus wasn’t the first person to realize the Earth is round.) So far we have talked about turning a flat surface into a sphere. When talking about cartography we are concerned with the reverse: we want to turn the globe into a map. These are just two ways of looking at the same problem. Any representation of the sphere on a flat surface is called a projection. In particular Figure 2 shows the equirectangular projection of the sphere.[3] This is where we map latitude and longitude (angles \theta and \phi[4]) on the sphere directly into the horizontal and vertical axes in our 2D coordinate plane. Figure 6 shows the Earth in an equirectangular projection. If you compare this image to the globe in Figure 7 you will see that the east-west distortion progressively increases as you move away from the equator, and there is no north-south distortion. As a result Greenland appears larger relative to landmasses nearer the equator than it actually is. This is just as in Figure 2 where we see that the rectangles nearest to the pole are most stretched out in the east-west direction when compared to Figures 3 or 5(c). While this projection is extremely simple, it distorts angles as well as areas meaning that the resulting map is not particularly useful; navigating using it would be difficult.

Equirectangular projection
Figure 6: Equirectangular projection of the globe

Globe
Figure 7: The globe

Map projections could (and maybe will) make up a whole other series of blog posts. For now we’ll have to leave this digression and get back to our original problem. If you are interested in learning more about projections, take a look at the book Flattening the Earth: Two Thousand Years of Map Projections by John Snyder. It gives a readable history of map projections that won’t bog you down with mathematics.

Now that we have identified the problem, we will need to figure out a way to fix it. Continue on to Part 3 for the solution.

  1. [1] There happen to be many ways you could wrap a piece of paper around a tennis ball. The following way, however, is the one that corresponds exactly to the system of spherical coordinates as represented in Figure 2. If we chose to plot \theta and \phi differently in 2D, we might have to follow a different wrapping procedure.
  2. [2] A more technical explanation: For us to be able to flatten any surface we say that it must be globally flat. Any globally flat manifold (surface) admits a space of parallel vector fields equal to its dimension. The hairy ball theorem tells us that any continuous vector field that is tangent to the unit sphere must vanish (equal zero) at some point.  Thus the only parallel vector field admitted by the sphere is the zero field. The dimension of this space (the zero field) is zero, but the dimension of the surface of the sphere is 2. Therefore the sphere is not globally flat. We cannot flatten the sphere (nor can we turn a flat surface into a sphere).
  3. [3] The equirectangular projection is a cylindrical projection. This means that lines of longitude are vertical and equally spaced on the map, and lines of latitude are horizontal (not necessarily equally spaced). These projections are called cylindrical because they result from first projecting the globe onto a cylinder and then unrolling the cylinder. This is the exactly why the steps illustrated in Figure 5 require us to first roll the map into a cylinder and then fold (project) it onto the tennis ball.
  4. [4] Note that \phi does not correspond to latitude as we are familiar with it on the globe. We call \phi the inclination angle and it gives the angle we travel downward from the north pole. Latitude on the other hand is the elevation angle. It gives us the angle we travel upwards or downwards from the equator. We defined spherical coordinates in terms of the inclination angle, but you can still think of it as latitude if it helps.