I fly a lot. Talks, meetings, whatever. I usually prefer an aisle seat, because then the rude guy who smells funny and spreads over 1.8 seats only irritates me on one side, and I’m not wedged up against the window.

However, sometimes I do like to grab a window seat, especially if I’m flying near sunset, or over a particularly interesting landscape (flying over southern Utah near sunset will change your life). But even then, the landscape blows past, and eventually you wind up flying over eastern Colorado, and there’s nothing to see but flat, flat land, extending all the way to the horizon.

And as I gaze over the amber waves of grain to the line that divides land and sky, I sometimes wonder how far away that line is. The horizon is a semi-mythical distance, used in poetry as a metaphor for a philosophical division of some kind. But in fact it’s a real thing, and the distance to it can be determined. All it takes is a little knowledge of geometry, and a diagram to show you the way.

Follow along with me here. We’re going to find the lost horizon.

So you’re standing on the Earth. Let’s assume the Earth is a perfect sphere, because that makes things a lot easier. What does our situation look like? Well, it looks something like this:

In this diagram, the circle is the surface of the Earth, which has a radius of R. The Earth’s radius varies with latitude, but I’ll just use 6365 kilometers as a decent average. The dude standing on the Earth is a human of height h (not to scale, huge duh there). The line-of-sight to the horizon is the red line, labeled d. Finding the value of d is the goal here. Note that the radius of the Earth is a constant, but that dwill vary as h goes up or down.

The key thing here is that at the visible horizon, the angle between your line-of-sight and the radius line of the Earth is a right angle (marked in the diagram). That means we have a right triangle, and — reach back into the dim, dusty memory of high school — that means we can use the Pythagorean Theorem to get d. The square of the hypotenuse is equal to the sum of the squares of the other two sides. One side is d, the other is R, and the hypotenuse is the Earth’s radius plus your height above the surface, R+h. This gives us the following algebraic formula:

d2 + R2 = (R+h)2

OK. Now what? Well, let’s expand that last term using FOIL:

(R+h)2 = R2 + h2 + 2Rh

Substitute that back into the first equation to get

d2 + R2 = R2 + 2Rh + h2

Hey, we have a factor of R2 on both sides, so they cancel! That leaves us with:

d2 = h2 + 2Rh

Now, take the square root of both sides, and voila! You get d.

So now we have an equation that tells us how far away the horizon is depending on where we are above the surface. We can use this to put in different values for h, our height, and see how far away the edge of the Earth is. I put this into an Excel spreadsheet, and the numbers are below.

In the table, the first column is your height in meters above the Earth’s surface (really the height of your eyes) and the second column is the horizon distance in kilometers. Columns three and four are the same, but in feet and miles for you Amurcans.

Height (meters)Distance (km)Height(feet)Distance (miles)00.00.00.013.63.32.125.16.63.036.29.83.747.113.14.358.016.44.868.719.75.279.423.05.7810.126.26.1910.729.56.41011.332.86.82016.065.69.63019.598.411.74022.6131.213.55025.2164.015.16027.6196.816.67029.9229.617.98031.9262.419.29033.9295.220.310035.7328.021.41000112.83280.067.72000159.66560.095.75000252.316,400.0151.410,000356.932,800.0214.212,000391.039,360.0234.6100,0001,132.7328,000.0679.6500,0002,572.01,640,000.01543.21,000,000,0001,006,344.93,280,000,000.0603,806.9

Sanity check: if you are 0 meters off the surface of the Earth (lying down really really flat), the horizon is 0 kilometers away. That makes sense — you’re tangent to the surface! So the first line sounds right.

Now imagine you are standing on a beach, looking out over the ocean to the horizon. Most people aren’t two meters tall, and your eyes are several centimeters below the top of your head. But let’s just say your eyes are two meters off the ground (maybe you’re standing on a small sand dune). In that case, your horizon is 5.1 km (3 miles) away. That also sounds about right to me.

But now let’s say you are in your hotel overlooking the beach, and on your floor your eyes are 20 meters off the ground. The horizon is then 16 km away, much farther than before. Good: the higher you are, the farther away the horizon should be.

What if you’re a lot higher up, like in an airplane? At a cruising altitude of 39,000 feet (12,000 meters; typical for a cross-country flight) the horizon is 391 km (235 miles) away! That’s a surprisingly long way; in general that means you could be looking across one or more states in the US. This commonly fools me; seeing something even a little bit out from directly underneath the plane means it’s miles away.

What if you go up even higher? The Space Shuttle can reach a maximum height of about 500 km (actually a little more, but close enough). That’s 500,000 meters, or the second-to-last line of the table. For them, the horizon is almost 2600 km away! That means they can see almost the entire US by looking from one side of the Shuttle to the other. Cool.

And what if you’re really far away? From an infinite distance, you should see the horizon as being one Earth radius farther away than your height (draw a diagram if you want). In reality that’s impossible, so in the last line I put our poor observer floating in space one million kilometers away (more than twice the distance to the Moon). The horizon is then 1,006,344 km away, which is just about (but not quite) the Earth’s radius plus the observer’s distance over the surface. They are seeing almost — but not quite — half the Earth all at once.

So there you go. The next time you’re on a beach, or the next time you’re flying, take a look out to the horizon. Like the end of a rainbow, it’s impossible to reach. But it’s not impossible — it’s not even all that hard — to know how far away it is.

If you liked this, take a look at Mooey’s Top Ten ways to know the Earth isn’t flat. There’s even more geometric nerdity there. [Update: I had no idea, but Erik Rasmussen also has a writeup on this from last March, and it’s eerily similar to what I wrote. I swear I never saw his; but I guess great minds and all that!]