Fermat's Principle: the Lifeguard Problem

Put a lifeguard on the sand and a swimmer in the water, set how fast the lifeguard runs and swims, and choose where to go into the water. Three runners leave together: your path, the straight line, and the fastest path the page can find. Drag the orange point along the water's edge and watch the time change, and how little it changes near the bottom.

Loading interactive simulation...

Lesson

The theory — Fermat's Principle: the Lifeguard Problem

Fermat's principle: light travels between two points along a path whose travel time is stationary, meaning that a small change in the path makes no first-order change in the time. For a lifeguard who runs at v₁ and swims at v₂, the total time through entry point x is T(x) = √(x² + a²)/v₁ + √((L − x)² + b²)/v₂, and its minimum is where sin θ₁ / v₁ = sin θ₂ / v₂, the angles measured from the line at right angles to the water's edge. For light, v = c/n turns this into Snell's law, n₁ sin θ₁ = n₂ sin θ₂.

What each symbol means

x
where along the water's edge the path crosses it
v_1
speed on the sand
v_2
speed in the water
θ
angle between a leg of the path and the line at right angles to the water's edge
T″
the second derivative of the time at the best point; a miss of Δ costs about ½T″Δ²
Assumes
Straight runs at constant speed on each side of a sharp water's edge, no time lost turning or entering the water, and a swimmer who stays put. Pennings lists the same assumptions for Elvis and adds that waves blur the edge and that a corgi runs a little way into the water before swimming.

The shortest path is the slow one, and the obvious alternative is nearly perfect 🖖

Press Straight at the swimmer. The straight line is 56.57 m long and takes 22.90 s, because half of it is swum at 1.5 m/s. The fastest path is 5.13 m longer and takes 19.48 s: it spends 41.34 m on the sand and only 20.36 m in the water. Now press Swim as little as possible. Running to the point nearest the swimmer and swimming straight out takes 19.72 s, 0.242 s behind the best path, and is a rule anyone can follow without a calculation. It works here because this lifeguard runs 4.7 times faster than they swim; set the two speeds equal and the same rule loses 5.435 s to the straight line.

Near the best point, the time hardly changes 🖖

Drag the orange point and watch the second panel. Its bottom is flat: going in 1 m short of the best point costs 16.1 ms, 2 m costs 63.6 ms, and 10 m costs 1.43 s; past it, 16.3 ms and 1.67 s. Ten times the miss, between 89 and 102 times the cost, because the time grows as the square of the miss and has no term in the miss itself. The dashed parabola, ½T″Δ², is that square, and it lies on the true curve near the bottom. This is the form in which physicists state Fermat's principle: light takes a path along which a small change makes no first-order change in the travel time. The best entry point is where the slope dT/dx is zero, which works out to sin θ₁ / v₁ = sin θ₂ / v₂, and the results table prints sin θ₁ / sin θ₂ and v₁ / v₂ agreeing to four places. With speeds turned into refractive indices that is Snell's law.

A corgi on Lake Michigan, measured 🖖

In 2003 the mathematician Tim Pennings timed his Welsh corgi Elvis at 6.40 m/s running and 0.910 m/s swimming, and over three hours of throwing a ball into Lake Michigan recorded 35 retrieves, each with where Elvis went into the water. Starting at the water's edge, the fastest entry point is 0.144 times the ball's distance out before the point opposite the ball, provided the ball is at least that far along the beach. The third panel puts his 35 retrieves against that line. Of those, 23 lie above it, so he tended to go in a little early, and a line fitted to them has slope 0.171; four lie well above it, the points Pennings says some readers would discount as outliers. Then look at the shaded band, every entry point that costs less than a tenth of a second: all 35 are inside it. On a 15 m run, his worst throw cost him 94.4 ms and the median 5.7 ms. Pennings' own conclusion was that Elvis does not know calculus. He did not need to, because the bottom is flat.

Problem solved in full

  1. A beach with a strip of soft sand 5 steps

    The lifeguard from the first preset now has 10 m of soft dry sand to cross, where they run at only 4 m/s, before 10 m of firm sand at 7 m/s and then the water. The swimmer is still 20 m out and 40 m along, and swimming is still 1.5 m/s. What is the fastest time now, and how much does it cost to run the old path across the new beach? Press Straight at the swimmer to check the first step.

    Open this problem in the tool

    1. Without the soft strip, the page finds the best entry point and the best time:

    2. With three strips, the fastest path bends at both boundaries, and the slope condition becomes one number shared by every strip, c = sin θ / v. Each strip of depth h is crossed sideways by h tan θ, and the three crossings must add up to the 40 m along the beach. Solving for c:

    3. That gives the angle in each strip, from the line at right angles to the boundaries:

    4. Each leg is h / cos θ long, and its time is its length over its speed:

    5. The old path, through the old entry point at 36.18 m with a straight run across both kinds of sand, spends half its run on the soft strip:

    Answer

    The fastest path takes 21.03 s. It crosses the soft sand steeply, at 32.75° from straight across, runs most of the way along on the firm sand at 71.23°, and goes into the water 35.86 m along. The old path takes 21.69 s on the new beach, so ignoring the soft strip costs 0.67 s, much more than the 16 ms a one-metre miss costs on the old beach. The straight line now takes 24.41 s. The rule that does the work is the one light obeys crossing layers of glass: sin θ / v is the same in every layer.

Learning path

Least time, least action

References (2)