Fermat's Principle of Least Time

Here is a debt this chapter owes to mechanics, paid up front. In dynamics a particle follows the path of stationary action; in optics a ray follows the path of stationary optical length — the same statement in different clothes. Fermat's least-time principle is the optical twin of the mechanical principle of least action, and the bridge between them, the optical–mechanical analogy, works by letting the refractive index nn play the exact role momentum plays for a particle. Hold that thought; we cash it out by name at the end of the core section. The everyday face of it is a lifeguard problem. You run fast on sand but swim slowly in water, so the quickest route to a swimmer is not the straight line — it spends extra distance on the fast sand to cut the slow distance in water, kinked at the shoreline. A ray crossing from air into water faces exactly this trade-off: it travels not the shortest distance but the path of shortest time, and the kink that minimizes the time is precisely Snell's law of refraction. The same demand at a mirror gives the law of reflection; at a lens, focusing. The historical name "least time" is a mild slander on the truth. The real condition is that the time is stationary — flat to first order against small path deformations — usually a minimum but, for a concave mirror or an ellipse, sometimes a maximum or a dead-flat tie. That subtlety is no footnote: it is exactly why Hamilton's principle is a principle of stationary, not minimal, action, and it is the doorway from rays to waves.

Key takeaways
  • Fermat's principle selects the physical ray between two fixed points as the one whose optical path length ∫n ds\int n\,\mathrm{d}s — equivalently the travel time T=1c∫n dsT=\frac1c\int n\,\mathrm{d}s — is stationary under small path variations.
  • Requiring dT/dx=0\mathrm{d}T/\mathrm{d}x=0 for a ray crossing a plane interface gives n1sin⁡θ1=n2sin⁡θ2n_1\sin\theta_1=n_2\sin\theta_2 — Snell's law is a theorem, not a postulate; the same demand at a mirror gives θi=θr\theta_i=\theta_r.
  • "Least" is historical: the extremum is a minimum for a plane interface or plane mirror, a maximum for some concave mirrors, and dead-flat (every path equal) between the foci of an ellipse.
  • The ray does not "try all paths" or "know" its destination: the principle is a description whose mechanism is wave superposition — near the stationary path neighbouring paths share the same phase and add, while elsewhere they cancel.
  • It is the optical face of least action: under the optical–mechanical analogy the index nn maps to momentum pp, the ray to the trajectory, and geometrical optics to the short-wavelength limit that mirrors the classical limit of quantum mechanics.
  • Key idea: light follows the path whose optical path length — equivalently the travel time — is stationary, δ ⁣∫n ds=0\delta\!\int n\,\mathrm{d}s=0; the crossing point that makes it stationary is exactly the one obeying Snell's law.
The core insight

Light follows the path for which the optical path length ∫ABn ds\int_A^B n\,\mathrm{d}s — equivalently the travel time T=1c∫ABn dsT=\frac1c\int_A^B n\,\mathrm{d}s — is stationary, δ ⁣∫ABn ds=0\delta\!\int_A^B n\,\mathrm{d}s=0. Worked out at a plane interface this yields Snell's law; at a mirror, the law of reflection; in a graded medium, the curved-ray equation. "Least" is only usually true — the exact word is stationary.

Where this lives today

Fermat's principle is the quiet engine of modern travel-time physics. Optical-design software traces rays by enforcing stationary optical path surface by surface, and the same law, with n=c/v(r)n=c/v(\mathbf r), drives seismic tomography — imaging the Earth's interior from the least-time paths of earthquake waves — and the solvers behind sonar and ultrasound. In astrophysics it becomes a "Fermat potential" whose stationary points are the multiple images of a gravitational lens; the optical-path differences between them are measurable time delays of days to months, now used to weigh dark matter and gauge the expansion rate of the universe. Closer to home, the graded-index ray equation (4)(4) explains the highway mirage, the flattened setting Sun, and the graded cores that guide light down optical fibres. Push the interface until n1sin⁡θ1n_1\sin\theta_1 can no longer be matched by any real θ2\theta_2 and the stationary refracted path disappears — total internal reflection, the next article in this track.

The physical picture

