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 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.
- Fermat's principle selects the physical ray between two fixed points as the one whose optical path length — equivalently the travel time — is stationary under small path variations.
- Requiring for a ray crossing a plane interface gives — Snell's law is a theorem, not a postulate; the same demand at a mirror gives .
- "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 maps to momentum , 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, ; the crossing point that makes it stationary is exactly the one obeying Snell's law.
Light follows the path for which the optical path length — equivalently the travel time — is stationary, . 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 , 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 explains the highway mirage, the flattened setting Sun, and the graded cores that guide light down optical fibres. Push the interface until can no longer be matched by any real 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 in air to under water. Air is "fast" (, speed ); water is "slow" (, speed ). 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.
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.
The curve is the whole principle in nanoseconds. Its left wall is steep — cross too near '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 , . The amber dot marks where the straight line from to 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 has wavelength 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 makes it the transit time:
where: — local refractive index; — arc-length element; — the fixed endpoints; — the vacuum speed of light, (SI-exact). Since and OPL differ only by the constant , "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:
where: — 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 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 in medium to in medium , crossing a plane interface at one point — the functional collapses to a function of one variable, , and becomes ordinary calculus, . That derivative (Derivation B) delivers the law of refraction:
where: — the angles from the interface normal; the sines emerge as and . Snell's law is thus the stationarity condition of , not an axiom; collapses it to — 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:
where: — the unit tangent to the ray; — the index gradient, which steers the ray toward higher . Set and rays are straight; let 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 plays precisely the role of a particle's momentum , an optical ray maps onto a mechanical trajectory, and Fermat's becomes Maupertuis' principle of least action . The optical eikonal — 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 () 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.
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 -axis with both points above it, and ; let the ray touch at . In one medium of index , . Why drop : it multiplies every term, so stationary optical length is stationary geometric length — reflection is a shortest-distance problem.
Step 2. Reflect to its image . For any touch point the second leg equals the distance to , since reflecting an endpoint across the axis preserves its distance to points on the axis. So has exactly the length of . Why this is the trick: it converts a kinked path into a candidate straight line, and the shortest connection from to is the straight segment.
Step 3. The sum is smallest when 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 with the normal. Why a genuine minimum: any other touch point forces a strictly longer dog-leg to , so .
Step 4. Differentiating directly agrees: gives . For , the ray reflects at , path , . Why both routes agree: the image construction is the geometric shadow of the calculus. *Verified in verify_fermats-principle.py: the image-method point matches the calculus root, path , , and (a minimum).*
Go deeper · Derivation B · 1 minSnell'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 in medium to in medium , crossing the -axis at . The travel time is the two indexed legs over : . Why one variable suffices: with straight legs in each uniform medium, the only freedom left is the crossing point .
Step 2. Differentiate and set to zero: . Why the minus sign: raising 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: in medium 1, in medium 2. The condition is therefore — Snell's law. Why it is inevitable: is literally , an identity sympy confirms exactly, so its zero is Snell and nothing else.
Step 4. Put numbers to it. For air, water, , , the root is , giving , , ; , so is a minimum. Why the check matters: the sign of separates this minimum from the maximum and degenerate cases of the next card. *Verified in verify_fermats-principle.py: the sympy identity ; the root , , , Snell to , , .*
Go deeper · Derivation C · 2 minWhy "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 and semi-major axis , every point obeys , a constant. A ray from reflecting to therefore has the same optical length wherever it strikes. Why this is stationarity in purest form: if length does not change as moves, its first variation vanishes everywhere — every point is stationary, degenerately.
Step 2. Replace the ellipse by its tangent plane at — a flatter mirror. Now the reflected path is longer at every neighbour than at , so is a genuine minimum: a plane mirror always gives a least-length path. Why flatter means minimum: the tangent lies outside the ellipse near , 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 , so 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 () the sum is constant to machine precision; the flat tangent mirror makes a minimum, and a tighter circle () makes a maximum.*
Limiting cases
| Case | Result | Meaning |
|---|---|---|
| uniform medium, | shortest geometric length — light travels in straight lines | |
| plane interface | , | refraction; the stationary crossing is a true time minimum (Snell) |
| plane mirror | , | reflection; minimum, equal to the straight line to the image |
| concave mirror / ellipse | but a maximum or degenerate | stationary path can be longer than neighbours; "least time" fails |
| graded index, | rays curve toward higher — mirages, GRIN lenses, atmospheric refraction | |
| beyond the critical angle | no real refracted path () | the refracted extremum ceases to exist — total internal reflection |
Worked examples
1 · The least-time crossing, solved (confidence builder)
A ray leaves in air () and reaches in water (). Find the crossing point light takes, verify Snell's law, and compare its time with the straight-line path.
Step 1. Write the time versus crossing point : (cm). Fermat says solve .
Step 2. The derivative solves numerically to — well right of the midpoint, since the ray hugs the fast air and cuts the slow water.
Step 3. Check Snell. At , so , and so . Then and : Snell's law holds exactly, and confirms a minimum.
Step 4. Time the two routes. The least-time path takes . The straight geometric line crosses at and takes — 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 and detector sit above a flat mirror on the -axis (one medium). Where does the ray strike, how long is its path, and what are the angles?
Step 1. Reflect to its image . By the image theorem any reflected path equals in length, so the shortest reflected path is the straight segment .
Step 2. That segment has length , and it crosses the mirror where the line from to meets : at .
Step 3. The incidence and reflection angles from the normal satisfy and , so . The equal angles are automatic once , , are collinear.
Step 4. Any other touch point forces a bent, strictly longer route to , so its total path exceeds : 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
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.
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 ; the least-time crossing (, cm, ) with , , , , versus the slower straight crossing ; the reflection , path , ; and the ellipse ( 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 — time times , 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 plays the role of a particle's momentum , so Fermat's becomes Maupertuis' stationary action ; 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 () 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 (), Snell's law demands , and once is large enough this asks for , which no real angle satisfies. The stationary crossing point simply ceases to exist: there is no refracted ray. That threshold is the critical angle, — for water to air, — 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 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 .