Fermat’s principle states that the path taken by a ray of light travelling between two points is that which is traversed in the least time.

This simple statement can be used to explain why light travels in straight lines in homogeneous media, is reflected at an angle equal to the angle at which it strikes a specular surface, and why a ray is refracted at the boundary between media of different refractive indices.

It’s this last phenomenon that forms the topic of this post: *refraction, *or the bending of a light ray as its propagation speed changes. But rather than looking at discrete, discontinuous jumps in speed, like the one that occurs at a glass-air or water-air interface, I want to explore how a ray behaves when its speed varies continuously with position.

The following set-up is a bit contrived, but stay with me; the result is pretty neat!

A ray of light emerges from a plane containing the origin. It travels through a uniform medium with constant refractive index .

The ray reaches an interface displaced a transverse distance from the origin. Beyond this boundary, there exists a strange region of space whose refractive index varies as the inverse distance from the plane containing the origin.

The refractive index of this funny region starts at and decays to 1.

We can sum up this information with a piecewise definition of the refractive index as a function of the ray’s distance from the plane containing the origin:

What does this mean in terms of ray’s propagation speed? The refractive index of a material is defined such that a beam of light moving through it travels at speed

where is the speed of light in vacuum. The greater the refractive index of a material, the slower light passes through it.

We can rewrite the information above in terms of the ray’s propagation speed :

This is perhaps the clearer definition: in the funny region, the speed of the beam increases *linearly* with position.

We know that the beam travels in straight lines in the regions of uniform refractive index. What we want to work out is how the beam behaves in the intermediate region.

To do so we’ll use Fermat’s principle. This says we should find the path that minimises the functional , the time taken for the beam to move between two points (just as for the brachistochrone).

Let’s set up the problem. The functional is given by

That is, the time taken for the beam to traverse its path is the sum of lots of little time intervals, during which it travels an infinitesimal distance at speed . Written in terms of refractive index, this is

I’ve tacitly introduced the coordinate , the independent variable which measures the beam’s position in a direction normal to the planes of constant .

The differential is related to small changes in and by

from Pythagoras’ theorem. This means

,

hence

To minimise this functional, we can use the Euler-Lagrange equation, which says the function that minimises this integral satisfies the differential equation

where

Since this Lagrangian does not explicitly depend on , we can use the Beltrami identity, derived from the Euler-Lagrange equation, which tells us

where is a constant. So satisfies the equation

After some manipulation we end up with

This first-order differential equation can be solved by rearranging and integrating directly:

where is a constant. Note that we can get this far without even needing to know the form of ! Now we can substitute in the expression for the refractive index of the funny region of space:

For convenience, we can just stick all the constants together into a blob:

So we want to solve the integral

Let’s try the substitution

Hence

Rearranging, we find

Hence, in the region in which the refractive index varies inversely with distance, the beam moves in a circular arc!

To understand how the beam behaves on a quantitative level, we should determine the values of the constants in the expression above.

We can choose the position of the centre of the circular arc such that the position at which the beam meets the interface at coincides with the axis. If the beam meets the boundary at angle to the normal, then the diagram to the right should convince you that

This doesn’t tell us anything, though: we need to work out the radius of curvature of the beam’s path, .

To do so, we can consider the gradient of the beam’s path at the position at which it meets the interface. We have the expression

Differentiating implicitly gives

Trigonometry tells us that

Hence

So the radius of curvature of the beam’s path is proportional to the cosecant of its angle of incidence . Cosecant, or one over sine (not arcsine!) is a function which approaches 0 as goes to 90 degrees, but blows up to infinity as goes to zero.

This means the shallower the angle of incidence, the greater the radius of curvature of the beam’s path. An important consequence of this is that if the beam approaches the interface at normal incidence, its path is unperturbed – it keeps travelling in a straight line (on the edge of a circle of infinite radius).

What else does this tell us? We can use to work out how far into the funny region the beam gets before it turns around. From the diagram above, this depth is equal to

So the penetration depth tends to 0 as the angle of incidence tends to 90 degrees, and tends to infinity at normal incidence.

Here’s another interesting question: below what angle of incidence does the beam escape the funny region, rather than being turned around? At this critical angle , the beam will *just* touch the edge of intermediate region before turning around.

This happens when the radius of curvature of the beam (the coordinate at which the beam turns around) coincides with the edge of the funny region of space. From the piecewise definition of above, this edge is at . So

This is precisely the critical angle predicted by Snell’s Law. If, for instance, the beam were gradually escaping from water, the critical angle would be about 49 degrees. Any beam approaching at an angle shallower than this would escape; any beam approaching at an angle steeper than this would be turned around.

If you’re so inclined, you can work out the angle at which an escaping beam would emerge from the funny region relative to the normal, and you would find this also agrees with the prediction of Snell’s law:

To the right is an animation of the beam’s path varying with angle of incidence.

Where can we see this kind of effect?

The peak of the Sun’s emission spectrum is in the visible range of the electromagnetic spectrum. Visible light can pass through the atmosphere untrammelled (ignoring Rayleigh scattering); we can see the Sun through the sky.

On reaching the Earth’s surface, some of this solar radiation is absorbed, causing the ground to become hot. The Earth then re-rediates some of this heat, not in the visible but in the *infrared* range of the electromagnetic spectrum.

While the atmosphere is largely unresponsive to visible light, it has an appetite for infrared radiation! Infrared rays emitted from Earth are eagerly absorbed by the atmosphere, with those constituent particles nearer Earth’s surface getting the bigger portion.

This creates a steep temperature gradient near the Earth’s surface – the air is hot near the ground, and cools quickly with increasing altitude.

Hot particles in an ideal gas are less friendly than cold particles. They rush about furiously, smashing into their neighbours, angrily pushing them away. The gap between hot air particles is much greater than that between cold, calm air particles. Hot air expands, and in doing so, decreases in density.

The less dense the air it is, the ‘easier’ it is for light to pass through it – this means the refractive index of the hot air near the ground is *less *than that of the cooler air above it.

So consider a beam of light sailing in from the upper atmosphere. As it approaches the ground, it enters a region in which the refractive index decreases with increasing depth. As shown above, this causes the beam of light to steadily turn and, if it approached at a sufficiently shallow angle, reverse its direction completely and travel back *up* into the atmosphere.

Now imagine this beam of light smacks into your retina. This beam, having come from the atmosphere, is blue. But to see it, you had to look towards the ground! Hence there appears to you to be a puddle of blue in the middle of the ground.

This is the origin of an inferior mirage.

A disclaimer: I’m not suggesting the refractive index of the atmosphere actually varies with inverse distance from some plane. The real situation would be much more complicated, particularly because hot air below cold air is not a stable configuration. The earth-baked air just above the ground will try to rise up through the cold air above it. This causes convection currents, bringing about the shimmering you see in a heat haze.

The general idea is the important bit – that rays of light tend to bend away from regions of decreasing refractive index.

The derivation of paths taken by light rays in inhomogeneous media is a really interesting application of the Euler-Lagrange equation(s). The next application I hope to show is in the derivation of the geodesics of a cone.