Take the lifeguard's pond and let the runner be a ray from AA in air to BB under water. Air is "fast" (n1=1.00n_1=1.00, speed cc); water is "slow" (n2=1.33n_2=1.33, speed c/1.33c/1.33). Every route pierces the surface at some crossing point, trading air-distance against water-distance, and sliding that point slides the total time. Fermat's claim: the real ray takes the crossing point that makes the total time stationary — here, a clean minimum.

Figure
Least-time refraction: from A in air to B in water the ray bends at the crossing point x that makes n₁ sinθ₁ = n₂ sinθ₂, not along the straight line
n₁ = 1.00 air (fast) n₂ = 1.33 water (slow) normal straight path — shorter distance, longer time A = (0, 4 cm) B = (8 cm, −3 cm) θ₁ θ₂ P = (x, 0) the true ray takes the crossing point that minimizes the total travel time

Think of the routes as a rack of stopwatches, one per crossing point. Far from the true ray a small shift changes the arrival time a lot — the graph is steep. At the true ray it goes flat: nudging the crossing point barely changes the time, because we sit at the bottom of the valley. That flatness is stationarity — the whole principle in one sentence, and why waves obey it. Now, the valley.

Figure
Punchline — travel time T versus crossing point x: a shallow U whose flat minimum at x* ≈ 5.67 cm is the Snell ray; the straight-line crossing (amber) is shorter in distance yet slower
travel time T (ns) crossing point x on the interface (cm) 0.40 0.44 0.48 0.52 0 2 4 6 8 least time at x* ≈ 5.67 cm T_min ≈ 0.400 ns → n₁ sinθ₁ = n₂ sinθ₂ stationary: T flat to ±0.05 % over ±2 mm straight-line crossing x = 4.57 cm shorter path, yet slower by ≈ 1.2 %

The curve is the whole principle in nanoseconds. Its left wall is steep — cross too near AA's foot and the ray plunges through slow water; its right side rises gently. Between them is a broad, flat basin whose lowest point is the Snell ray, at x∗≈5.67 cmx^*\approx5.67\ \mathrm{cm}, Tmin≈0.400 nsT_\mathrm{min}\approx0.400\ \mathrm{ns}. The amber dot marks where the straight line from AA to BB crosses — the shortest-distance path, and genuinely slower; light refracts to avoid it. And the basin is flat: shift the crossing point two millimetres either way and the time changes by under a twentieth of a percent — which is why "least time" and "stationary time" part company only at second order, and why light waves, caring about phase, land right in the basin.

The core equations

Everything rests on one definition and one demand. Because light of vacuum wavelength λ0\lambda_0 has wavelength λ0/n\lambda_0/n in a medium, distance weighted by the local index counts wave crests, not metres. That weighted distance is the optical path length, and dividing by cc makes it the transit time:

OPL=∫ABn(r) ds,T=OPLc=1c∫ABn ds(1)\mathrm{OPL}=\int_A^B n(\mathbf r)\,\mathrm{d}s,\qquad T=\frac{\mathrm{OPL}}{c}=\frac1c\int_A^B n\,\mathrm{d}s \qquad (1)

where: n(r)n(\mathbf r) — local refractive index; ds\mathrm{d}s — arc-length element; A,BA,B — the fixed endpoints; cc — the vacuum speed of light, 299 792 458 m/s299\,792\,458\ \mathrm{m/s} (SI-exact). Since TT and OPL differ only by the constant cc, "least time" and "least optical path" are one statement. Fermat's principle is the demand that this quantity be stationary — unchanged to first order — as the path is wiggled between the fixed endpoints:

δ ⁣∫ABn(r) ds=0(2)\delta\!\int_A^B n(\mathbf r)\,\mathrm{d}s=0 \qquad (2)

where: δ\delta — the first variation, endpoints held fixed. This single line contains all of geometrical optics — reflection, refraction, focusing, and ray-bending in graded media are just (2)(2) for particular geometries. The word "stationary" is load-bearing: the extremum can be a minimum, a maximum, or degenerate, as Derivation C shows. For the workhorse case — a ray from AA in medium n1n_1 to BB in medium n2n_2, crossing a plane interface at one point xx — the functional collapses to a function of one variable, T(x)=1c[n1x2+y12+n2(d−x)2+y22]T(x)=\frac1c\big[n_1\sqrt{x^2+y_1^2}+n_2\sqrt{(d-x)^2+y_2^2}\big], and (2)(2) becomes ordinary calculus, dT/dx=0\mathrm{d}T/\mathrm{d}x=0. That derivative (Derivation B) delivers the law of refraction:

