Time for a vacation! Grab a globe of the earth and pick a random number between 0 and 180 degrees for your latitude and between 0 and 360 for your longitude and set off on your vacation. It’s exciting! You’re bound for anywhere on earth, and every obscure location has the same probability of being chosen!
“Not so fast,” the stern voice of vector calculus intones. “In fact not every location is equally probable. You’re most likely to be visiting one of the polar regions if you pick a location using your method.”
Why is this? Picture abstractly a globe of the earth with a latidude and longitude grid laid over it, like so:
What you’ve done is to pick a latitude and longitude with uniform probability. This means you’re equally likely to end up in any one of those square-ish grid sections. But the grid sections each contain less area as you get closer to the poles and so the grid density per area increases as you go farther from the equator. There’s more opportunities to land near a pole than elsewhere.
Well, you have nothing against the polar regions but you don’t want to be biased. How can you pick a latitude and longitude such that every location has equal probability? The answer is that you need a weighting function to artificially even out the probabilities. This is called in vector calculus the differential element of solid angle. For spherical coordinates it’s our Sunday Function:
So as you go toward the equator the sine of the angle between your location and the earth’s polar axis approaches a maximum and therefore the probability density reaches a minimum. Correcting for this requires a little bit of manipulation from this formula which I will skip, but you can read about the technical details here. Once you do the correction, you can pick latitude and longitude weighted in such a way as to make your random location uniformly distributed on the surface of the earth.
Now you’ll probably end up vacationing in the ocean, but I’ll leave correction for that as an exercise for the reader!