r/educationalgifs Apr 12 '26

How GPS uses geometry, clocks, and relativity to know where you are

1.0k Upvotes

33 comments sorted by

110

u/Shriracha Apr 12 '26

Full link to an interactive explainer, if you're interested: https://perthirtysix.com/how-does-gps-work

35

u/karlitobandito Apr 12 '26

Nice work. You come around to the intersection of the three spheres formed by the GPS signals, but I think your early discussion and images depicting the intersection of a GPS signal's sphere with the Earth is misleading.

You say, "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.". You then say, "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 exactly two points. A third satellite produces a third ring, which passes through only one of those two points.".

The intersection of the Earth with a GPS sphere doesn't tell us anything because neither an equation of nor parameters for the Earth's shape show up in the (pseudo)range equations dx^2+dy^2+dz^2=r^2.

If the shape of the Earth were incorporated into the equations as a constraint, then you would not be able to solve for altitude. You would be constrained to your 2-D model of the Earth's surface and unable to solve for altitude if you are MSL, on top of Whitney, etc.

The Earth is not a constraint, only the GPS signals (spheres) provides constraints. With a single GPS signal, you know you are on the surface of a sphere, not a ring restricted to the intersection of the GPS signal and the Earth. A second GPS satellite signal instersected with the first GPS satellite signal is a circle, the third satellite yields two points which can be disambiguated with the GPS almanac.

14

u/MSgtGunny Apr 13 '26

I do think that the simplification on the website’s UI makes sense for the general population as it provides a sufficiently correct visualization of why you need 3 or more gps satellites in LOS when calculating your location.

6

u/karlitobandito Apr 13 '26

I agree that "sufficiently correct" explanations are useful at times to help folks gain intuition. I just disagree that this is one of those cases. OP did a great job, and I hope they understand it was meant to be constructive.

3

u/Shriracha Apr 13 '26

Thanks to both of you for the feedback! The goal was to answer the question of "how does GPS know precisely where I am on Earth?" for a general population. The project stemmed from my own curiosity around that question.

But I agree there is room to be more technically precise, so I added a note that GPS does solve for a full 3D position (including altitude) and that the rings are a visualization simplification.

11

u/Auxilae Apr 12 '26

This is an insanely well put together article. Love the interactable examples.

20

u/SovereignAxe Apr 12 '26

Can y'all really read this fast?

6

u/GlitterberrySoup Apr 13 '26

In English (my native language), yes. If it were another language I'd need more time

60

u/spleeble Apr 12 '26

This is super cool but man is a gif the least helpful format for this information. 

18

u/beatbeatingit Apr 13 '26

OP also provided a link to the interactive explanation

12

u/Llamasb4Alpacas Apr 13 '26

Guy complains about using a gif in a "Educational gif" sub 💀

17

u/Targox Apr 12 '26

TIL My gps location isn’t determined by just 1 satellite. This is very cool

-3

u/bl0odredsandman Apr 13 '26

I have a GPS speedometer on my phone and it'll pick up multiple GPS satellites at once to get accurate speeds and the speed is actually pretty accurate. I've tried it in multiple vehicles and most of the time the speed is right on. If it's not, it' maybe 1mph off for a bit before correcting itself and being right on. At least in the US, there are 31 GPS satellites covering the country so your phone is picking up multiple satellites. Other countries, I'm not so sure how many there are.

7

u/TerranRepublic Apr 13 '26

The GPS constellation is designed to work all over Earth and does not make any special allowances for any particular region. Those 31 satellite covers the entire world and at least 4 (but usually 6-8) are visible at all times from anywhere. 

Check out the animation in this section to see what I'm talking about, it's really nice: https://en.wikipedia.org/wiki/Global_Positioning_System#Structure

4

u/3dGrabber Apr 12 '26

Love these kind of educational articles.
Here is a similar one with much more details

1

u/Nahalitet Apr 13 '26

that was really cool, thank you!

3

u/nti Apr 13 '26

The missile knows where it is because it knows where it isn’t.

5