n1sin⁡θ1=n2sin⁡θ2(3)n_1\sin\theta_1=n_2\sin\theta_2 \qquad (3)

where: θ1,θ2\theta_1,\theta_2 — the angles from the interface normal; the sines emerge as sin⁡θ1=x/x2+y12\sin\theta_1=x/\sqrt{x^2+y_1^2} and sin⁡θ2=(d−x)/(d−x)2+y22\sin\theta_2=(d-x)/\sqrt{(d-x)^2+y_2^2}. Snell's law is thus the stationarity condition of (2)(2), not an axiom; n1=n2n_1=n_2 collapses it to θ1=θ2\theta_1=\theta_2 — a straight line, as a uniform medium must give. When the index varies smoothly rather than jumping, the same variational principle, run through the Euler–Lagrange machinery, gives the general ray equation:

dds ⁣(n drds)=∇n(4)\frac{\mathrm{d}}{\mathrm{d}s}\!\left(n\,\frac{\mathrm{d}\mathbf r}{\mathrm{d}s}\right)=\nabla n \qquad (4)

where: dr/ds\mathrm{d}\mathbf r/\mathrm{d}s — the unit tangent to the ray; ∇n\nabla n — the index gradient, which steers the ray toward higher nn. Set ∇n=0\nabla n=0 and rays are straight; let nn vary — hot air over a road, the graded core of a fibre — and rays curve, so mirages and gradient-index lenses fall out of the same equation. Its wave pedigree belongs to the ray-model and eikonal articles; here it is the smooth-medium face of Fermat's principle. This family of ideas is not confined to optics, and the link is exact. Under the optical–mechanical analogy, the refractive index n(r)n(\mathbf r) plays precisely the role of a particle's momentum p=2m(E−V)p=\sqrt{2m(E-V)}, an optical ray maps onto a mechanical trajectory, and Fermat's δ ⁣∫n ds=0\delta\!\int n\,\mathrm{d}s=0 becomes Maupertuis' principle of least action δ ⁣∫p ds=0\delta\!\int p\,\mathrm{d}s=0. The optical eikonal SS — the phase whose level surfaces are the wavefronts and whose gradient is the ray — is the optical twin of Hamilton's principal function, so the eikonal equation Fermat's principle secretly encodes is the geometrical-optics image of the Hamilton–Jacobi equation of mechanics. And both principles hold for one and the same reason: geometrical optics is the short-wavelength limit of wave optics exactly as classical mechanics is the classical (ℏ→0\hbar\to0) limit of quantum mechanics — made quantitative in the WKB / eikonal connection. Fermat's 1662 principle was the first of a family of least-principles unified only by Hamilton in 1834.

Derivation AThe law of reflection from Fermat's least path

We prove, not assume, that a ray bouncing off a plane mirror leaves at the angle it arrives, using pure path-length reasoning so the equal-angle law appears as a consequence of stationary optical length. The strategy is Hero of Alexandria's shortest-path construction: replace the destination by its mirror image, note that reflected path lengths equal straight-line distances to that image, and read the angles off the straight line. In a uniform medium, minimising optical length is minimising distance, so the argument is purely Euclidean.

Step 1. Put the mirror on the xx-axis with both points above it, A=(0,h1)A=(0,h_1) and B=(d,h2)B=(d,h_2); let the ray touch at (x,0)(x,0). In one medium of index nn, OPL(x)=n[x2+h12+(d−x)2+h22]\mathrm{OPL}(x)=n\big[\sqrt{x^2+h_1^2}+\sqrt{(d-x)^2+h_2^2}\big]. Why drop nn: it multiplies every term, so stationary optical length is stationary geometric length — reflection is a shortest-distance problem.

