The Pythagorean Theorem in Navigation and GPS

How map readers, sailors, pilots and GPS receivers turn east–west and north–south measurements into straight-line distances, and where the flat-map version stops being accurate.

By the PythagoreanTheorem.net teamUpdated 10 min read

In navigation, the Pythagorean theorem turns two perpendicular movements, usually east–west and north–south, into one straight-line distance: d = √(Δx)2 + (Δy)2. Map readers use it to measure between grid points, sailors and pilots use it to find displacement, and GPS receivers use its 3D form to model their distance to each satellite.

Straight-line distance on a map grid

Many topographic maps print a square grid, often with lines 1 km apart. East and north are perpendicular, so any two points on the grid are the ends of the hypotenuse of a right triangle. The legs are Δx (the change in the east coordinate, read "delta x") and Δy (the change in the north coordinate).

0246810121416 02468 1 square = 1 km Δx = 12 km Δy = 5 km d = 13 km Lighthouse (2, 3) Harbor (14, 8)
Walk the east leg, then the north leg, and the straight line closing the triangle is the distance: √122 + 52 = √169 = 13 km.

Example 1: two points on a grid

A lighthouse stands at grid point (2, 3) and a harbor at (14, 8), with grid units in kilometers. How far apart are they in a straight line?

Δx= 14 − 2 = 12,  Δy = 8 − 3 = 5d= √122 + 52 = √144 + 25 = √169 = 13 km

13 km. The numbers form the 5-12-13 triangle, so the answer is a whole number.

Example 2: using the map scale

On a 1:25,000 map, a campsite is 9 cm east and 12 cm north of the trailhead. How far is it as the crow flies?

map distance= √92 + 122 = √225 = 15 cmreal distance= 15 × 25,000 = 375,000 cm = 3.75 km

3.75 km. A trail that zigzags east and north along the grid would be at least (9 + 12) × 0.25 = 5.25 km, so the straight line is a lower limit, not a hiking time.

With coordinates instead of a ruler this is exactly the distance formula, and the distance formula calculator will do it for any two points. Always measure both legs in the same unit and convert with the scale once, at the end.

Displacement: where a ship or plane really ends up

The distance a vessel travels along its route is not the same as its displacement, the straight-line distance and direction from start to finish. Before satellite positioning, navigators estimated position by dead reckoning: tracking course, speed and time, and adding up how far the vessel had gone north and east. The Pythagorean theorem then turns those totals into a single distance.

Example 3: two legs at right angles

A ship steams due east at 15 knots for 2 hours, then due north at 12 knots for 1.5 hours. (One knot is one nautical mile per hour.) How far is it from where it started?

east= 15 × 2 = 30 nmi,  north = 12 × 1.5 = 18 nmid= √302 + 182 = √1,224 ≈ 34.99 nmi

Bearings are measured clockwise from north, so the direction is arctan30 over 18 ≈ 59.0° east of north.

About 35.0 nautical miles on a bearing of 059°, even though the ship sailed 48 nmi.

With several legs, add up all the east–west parts and all the north–south parts first, counting west and south as negative. Then use the theorem once on the totals.

LegCourseEast (nmi)North (nmi)
110 nmi due east+100
26 nmi due north0+6
34 nmi due west−40
42 nmi due north0+2
Total22 nmi sailed+6+8

The boat sailed 22 nmi but ended √62 + 82 = 10 nmi from its start, a doubled 3-4-5 triangle, on a bearing of arctan6 over 8 ≈ 036.9°.

Real courses are rarely due north or due east. A leg of 300 km on a bearing of 060° splits into a north part of 300 cos60° = 150 km and an east part of 300 sin60° ≈ 259.8 km. Trigonometry does the splitting and the theorem checks it: √1502 + 259.82 ≈ 300. The page on Pythagoras or trigonometry explains which tool to reach for when.

The wind triangle for pilots

An aircraft moves through the air, and the air itself moves over the ground. Pilots separate four quantities: heading (where the nose points), airspeed (speed through the air), track (the actual path over the ground) and ground speed. The wind adds its own velocity, and the three velocities form a triangle. When the wind blows at right angles to the heading or the track, that triangle is a right triangle.

