## Fermat's principle

Maxwell's equations can be used to derive the laws of reflection and refraction, which tell us how light waves behave at the boundary between two media with different indices of refraction.  In 1650, Fermat discovered a way to explain reflection and refraction as the consequence of one single principle.  It is called the principle of least time or Fermat's principle.

Assume we want light to get from point A to point B, subject to some boundary condition.  For example, we want the light to bounce off a mirror or to pass through a piece of glass on its way from A to B.  Fermat's principle states that of all the possible paths the light might take, that satisfy those boundary conditions, light takes the path which requires the least amount of time.

Consider the diagram on the right.  We want light to leave point A, bounce off the mirror, and get to point B.  Let the perpendicular distance from the mirror of both A and B be d and the shortest distance between the points be D.  Assume that light takes the path shown.  The length of this path is

L = (x2 + d2)½ + ((D - x)2 + d2)½.

Since the speed of light is the same everywhere along all possible paths, the shortest path requires the shortest time.  To find the shortest path, we differentiate L with respect to x and set the result equal to zero.  (This yields an extremum in the function L(x).)

dL/dx = x/(x2 + d2)½  -  (D - x)/((D - x)2 + d2)½ = 0.

x2/(x2 + d2)  =  (D2  + x2 - 2Dx)/(D2 + x2 - 2Dx + d2).
x2(D2 + x2 - 2Dx + d2)  =  (D2  + x2 - 2Dx)(x2 + d2).

After canceling equal terms on both sides we are left with d2D2 = 2Dx,   or x = D/2.
The path that takes the shortest time is the one for which x = D/2, or equivalently, the one for which θi = θr.  Fermat's principle yields the law of reflection.

Now assume we want light to propagate from point A to point B across the boundary between medium 1 and medium 2.  For the path shown in the figure on the right the time required is

t = (x2 + d2)½/(c/n1) + ((D - x)2 + d2)½/(c/n2).

Setting dt/dx = 0 we obtain

n1 x/(x2 + d2)½ = n2 (D - x)/((D - x)2 + d2)½

or n1sinθ1 = n2sinθ2.

Fermat's principle yields Snell's law.