Step 2. Reflect BB to its image B′=(d,−h2)B'=(d,-h_2). For any touch point the second leg equals the distance to B′B', since reflecting an endpoint across the axis preserves its distance to points on the axis. So A→P→BA\to P\to B has exactly the length of A→P→B′A\to P\to B'. Why this is the trick: it converts a kinked path into a candidate straight line, and the shortest connection from AA to B′B' is the straight segment.

Step 3. The sum ∣AP∣+∣PB′∣|AP|+|PB'| is smallest when A,P,B′A,P,B' are collinear. That segment crosses the mirror at one point, where incident and reflected rays are the two halves of a single line to the image and make equal angles θi=θr\theta_i=\theta_r with the normal. Why a genuine minimum: any other touch point forces a strictly longer dog-leg to B′B', so L′′>0L''>0.

Step 4. Differentiating directly agrees: d OPL/dx=0\mathrm{d}\,\mathrm{OPL}/\mathrm{d}x=0 gives sin⁡θi=sin⁡θr\sin\theta_i=\sin\theta_r. For A=(0,3)A=(0,3), B=(8,2)B=(8,2) the ray reflects at x=4.8x=4.8, path 89\sqrt{89}, θi=θr=58.0°\theta_i=\theta_r=58.0°. Why both routes agree: the image construction is the geometric shadow of the calculus. *Verified in verify_fermats-principle.py: the image-method point x=4.8x=4.8 matches the calculus root, path =89=9.434=\sqrt{89}=9.434, θi=θr=57.99°\theta_i=\theta_r=57.99°, and L′′>0L''>0 (a minimum).*

Go deeper · Derivation B · 1 minSnell's law from stationary time — the owned result
Derivation BSnell's law from stationary time — the owned result

This is the structural heart of the article: we derive refraction from Fermat's principle alone, turning an empirical rule into a one-line consequence of stationary time. The strategy is to write the transit time as a function of the single free parameter — the crossing point — differentiate, and recognise the two terms as the index-weighted sines of the incidence and refraction angles; setting it to zero reads off as Snell's law, and the second derivative's sign confirms a minimum.

Step 1. Send the ray from A=(0,y1)A=(0,y_1) in medium n1n_1 to B=(d,−y2)B=(d,-y_2) in medium n2n_2, crossing the xx-axis at (x,0)(x,0). The travel time is the two indexed legs over cc: T(x)=1c[n1x2+y12+n2(d−x)2+y22]T(x)=\frac1c\big[n_1\sqrt{x^2+y_1^2}+n_2\sqrt{(d-x)^2+y_2^2}\big]. Why one variable suffices: with straight legs in each uniform medium, the only freedom left is the crossing point xx.

Step 2. Differentiate and set to zero: dTdx=1c[n1 xx2+y12−n2 (d−x)(d−x)2+y22]=0\dfrac{\mathrm{d}T}{\mathrm{d}x}=\dfrac1c\left[\dfrac{n_1\,x}{\sqrt{x^2+y_1^2}}-\dfrac{n_2\,(d-x)}{\sqrt{(d-x)^2+y_2^2}}\right]=0. Why the minus sign: raising xx lengthens the first leg but shortens the second, so the stationary point is where the two rates balance.

Step 3. Each fraction is a sine: sin⁡θ1=x/x2+y12\sin\theta_1=x/\sqrt{x^2+y_1^2} in medium 1, sin⁡θ2=(d−x)/(d−x)2+y22\sin\theta_2=(d-x)/\sqrt{(d-x)^2+y_2^2} in medium 2. The condition is therefore n1sin⁡θ1=n2sin⁡θ2n_1\sin\theta_1=n_2\sin\theta_2 — Snell's law. Why it is inevitable: dT/dx\mathrm{d}T/\mathrm{d}x is literally 1c(n1sin⁡θ1−n2sin⁡θ2)\frac1c(n_1\sin\theta_1-n_2\sin\theta_2), an identity sympy confirms exactly, so its zero is Snell and nothing else.

