How the Heck Does GPS Work?

Hacker News Top News

Summary

An interactive article breaks down how GPS works—from turning nanosecond signal delays into distance, to trilateration with satellites, and even Einstein’s relativistic corrections.

No content available
Original Article Export to Word Export to PDF
View Cached Full Text

Cached at: 04/22/26, 10:31 AM

How The Heck Does GPS Work? (An Interactive Exploration)

Source: https://perthirtysix.com/how-the-heck-does-gps-work How geometry, stopwatches, and Einstein’s theories work together to make GPS possible.

Shri Khalpada

Shri Khalpada

April 11, 2026

Part ofHow The Heck?, a series of interactive explanations of everyday technology.

If you like these, you can follow theauthoror buy him acoffee!

If you’re like me, you might be entirely dependent on GPS to navigate the world. At some point, you may have caught yourself wondering during those panicked moments when an exit is coming up and your phone is recalibrating: how does my phone even know where I am?

The answer is in some ways simpler than you’d expect, and in other ways more complex. GPS is fundamentally a translation tool: it converts time into distance. A satellite sends a signal, your phone catches it, and the delay between those two events tells the phone exactly how far away the satellite is. Everything else is about making that measurement precise enough to be useful: accounting for bad clocks, satellite geometry, and eventually, Einstein’s theories.

The Ruler

TL;DR

GPS turns time into distance. 1 nanosecond of signal travel = 0.3 meters.

Every GPS measurement starts with a stopwatch. A satellite broadcasts a signal at the speed of light. Your phone receives it and checks how long the trip took. Multiply the travel time by the speed of light, and you get the distance.

This is the fundamental building block of GPS.

One Satellite, One Ring

TL;DR

One satellite tells you how far away you are, but not which direction. You could be anywhere on a ring.

Measuring a single satellite gives you a distance, but not a direction. If a signal takesto reach your phone, you are roughlyfrom the satellite. If you took every point at that distance from the satellite, you would get a ring on the surface of the Earth (technically an oblate spheroid, but effectively a ring for our purposes). One satellite tells us we’re somewhere on that ring, but it can’t tell us where exactly.

Why a ring? What about altitude?To visualize where you might be on Earth’s surface, think of two soap bubbles touching. Where they overlap, they share a perfect circle. The satellite’s signal is one sphere, and the Earth is the other. Where they intersect, you get a ring on the surface. You are somewhere on this ring, because every point on it is the same distance from the satellite.

This is a useful mental model, but GPS does not actually use the Earth’s surface as a constraint. It solves for a full 3D position, including altitude, which is how it works for aircraft and spacecraft too. We project the result onto the globe here for clarity, but the real math operates in open 3D space.

Not to scale

Satellite A sends a signal to your phone at the speed of light.

Try pinging the satellite to see its signal reach Earth.

Three Satellites, One Point

TL;DR

Three satellites produce three rings that intersect at a single point: your location.

One ring isn’t enough since you could be anywhere along it. A second satellite produces a second ring which crosses the first one at exactlytwo points. A third satellite produces a third ring, which passes through onlyoneof those two points.

This process is calledtrilateration. Each satellite gives you one equation:

is the known position of satellite, andis the measured distance. We can solve for three unknownswith three equations.

Not to scale

Each satellite’s ring passes through your location.

Try pinging the satellites one at a time.

Don’t three spheres give two points, not one?Technically, yes. Two spheres intersect to form a circle. The third sphere cuts through that circle at two points. But one of those two points is almost always an unusable location, either deep inside the Earth or thousands of kilometers out in space. The receiver discards it. So in practice, three satellites resolve to a single point on the surface.

The Clock Problem

TL;DR

Your phone’s clock is (relatively) bad. A 4th satellite fixes it because with four satellites, there is only one clock correction that makes all four spheres intersect at a single point.

There’s a problem with the math above: it assumes your phone knows the travel timeperfectly.

Each GPS satellite carries an incredibly precise atomic clock, accurate to about. Your phone has a much cheaper quartz crystal oscillator that can naturally drift by microseconds (thousands of nanoseconds). Sinceof clock error producesof position error, evenof drift puts youoff. Without accounting for this, GPS would become pretty useless pretty quickly!

The fix is to add another satellite.

In simple terms: there is only one specific clock correction possible where all four spheres intersect at a single, perfect point. The 4th satellite gives the receiver enough information to find it. Once it does, it corrects every distance measurement at once, and the previously fuzzy answer snaps into focus. Conceptually, you can think about the system doing some math to figure out how to make the new red ring below perfectly intersect with the other three rings.

The math behind clock correctionYour phone’s clock error () becomes a 4th unknown:

The left side is the true geometric distance to satellite.is thepseudorange, the distance your phone measured using its imperfect clock. It’s called “pseudo” because it’s wrong by the same constant offset for every satellite.is that offset, converted from time into meters. The sameappears in all four equations because the phone has one clock, and it’s off by one amount.

The receiver linearizes this system and iterates toward a solution for all four unknownssimultaneously. When it converges, the four spheres meet at a single point. At that moment, the receiver has found both its position and the true time.

This is also why your phone’s clock is so accurate. It’s constantly being synced to atomic clocks in space!

The Relativity Tax

TL;DR

Without Einstein’s corrections, GPS drifts by ~10 km per day.

Even with four satellites and a solved clock, we’re not quite done yet.

To understand why, we have to think of time itself as a clock that can be sped up or slowed down by its surroundings. GPS has to account for two specific distortions:

  • Special Relativity (speed):Einstein discovered that the faster an object moves, the slower time passes for it. GPS satellites move at roughly, so their clocks lose aboutper day compared to ours.
  • General Relativity (gravity):Gravity also warps time. The further you are from a massive object like Earth, the faster time ticks. The satellites orbit ataltitude in weaker gravity, so their clocks gain aboutper day.

These two effects don’t cancel out. The gravity gain is much stronger than the speed loss.

Without a correction, the satellite clocks would runahead of ground clocks every day. Because light travelsevery microsecond, that small offset would cause your position to drift by roughlyevery 24 hours.

Engineers bake this correction into the hardware. The satellite clocks are built to tick slightly too slow on the ground, atinstead of the nominal. Once in orbit, the combination of weaker gravity and orbital speed makes them tick at exactly the correct rate.

Not to scale

Elapsed Time Without Correction

Day 0: drift = 0 μs≈ 0 km error

Without these corrections, GPS would become unusable within hours. The fact that your phone can pinpoint your location to within a few meters is, in addition to being a modern miracle, a quiet and continuous proof that Einstein was right.

A Joint Effort

In practice, your phone doesn’t stop at four satellites. Modern receivers typically lock onto 8 to 12 at once, sometimes more. The extra signals don’t change the core math, but they let the receiver average out errors and pick the best satellite geometry. More satellites means sharper intersections and a more stable fix.

And it’s not just the American GPS constellation. Russia operates GLONASS, the EU has Galileo, and China has BeiDou. Your phone can listen to all of them simultaneously. That means over 100 atomic stopwatches orbiting overhead, built by different countries, all working together to tell you where you are.

Satellite placement also matters. If the satellites are clumped together in one part of the sky, their rings intersect at very shallow angles. This creates a wide, blurry area of uncertainty around the true position. GPS engineers call thisGeometric Dilution of Precision(GDOP). Good geometry means satellites spread across the sky, so that their rings cross at sharp angles and produce a tight, high-confidence intersection point. Your phone’s GPS chip automatically selects the best combination of visible satellites to minimize GDOP.

In cities, GPS signals can bounce off buildings before reaching your phone. This makes the stopwatch think you are further away than you actually are, because the signal took a longer path. This is calledmultipath error, and it’s the main reason GPS gets less accurate in dense urban areas. Modern receivers use multiple techniques to detect and filter out these reflected signals, but it remains one of the hardest problems in GPS.

With all that said, I find it amazing that your phone can pinpoint your location to within a few meters using nothing more than the time it takes light to travel from a few satellites tens of thousands of kilometers away.

If you want to go much deeper, Bartosz Ciechanowski’sinteractive explainer on GPSis the gold standard. It covers signal modulation, orbital mechanics, and receiver architecture in far more detail than we do here.

Thank you!

If you like this type of content, you can follow me onBlueSky. If you wanted to support me further, buying me acoffeewould be much appreciated. It helps us keep the lights on and the servers running! ☕

Similar Articles

How the Heck does Shazam work?

Hacker News Top

Interactive deep-dive explaining how Shazam uses FFT-derived spectrograms and audio fingerprinting to identify songs in seconds.

Hacking Time: Spoofing Atomic Clocks with Audio Harmonics

Lobsters Hottest

The article discusses the vulnerability of consumer atomic clocks to signal spoofing via audio harmonics, detailing the technical challenges of receiving NIST's WWVB radio signals on the US East Coast due to ionospheric propagation issues.

The electromechanical angle computer inside the B-52 bomber's star tracker

Lobsters Hottest

This article details the electromechanical Angle Computer used in the B-52 bomber's Astro Compass celestial navigation system, which automatically tracked stars and performed trigonometric calculations to enable accurate heading and position determination before the era of GPS.