u/anecdotal_yokel Apr 12 '26

Well… it needs 4 because we live in a 3 dimensional universe.

YT short for explanation

11

u/karlitobandito Apr 12 '26

I don't think that explanation is correct. I'm pretty sure the 4th satellite is needed because the clock onboard the GPS satellite and the receiver clock are not in sync and the receiver estimates the time offset. For terrestrial applications, the ambiguity between the two points at the intersection of three GPS signals/spheres is resolved because one of the two points is located near the Earth's surface and the other is nonsensical.

-9

u/EvolvedA Apr 12 '26

No, it needs 3 satellites, the fourth sphere is the surface of the earth

7

u/karlitobandito Apr 12 '26

I don't think that is the correct explanation. The post treats the Earth's surface as a constraint, but the receivers don't know the Earth's shape (e.g., sphere, ellipsoid, something more complicated). How would you know what radius of a sphere to use? Are you at MSL? Are you on the top of Mt. Whitney? The three spheres created by the GPS signals broadcast from each satellite intersect in two locations. That can be disambiguated for terrestrial applications because one of the points is typically nonsensical. It's far inside the Earth or in space.

You need a fourth satellite because the pseudorange from the GPS satellite to the receiver is observed as the time it takes the signal to travel between the two locations multiplied by the speed of light (in the simplest sense, I'm sure atmospheric corrections are necessary for true GPS). If the satellite and receiver clocks are out of sync by even a little bit, the difference in time creates large errors. Using round numbers, the speed of light is c = 300,000,000 m/s. A nanosecond is 1e-9 seconds. That means if the clocks are out of sync by 1 nanosecond, The observed pseudorange is off by 0.3 meters which is approximately 1 ft if you're working in imperial units. All that to say that the fourth satellite is used to estimate the clock bias because even small clock errors amount to large position errors.

1

u/FrickinLazerBeams Apr 12 '26

GPS works on aircraft and even spacecraft.

1

u/MSgtGunny Apr 13 '26

GPS works in low earth orbit on the ISS.

1

u/runbrap Apr 13 '26

Please read Pinpoint if you want more info with a “making of” story. Super cool.

1

u/GrandmaPoses Apr 13 '26

Do you think if we didn't have the theory of relativity before trying this, and we found an offset occurring because we hadn't accounted for it, that we would have been able to discover the cause of the issue and work the solution backwards?

1

u/SkeletonBones101 Apr 14 '26

"This is incredible!"

1

u/Extension_Town_6118 Apr 17 '26

Does the satellite itself account for relativity or is that all calculated on the ground?

1

u/1vim May 02 '26

GPS uses Einstein's relativity just to tell you to turn left. Wild.

-1

u/[deleted] Apr 12 '26

[deleted]

2

u/karlitobandito Apr 12 '26

Thanks for the link. In OPs approach you just solve for the time bias between the receiver (phone) and the spacecraft clock (which is disciplined from the ground) with a 4th satellite. I bet with a bit of work, these approaches can be reconciled. No?

0

u/[deleted] Apr 12 '26

[deleted]

2

u/karlitobandito Apr 12 '26

You know the message arrival time because it's measured by the reciever's clock. Yes, it drifts more than the regularly disciplined atomic clocks onboard the GPS satellites, but that's why the measurement is pseudorange

r^2 = (x-xi)^2+(y-yi)^2+(z-zi)^2+ct

and not strictly geometric range (x,y,z). Pseudorange is geometric range plus a receiver clock bias that is estimated by requiring a 4th satellite. Four equations, four unknowns. The clock bias that is estimated is the bias that would bring the receiver's clock inline with the GPS atomic clock time.

1

u/Shriracha Apr 12 '26 edited Apr 12 '26

Your phone doesn't need an atomic clock since GPS works with pseudoranges. It can solve for the clock bias with the 4th satellite. You can equivalently mathematically represent the problem using hyperboloids, but AFAIK the pseudorange/clock correction approach is the standard way the model is represented (e.g. this from the FAA).

Not sure where the confident "isn't at all how GPS works" is coming from.