Step 4. Put numbers to it. For A=(0,4 cm)A=(0,4\ \mathrm{cm}) air, B=(8,−3 cm)B=(8,-3\ \mathrm{cm}) water, n1=1.00n_1=1.00, n2=1.33n_2=1.33, the root is x∗=5.665 cmx^*=5.665\ \mathrm{cm}, giving θ1=54.8°\theta_1=54.8°, θ2=37.9°\theta_2=37.9°, n1sin⁡θ1=n2sin⁡θ2=0.817n_1\sin\theta_1=n_2\sin\theta_2=0.817; T′′>0T''>0, so Tmin=0.400 nsT_\mathrm{min}=0.400\ \mathrm{ns} is a minimum. Why the check matters: the sign of T′′T'' separates this minimum from the maximum and degenerate cases of the next card. *Verified in verify_fermats-principle.py: the sympy identity d(OPL)/dx=n1sin⁡θ1−n2sin⁡θ2\mathrm{d}(\mathrm{OPL})/\mathrm{d}x=n_1\sin\theta_1-n_2\sin\theta_2; the root x∗=5.665 cmx^*=5.665\ \mathrm{cm}, θ1=54.8°\theta_1=54.8°, θ2=37.9°\theta_2=37.9°, Snell to 10−610^{-6}, T′′>0T''>0, Tmin=0.400 nsT_\mathrm{min}=0.400\ \mathrm{ns}.*

Go deeper · Derivation C · 2 minWhy "least" is wrong — stationary, not minimum
Derivation CWhy "least" is wrong — stationary, not minimum

This card defends "stationary" against the popular "least," because the difference is real physics. The strategy is one clean geometry — the ellipse — in which the optical path between the foci is not merely stationary but identical for every reflection point, and then bending the mirror each way turns that flat tie into a minimum or a maximum — the ellipse being the exact borderline, and the cleanest counterexample to "light takes the shortest path."

Step 1. For an ellipse with foci F1,F2F_1,F_2 and semi-major axis aa, every point PP obeys ∣F1P∣+∣F2P∣=2a|F_1P|+|F_2P|=2a, a constant. A ray from F1F_1 reflecting to F2F_2 therefore has the same optical length wherever it strikes. Why this is stationarity in purest form: if length does not change as PP moves, its first variation vanishes everywhere — every point is stationary, degenerately.

Step 2. Replace the ellipse by its tangent plane at PP — a flatter mirror. Now the reflected path is longer at every neighbour than at PP, so PP is a genuine minimum: a plane mirror always gives a least-length path. Why flatter means minimum: the tangent lies outside the ellipse near PP, adding length to every detour.

Step 3. Bend the mirror the other way — more sharply curved than the ellipse, a small circle tucked inside it. The reflected path is now shorter at neighbours than at PP, so PP is a maximum even though it is the physical ray. Why more-curved means maximum: the tighter mirror dips inside the ellipse, shaving length off every detour — the concave-mirror case.

Step 4. So the same ray is a minimum, a maximum, or flat, depending only on how the mirror's curvature compares with the confocal ellipse — and Fermat's principle survives all three, since it demanded only stationary length. Why it matters beyond optics: the same ambiguity is why Hamilton's principle is stated as stationary, not least, action. *Verified in verify_fermats-principle.py: on an ellipse a=5,b=4a=5,b=4 (c=3c=3) the sum ∣F1P∣+∣F2P∣=2a=10|F_1P|+|F_2P|=2a=10 is constant to machine precision; the flat tangent mirror makes PP a minimum, and a tighter circle (R=5<a2/b=6.25R=5<a^2/b=6.25) makes PP a maximum.*

Limiting cases

CaseResultMeaning
uniform medium, n1=n2n_1=n_2δ ⁣∫n ds=n δ ⁣∫ds=0\delta\!\int n\,\mathrm{d}s=n\,\delta\!\int\mathrm{d}s=0shortest geometric length — light travels in straight lines
plane interfacedT/dx=0⇒n1sin⁡θ1=n2sin⁡θ2\mathrm{d}T/\mathrm{d}x=0\Rightarrow n_1\sin\theta_1=n_2\sin\theta_2, T′′>0T''>0refraction; the stationary crossing is a true time minimum (Snell)
plane mirrorθi=θr\theta_i=\theta_r, T′′>0T''>0reflection; minimum, equal to the straight line to the image
concave mirror / ellipseδ(OPL)=0\delta(\mathrm{OPL})=0 but a maximum or degeneratestationary path can be longer than neighbours; "least time" fails
graded index, ∇n≠0\nabla n\ne0dds ⁣(ndrds)=∇n\frac{\mathrm{d}}{\mathrm{d}s}\!\left(n\frac{\mathrm{d}\mathbf r}{\mathrm{d}s}\right)=\nabla nrays curve toward higher nn — mirages, GRIN lenses, atmospheric refraction
beyond the critical angleno real refracted path (n1sin⁡θ1>n2n_1\sin\theta_1>n_2)the refracted extremum ceases to exist — total internal reflection

