The Basic Mathematics Behind GPS Positioning & How Trilateration Works in Three Dimensions & Common Misconceptions About GPS Calculations & Real-World Examples of GPS Calculations
The foundation of GPS positioning rests on a simple relationship: distance equals speed multiplied by time. Since GPS signals travel at the speed of light (approximately 299,792,458 meters per second in a vacuum), measuring the time it takes for a signal to travel from a satellite to your receiver allows you to calculate the distance. If a signal takes 0.067 seconds to reach your phone, the satellite must be about 20,000 kilometers away. This distance measurement, called a pseudorange, places you somewhere on the surface of an imaginary sphere centered on that satellite. The term "pseudorange" is used because the measurement includes errors that must be corrected, particularly the offset between your receiver's imperfect clock and the satellite's atomic clock.
Trilateration, not triangulation as commonly misnamed, is the mathematical process GPS uses to determine position. While triangulation uses angles, trilateration uses only distance measurements. Imagine you're 100 kilometers from New York Cityâyou could be anywhere on a circle with a 100-kilometer radius centered on New York. If you're also 120 kilometers from Philadelphia, you must be at one of two points where those circles intersect. Add a third measurementâsay, 80 kilometers from Newarkâand you've narrowed your position to a single point where all three circles meet. GPS works the same way, but in three dimensions using spheres instead of circles, and with distances of 20,000 kilometers instead of 100.
The mathematical equations that govern GPS positioning are deceptively straightforward. For each satellite, we can write: â[(x - x_sat)² + (y - y_sat)² + (z - z_sat)²] = c Ă (t_receive - t_transmit), where (x, y, z) is your unknown position, (x_sat, y_sat, z_sat) is the satellite's known position, c is the speed of light, and the time difference represents how long the signal traveled. With three satellites, you have three equations and three unknowns (your x, y, z coordinates), which should be solvable. However, there's a fourth unknown: the error in your receiver's clock. This is why GPS needs at least four satellitesâthe fourth equation allows solving for clock error along with position.
The actual solution process uses iterative numerical methods rather than direct algebraic solution. Your receiver starts with an initial guess of its position (often its last known position or the center of Earth) and uses linearization techniques, typically the Newton-Raphson method, to refine this estimate. The equations are linearized around the current position estimate, creating a system of linear equations that can be solved using matrix algebra. This process repeats, typically 5-10 times, until the solution converges to within acceptable tolerances. Modern GPS receivers can complete this entire process in milliseconds, updating your position 10 times per second or more.
The geometry of visible satellites significantly affects the accuracy of the position solution. When satellites are spread across the sky, small errors in distance measurements result in small position errors. When satellites are clustered together, the same measurement errors can cause large position errors. This geometric effect is quantified by the Dilution of Precision (DOP) factor. The Position DOP (PDOP) typically ranges from 1 (ideal) to 10 (poor), multiplying the measurement error. For example, if your distance measurements are accurate to 5 meters and PDOP is 2, your position accuracy is approximately 10 meters. Your phone continuously calculates DOP values and may choose to use only satellites that provide good geometry.
Understanding three-dimensional trilateration requires visualizing intersecting spheres in space, which can be challenging. When your phone measures its distance from the first GPS satellite, it knows it's somewhere on a sphere with radius equal to that distance, centered on the satellite. This sphere is enormousâperhaps 20,000 kilometers in radiusâand your position could be anywhere on its surface. The second satellite measurement creates another sphere, and your position must be on both spheres simultaneously. Two spheres intersect in a circle (unless they're tangent or don't intersect at all), so you've narrowed your position to somewhere on this circle in space.
The third satellite measurement introduces a third sphere that intersects the circle from the first two spheres at two points. One of these points is usually in space or deep underground, leaving your actual position. In theory, three satellites should be sufficient for 3D positioning, but the imperfect clock in your receiver introduces an additional unknown. The time error is the same for all satellite measurements (since you have only one clock), but it affects each distance measurement by the same amount: the clock error multiplied by the speed of light. A clock error of just one microsecond causes a distance error of 300 meters for all measurements.
The fourth satellite provides the crucial additional equation needed to solve for both position and time. Mathematically, you now have four equations with four unknowns: three position coordinates and one clock bias. The system is solvable, and your receiver can determine both where and when you are. This is why every GPS receiver effectively becomes an atomic clockâit continuously synchronizes itself to GPS time as part of the position calculation. Some receivers can maintain time accuracy of better than 100 nanoseconds, making GPS one of the primary methods for distributing precise time globally.
When more than four satellites are visibleâwhich is typical in open areasâthe receiver has more equations than unknowns, creating an overdetermined system. This redundancy is valuable because it allows for error checking and improved accuracy through least-squares estimation. The receiver can use statistical methods to find the position that best fits all available measurements, weighting each satellite based on signal quality and geometry. If one satellite measurement appears to be an outlier (perhaps due to multipath reflection off a building), it can be given less weight or excluded entirely from the solution.
The altitude component of GPS positioning presents unique challenges. Vertical accuracy is typically 1.5 to 2 times worse than horizontal accuracy due to satellite geometryâsatellites are always above you, never below, creating poor vertical geometry. Additionally, altitude must be calculated relative to a reference ellipsoid (a mathematical approximation of Earth's shape), then converted to height above mean sea level using a geoid model that accounts for variations in Earth's gravitational field. Your phone contains a simplified geoid model that provides this conversion, though it may differ from surveyed elevations by several meters.
Many people believe GPS positioning works by triangulation using angles, likely because triangulation is more familiar from surveying and navigation history. GPS actually uses trilateration based purely on distance measurementsâno angles are measured or calculated. The satellites don't form triangles with your position; instead, they define spheres that intersect at your location. This distinction is important because trilateration requires very different mathematics and has different error characteristics than triangulation. Angle-based systems would require different satellite configurations and receiver designs.
A persistent myth is that GPS calculates position by measuring signal strength. Signal strength varies dramatically based on atmospheric conditions, obstacles, and receiver sensitivity, making it useless for precise distance measurement. GPS ignores signal strength for positioning (though it's monitored for signal quality assessment) and relies entirely on timing. The precision comes from measuring when signals arrive, not how strong they are. This is why GPS can work with signals so weak they're below the noise floorâtiming information can be extracted even from very weak signals through correlation techniques.
People often think their phone sends signals to satellites to measure distance, similar to radar or sonar. This two-way ranging would indeed provide direct distance measurements but would require your phone to transmit signals powerful enough to reach satellites 20,000 kilometers awayâimpossible with a device running on a small battery. GPS is entirely passive reception; your phone only listens. The one-way nature of GPS is why clock synchronization is so critical and why four satellites are needed instead of three. It's also why unlimited users can simultaneously use GPS without any interference or degradation.
Another misconception is that GPS calculations are performed by the satellites or some central computer system. All position calculations happen locally in your device. The satellites don't calculate anything related to user positionsâthey simply broadcast their own position and time. There's no central GPS computer tracking users or calculating positions. This distributed processing design allows unlimited users and ensures privacy, but it means your phone must have sufficient processing power to perform the calculations. Early GPS receivers in the 1980s needed several seconds to calculate position; modern smartphones do it in milliseconds.
Many users believe that having more satellites always improves accuracy proportionally. While having 5-8 satellites is generally better than having just 4, the improvement isn't linear. Beyond about 8-10 satellites, additional satellites provide diminishing returns unless they significantly improve the geometric configuration. Sometimes using fewer, well-positioned satellites gives better results than using all visible satellites if some have poor geometry or degraded signals. Modern receivers use sophisticated algorithms to select the optimal satellite subset for positioning, considering both geometry and signal quality.
Autonomous vehicles demonstrate the pinnacle of GPS calculation refinement, requiring position accuracy of 10 centimeters or better for safe operation. Tesla's Autopilot system combines GPS with Real-Time Kinematic (RTK) corrections, using a technique called carrier phase positioning. Instead of just measuring the code modulated on the GPS signal, RTK systems measure the phase of the carrier wave itself, which has a wavelength of only 19 centimeters. By counting the number of wavelengths between satellite and receiver and resolving the integer ambiguity (determining exactly how many complete wavelengths fit in the distance), positions can be calculated to centimeter precision. This requires solving additional mathematical challenges, including integer least-squares problems that would be computationally intractable without clever algorithms.
Smartphone fitness apps showcase interesting calculation challenges when running or cycling through cities. Strava and similar apps must deal with GPS positions that jump around due to multipath reflections off buildings. The raw GPS calculations might show you running through buildings or zigzagging across streets when you actually ran straight. These apps apply Kalman filtering, a mathematical technique that combines GPS measurements with motion models to produce smooth, realistic tracks. The filter predicts where you should be based on your previous speed and direction, then updates this prediction with new GPS measurements, weighting each based on their estimated accuracy.
Aircraft navigation systems perform GPS calculations with extra integrity checking required for safety-critical operations. The Wide Area Augmentation System (WAAS) used in North America provides correction data that allows aircraft GPS receivers to achieve 1-2 meter accuracy with integrity guarantees. The aircraft's receiver calculates not just position but also protection levelsâstatistical bounds on position error. For a precision approach, the system might calculate that there's a 99.99999% probability the actual position is within 10 meters of the calculated position. These calculations involve chi-squared statistics and require monitoring multiple error sources simultaneously.
Surveying applications push GPS calculations to their limits, achieving millimeter-level precision through post-processing techniques. Surveyors collect raw GPS data for minutes or hours at each point, then process this data using sophisticated software that accounts for atmospheric delays, solid Earth tides (the ground actually moves up and down by up to 30 centimeters due to gravitational forces from the Moon and Sun), ocean loading (coastal areas sink slightly when tides come in), and even continental drift. The calculations can involve solving systems with thousands of unknowns simultaneously, using techniques like precise point positioning (PPP) that model every error source explicitly.