Winds are reported by the direction they blow from, so a west wind (from 270°) pushes the aircraft toward the east.

Heading north: wind pushes you east 11.3° wind 30 kt airspeed150 kt ground speed≈ 153 kttrack 011° Tracking north: crab into the wind 11.5° wind 30 kt heading 348°airspeed150 kt track 360°ground speed≈ 147 kt
Same aircraft, same wind, two different right triangles. On the left the airspeed is a leg; on the right it is the hypotenuse.

Example 4: drifting off course

A plane heads due north (360°) at an airspeed of 150 knots. A 30-knot wind blows from the west. What are its ground speed and track?

ground speed= √1502 + 302 = √23,400 ≈ 153.0 ktdrift angle= arctan30 over 150 ≈ 11.3°

About 153 knots on a track of about 011°. Without a correction, the plane slides steadily east of its intended course.

Example 5: correcting for the wind

The pilot wants to track due north instead. The nose must point partly into the wind, so the 150-knot airspeed vector becomes the hypotenuse and the ground speed is a leg.

ground speed= √1502 − 302 = √21,600 ≈ 147.0 ktcorrection angle= arcsin30 over 150 ≈ 11.5°

Head about 348° to track 360°, at about 147 knots over the ground. A 300 nmi trip now takes about 2.04 hours instead of 2.00: even a pure crosswind costs time.

Real winds usually blow at other angles, and then the triangle has no right angle. Pilots solve those with a flight computer such as the E6B or with software, which split each velocity into components or use the law of cosines. The vector ideas behind this are on the physics page.

How GPS uses 3D distances

GPS does not "use Pythagoras" in a single step, but the theorem sits at the heart of the calculation. Here is what a receiver actually does, in simplified form:

  1. Listen. Each satellite, orbiting about 20,200 km above the Earth, broadcasts where it is and the exact time its signal left, kept by onboard atomic clocks.
  2. Time the signal. The receiver notes when the signal arrives. Travel time multiplied by the speed of light, about 299,792 km/s, gives a range. The trip takes roughly 0.07 seconds.
  3. Write a distance equation. In an Earth-centered x, y, z coordinate system, the range to satellite i at (xi, yi, zi) is the 3D Pythagorean distance. Each equation puts the receiver somewhere on a sphere around that satellite.
  4. Allow for the clock. The receiver's own clock is an ordinary quartz clock, so every measured range is off by the same unknown amount c b, where b is its clock error and c the speed of light. Four unknowns (x, y, z, b) need at least four satellites:
ρi = √(x − xi)2 + (y − yi)2 + (z − zi)2 + c b
  1. Solve and convert. The receiver starts from a guess and refines it until all the equations agree as closely as possible, usually with more than four satellites in view. It then converts x, y, z into latitude, longitude and height.

The precision demanded is extreme: light travels about 300 m in one microsecond, so a timing error of just one millionth of a second would shift a range by about 300 m. That is why the clock is solved for rather than trusted, and why the system also corrects for atmospheric delays and for relativistic effects on the satellite clocks.

Trilateration on a flat map

The same idea works in two dimensions with circles instead of spheres. Suppose three radio beacons sit at A(0, 0), B(10, 0) and C(0, 10), in kilometers, and you measure your distances to them as 5 km, √65 ≈ 8.06 km and √45 ≈ 6.71 km. Each measurement is a circle (see the equation of a circle):

x2 + y2= 25(x − 10)2 + y2= 65x2 + (y − 10)2= 45

Subtract the first equation from the second: −20x + 100 = 40, so x = 3. Subtract the first from the third: −20y + 100 = 20, so y = 4. Check: 32 + 42 = 25. You are at (3, 4). Subtracting cancels the squared terms and leaves straight-line equations, a trick that also appears in some GPS solution methods.

A (0, 0) B (10, 0) C (0, 10) You (3, 4) 5 8.06 6.71
Any two circles cross at two points (the hollow dots show the extra crossings). Only one point lies on all three circles, and that is your position. GPS does the same with spheres, plus a fourth measurement for the clock.