Worked examples

1 · The least-time crossing, solved (confidence builder)

A ray leaves A=(0,4 cm)A=(0,4\ \mathrm{cm}) in air (n1=1.00n_1=1.00) and reaches B=(8 cm,−3 cm)B=(8\ \mathrm{cm},-3\ \mathrm{cm}) in water (n2=1.33n_2=1.33). Find the crossing point x∗x^* light takes, verify Snell's law, and compare its time with the straight-line path.

Step 1. Write the time versus crossing point xx: T(x)=1c[x2+42+1.33(8−x)2+32]T(x)=\frac1c\big[\sqrt{x^2+4^2}+1.33\sqrt{(8-x)^2+3^2}\big] (cm). Fermat says solve dT/dx=0\mathrm{d}T/\mathrm{d}x=0.

Step 2. The derivative xx2+16−1.33 8−x(8−x)2+9=0\dfrac{x}{\sqrt{x^2+16}}-1.33\,\dfrac{8-x}{\sqrt{(8-x)^2+9}}=0 solves numerically to x∗=5.665 cm\boxed{x^*=5.665\ \mathrm{cm}} — well right of the midpoint, since the ray hugs the fast air and cuts the slow water.

Step 3. Check Snell. At x∗x^*, sin⁡θ1=5.665/5.6652+16=0.817\sin\theta_1=5.665/\sqrt{5.665^2+16}=0.817 so θ1=54.8°\theta_1=54.8°, and sin⁡θ2=(8−5.665)/(8−5.665)2+9=0.614\sin\theta_2=(8-5.665)/\sqrt{(8-5.665)^2+9}=0.614 so θ2=37.9°\theta_2=37.9°. Then n1sin⁡θ1=0.817n_1\sin\theta_1=0.817 and n2sin⁡θ2=1.33×0.614=0.817n_2\sin\theta_2=1.33\times0.614=0.817: Snell's law holds exactly, and T′′>0T''>0 confirms a minimum.

Step 4. Time the two routes. The least-time path takes Tmin=OPL/c=11.99 cm/c=0.400 nsT_\mathrm{min}=\mathrm{OPL}/c=11.99\ \mathrm{cm}/c=\boxed{0.400\ \mathrm{ns}}. The straight geometric line crosses at xs=32/7=4.57 cmx_s=32/7=4.57\ \mathrm{cm} and takes 0.4047 ns0.4047\ \mathrm{ns} — slower by ≈ 1.2 % (4.8 ps) despite the shorter distance: light spends extra air-distance to buy back more slow water.

2 · Reflection as the straight line to the image (exam level)

A source A=(0,3)A=(0,3) and detector B=(8,2)B=(8,2) sit above a flat mirror on the xx-axis (one medium). Where does the ray strike, how long is its path, and what are the angles?

Step 1. Reflect BB to its image B′=(8,−2)B'=(8,-2). By the image theorem any reflected path A→P→BA\to P\to B equals A→P→B′A\to P\to B' in length, so the shortest reflected path is the straight segment A→B′A\to B'.

Step 2. That segment has length ∣AB′∣=(8−0)2+(3+2)2=64+25=89=9.43|AB'|=\sqrt{(8-0)^2+(3+2)^2}=\sqrt{64+25}=\boxed{\sqrt{89}=9.43}, and it crosses the mirror where the line from (0,3)(0,3) to (8,−2)(8,-2) meets y=0y=0: at x=33+2×8=4.8x=\dfrac{3}{3+2}\times8=\boxed{4.8}.

