Ask Uncle Colin: Random Points on a Sphere

Ask Uncle Colin is a chance to ask your burning, possibly embarrassing, maths questions -- and to show off your skills at coming up with clever acronyms. Send your questions to and Uncle Colin will do what he can.

Dear Uncle Colin,

In one of Randall Munroe's What If? articles he says that the maths of finding a random point on a sphere is a bit hairy. Can't you just pick a random latitude and longitude?

-- Surely Places Have Equal Random Expectations

You would think so, wouldn't you, SPHERE? This is the problem with having been brought up on the Mercator projection and the belief that the earth -- although not flat -- may be easily flattened.

But I digress.

The reason the 'obvious' scheme doesn't work is, lines of latitude1 aren't all the same length. The equator is significantly longer than the Tropic of Cancer, which is in turn longer than the Arctic Circle, which is in turn longer than the line of latitude at the North Pole, the length of which is zero. That means, if you want a uniformly random distribution on a sphere, you need to make the equator more likely to show up than any other line of latitude, and the other lines in proportion.

How long is each line of latitude? That's easy enough with a bit of trigonometry. The Arctic Circle, for instance, is at 63.5º2 north, so we can make a right-triangle using a line from the centre of the earth to a point on the circle, from there to the Earth's axis, and back to the centre of the Earth. The radius of the Arctic Circle is $R_E \cos(63.5º)$ -- and similarly for any line of latitude you pick. The length of any circle of latitude is proportional to the cosine of the latitude.

So how do we pick a random line of latitude? That's simpler than Munroe makes out: all you need to do is generate a random number between -1 and 1, and work out its inverse cosine. (This will give you an angle between 0º and 180º, so you'll need to subtract 90º from your answer.)

As for the lines of longitude? They're all the same length, so you can just pick those uniformly at random.

-- Uncle Colin

* Hungry for more What Ifs? You can buy the book!

* Thanks to @michiexile for pointing out a mix-up between longitude and latitude.


Colin is a Weymouth maths tutor, author of several Maths For Dummies books and A-level maths guides. He started Flying Colours Maths in 2008. He lives with an espresso pot and nothing to prove.

  1. the east-west ones that go LATerally []
  2. Why they don't use radians, I don't know []


4 comments on “Ask Uncle Colin: Random Points on a Sphere

  • michiexile

    I thought that normalizing a multivariate normal was among the best ways to get points uniformly on a k-sphere?

    • Colin

      That may be the case — not something I know much about, but I’m open to guest posts if you feel like explaining? :o)

  • michiexile

    Also, I think that when you write «As for the lines of latitude? They’re all the same length, so you can just pick those uniformly at random.» you mean longitude?

    • Colin

      Thanks, I do!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sign up for the Sum Comfort newsletter and get a free e-book of mathematical quotations.

No spam ever, obviously.

Where do you teach?

I teach in my home in Abbotsbury Road, Weymouth.

It's a 15-minute walk from Weymouth station, and it's on bus routes 3, 8 and X53. On-road parking is available nearby.

On twitter