Where flat-map distances stop working

The Earth is round, so the Pythagorean theorem only works on a patch small enough to treat as flat. Within a city or a few tens of kilometers, the flat version is extremely accurate. Over hundreds or thousands of kilometers, navigators switch to great-circle formulas from spherical trigonometry. On a sphere, a triangle can even have three right angles, as the page on the theorem on curved surfaces shows.

Latitude and longitude need care too. A degree of latitude is about 111.2 km everywhere, but a degree of longitude shrinks toward the poles: it is about 111.2 cos(latitude) km. Convert both to kilometers first, then use the theorem.

Example 6: a short trip near 40° N

Two points near latitude 40° N differ by 0.05° of latitude and 0.08° of longitude.

north≈ 0.05 × 111.2 ≈ 5.56 kmeast≈ 0.08 × 111.2 × cos40° ≈ 6.81 kmd≈ √5.562 + 6.812 ≈ 8.79 km

About 8.79 km. The great-circle formula on a spherical Earth gives the same answer to the nearest meter.

Stretch the same method across an ocean and it breaks down. From New York (40.71° N, 74.01° W) to London (51.51° N, 0.13° W), the great-circle distance is about 5,570 km. The flat method with the cosine correction gives about 5,820 km, roughly 4.5% too long. Treating degrees of latitude and longitude as equal squares, which is a common mistake, gives about 8,300 km, almost 50% too long.

How far is the horizon?

One navigation formula comes straight from a right triangle drawn on a round Earth. Your line of sight to the horizon just touches the surface, and a tangent line always meets the radius at 90°. The radius R, your sight line d and the line from the Earth's center to your eye, R + h, form a right triangle:

(R + h)2 = R2 + d2  ⇒  d = √2Rh + h2 ≈ √2Rh
h R R d eye horizon (R + h)² = R² + d² d = √(2Rh + h²) h = 1.7 m → d ≈ 4.7 km h = 30 m → d ≈ 19.6 km
The height h is hugely exaggerated here; on the real Earth R ≈ 6,371 km. The right angle sits at the horizon point, where the sight line grazes the surface.

With R ≈ 6,371,000 m, a person whose eyes are 1.7 m above calm water sees about √2 × 6,371,000 × 1.7 ≈ 4,654 m, or 4.7 km. A lookout 30 m up sees about 19.6 km. A lighthouse 50 m tall can be seen by that 1.7 m observer from up to about 25.2 + 4.7 ≈ 29.9 km away, adding the horizon distances of both. Atmospheric refraction bends light slightly around the curve, so real horizons are usually a little farther than these geometric values.

Frequently asked questions

Does GPS use the Pythagorean theorem?

It uses the 3D distance formula, which is the Pythagorean theorem applied twice. A receiver writes one distance equation per satellite, adds an unknown clock error to each, and solves them together numerically. So the theorem is a building block of the calculation rather than the whole method.

Why does GPS need four satellites, not three?

Three distances would be enough if the receiver's clock were perfect, because three spheres meet in at most two points and one of them can usually be ruled out. Because the receiver's clock error is a fourth unknown, a fourth satellite is needed; in practice receivers track many more and use the extras to improve accuracy.

Can I use the Pythagorean theorem with latitude and longitude?

Only over short distances, and only after converting both differences to the same length unit. Multiply the latitude difference by about 111.2 km per degree and the longitude difference by 111.2 km times the cosine of the latitude, then apply the theorem. For long distances use a great-circle formula instead.

What is the difference between distance traveled and displacement?

Distance traveled is the length of the whole route; displacement is the straight line from start to finish, with a direction. A boat that sails 10 nmi east, 6 nmi north, 4 nmi west and 2 nmi north travels 22 nmi, but its displacement is only 10 nmi, found with the theorem from its net east and north movement.

How do pilots correct for a crosswind?

They point the nose partly into the wind, called crabbing, so the sideways push is cancelled. For a wind at right angles to the desired track, the correction angle is arcsin(wind speed ÷ airspeed), and the ground speed is a leg of the triangle: √airspeed2 − wind2.

Keep exploring