Step 3. The incidence and reflection angles from the normal satisfy tan⁡θi=4.8−03=1.6\tan\theta_i=\dfrac{4.8-0}{3}=1.6 and tan⁡θr=8−4.82=1.6\tan\theta_r=\dfrac{8-4.8}{2}=1.6, so θi=θr=58.0°\theta_i=\theta_r=\boxed{58.0°}. The equal angles are automatic once AA, PP, B′B' are collinear.

Step 4. Any other touch point forces a bent, strictly longer route to B′B', so its total path exceeds 89\sqrt{89}: the physical reflection is the unique minimum, and unlike the concave-mirror case it is a true least-length path.

Physics of the portrait

Fermat was a jurist who did mathematics for pleasure, and least time is a perfect specimen of his habit of asking what quantity nature economises — the habit that, against Descartes, led him to the right physical cause of refraction.

Origins · 1 minPierre de Fermat and how this was discovered
PD
Pierre de Fermat
1607–1665 · Toulouse

Fermat spent his career as a councillor at the parlement of Toulouse and did mathematics as a private passion, corresponding with Mersenne, Pascal, and Carcavi rather than publishing. He co-founded analytic geometry and probability, pioneered maxima–minima methods that anticipated the calculus, and left number theory its most famous provocation — the marginal note that became Fermat's Last Theorem, unproved for 358 years. In optics he stated least time in a 1657 letter to Cureau de la Chambre and, in 1662, used his "method of maxima and minima" to derive refraction from it, deducing that light travels more slowly in the denser medium — contradicting Descartes and igniting a long dispute with the Cartesians. He never saw the vindication: only the wave theory and later measurements of light's speed in water showed he had reasoned from the correct premise.

History
1637
— Descartes publishes the sine law of refraction in La Dioptrique, derived on the assumption that light moves faster in the denser medium (a "least resistance" model — right law, wrong cause)
1657
— Fermat proposes the principle of least time in a letter to Cureau de la Chambre
1662
— Fermat derives Snell's law from least time and concludes, correctly, that light slows in the denser medium
1744
— Maupertuis states the principle of least action for mechanics
1834
— Hamilton unifies optics and mechanics through his characteristic function, making least time and least action a single idea

Going further

Texts. Hecht, Optics, 5th ed., §4.5 (Fermat's Principle) · Saleh & Teich, Fundamentals of Photonics, 3rd ed., §1.1–1.3 (Postulates of Ray Optics) · Born & Wolf, Principles of Optics, §3.3 (Fermat's Principle) · Feynman, Lectures on Physics, Vol. I, Ch. 26 (least time, superbly told) · Landau & Lifshitz, Classical Theory of Fields, §53 (geometrical optics and the eikonal).

Provenance. Definitions and derivations follow Hecht §4.5 and Born & Wolf §3.3; the ray/eikonal equation is standard (Born & Wolf §3.2). verify_fermats-principle.py reproduces: the sympy identity d(OPL)/dx=n1sin⁡θ1−n2sin⁡θ2\mathrm{d}(\mathrm{OPL})/\mathrm{d}x=n_1\sin\theta_1-n_2\sin\theta_2; the least-time crossing x∗=5.665 cmx^*=5.665\ \mathrm{cm} (A=(0,4)A=(0,4), B=(8,−3)B=(8,-3) cm, n2=1.33n_2=1.33) with θ1=54.8°\theta_1=54.8°, θ2=37.9°\theta_2=37.9°, T′′>0T''>0, Tmin=0.400 nsT_\mathrm{min}=0.400\ \mathrm{ns}, versus the slower straight crossing xs=4.57 cmx_s=4.57\ \mathrm{cm}; the reflection x=4.8x=4.8, path 89\sqrt{89}, θi=θr=58.0°\theta_i=\theta_r=58.0°; and the ellipse (∣F1P∣+∣F2P∣=2a|F_1P|+|F_2P|=2a constant; flat mirror ⇒ minimum, tighter circle ⇒ maximum). The wave-superposition reading and the optical–mechanical analogy are standard (Feynman Vol. I Ch. 26).

Builds on: Ray Model of Light · Refractive Index and Optical Path Length. Leads to: Law of Reflection · Snell's Law of Refraction · Refraction at a Spherical Surface · Total Internal Reflection and the Critical Angle.

Is Fermat's principle about least time or least distance — they seem to disagree in the worked example?

Least time, and the two differ whenever the media differ. The straight line is the least-distance path, but it wastes time crossing too much slow water; the real ray trades a little extra fast-air distance for a bigger saving in slow water and comes out ahead on the clock. Only in a uniform medium, where every metre costs the same time, do least distance and least time coincide — and then Fermat's principle reduces to "light goes straight." The quantity that is actually stationary is the optical path length ∫n ds\int n\,\mathrm{d}s — time times cc, not geometric length.

Does light really test every path, or somehow know where B is before it starts?

No — that is a misreading. Fermat's principle states which ray you end up seeing, not a mechanism the light executes. The honest account is the wave one: light propagates as a field over all paths, each carrying a phase proportional to its optical length. Near the stationary path neighbouring paths have almost the same length and phase, so they reinforce; far from it, tiny path changes swing the phase wildly and cancel. The surviving light concentrates near the stationary path — what geometrical optics calls "the ray." Feynman's path-integral quantum mechanics is the same idea generalized to matter.

Can the least-time path ever be a maximum-time path — and how would I know?

Yes, and the test is the sign of the second variation. Between the foci of an ellipse every reflected path has equal length, so the extremum is degenerate; a mirror flatter than that ellipse makes the reflection a minimum, while a more sharply curved one (a concave mirror tighter than the confocal ellipse) makes the very same ray a maximum relative to its neighbours. In all three the first variation vanishes — that is what "stationary" means and all Fermat requires. Plane interfaces and plane mirrors always give a clean minimum, which is why "least time" survives as a slogan until you meet a curved mirror.

How exactly is Fermat's principle related to mechanics and the principle of least action?

They are the same variational law under a dictionary. In the optical–mechanical analogy the index nn plays the role of a particle's momentum p=2m(E−V)p=\sqrt{2m(E-V)}, so Fermat's δ ⁣∫n ds=0\delta\!\int n\,\mathrm{d}s=0 becomes Maupertuis' stationary action δ ⁣∫p ds=0\delta\!\int p\,\mathrm{d}s=0; optical rays correspond to trajectories, and the eikonal to Hamilton's principal function, whose propagation law is the Hamilton–Jacobi equation. Both hold because geometrical optics is the short-wavelength limit of wave optics exactly as classical mechanics is the classical (ℏ→0\hbar\to0) limit of quantum mechanics — the parallel Hamilton spotted in 1834 and Schrödinger later ran in reverse to reach wave mechanics.

What happens to the least-time path at the critical angle?

Going from a denser to a rarer medium (n1>n2n_1>n_2), Snell's law demands sin⁡θ2=(n1/n2)sin⁡θ1\sin\theta_2=(n_1/n_2)\sin\theta_1, and once θ1\theta_1 is large enough this asks for sin⁡θ2>1\sin\theta_2>1, which no real angle satisfies. The stationary crossing point simply ceases to exist: there is no refracted ray. That threshold is the critical angle, θc=arcsin⁡(n2/n1)\theta_c=\arcsin(n_2/n_1) — for water to air, arcsin⁡(1/1.33)=48.8°\arcsin(1/1.33)=48.8° — beyond which all the light reflects internally. Fermat's principle signals total internal reflection cleanly, as the disappearance of the real refracted extremum — where the next article picks up.

Descartes also derived Snell's law — what did Fermat get right that Descartes did not?

The law, but not the cause. Descartes (1637) got the correct sine relation from a model in which light travels faster in the denser medium. Fermat found the same n1sin⁡θ1=n2sin⁡θ2n_1\sin\theta_1=n_2\sin\theta_2 from least time, but only if light travels slower there — the opposite premise. For two centuries neither could be ruled out, since both fit the bending. Foucault's and Fizeau's mid-19th-century measurements settled it: light is slower in water than in air, so Fermat's premise was right, Descartes' wrong, and the wave theory explained why v=c/nv=c/n.

Before this

Where this leads