French mathematician Pierre de Fermat used the principle of least action to explain why light bends as it moves from a thinner to a thicker substance (from air to glass, for instance) – and Richard Feynman made it a fundamental part of quantum electrodynamics.
The principle of least action describes why a basketball follows a particular route through space on its way to the basket. It rises and falls along the path that keeps the difference between the ball’s kinetic energy (the energy that makes it move) and potential energy (the energy that gravity gives it by pulling it downwards) to a minimum. Kinetic energy increases as the ball goes faster and decreases as it slows. Potential energy goes up as the ball gets higher in the air and reduces as it falls. The principle of least action establishes a balance between the two.
This principle is applied to light by considering time. The principle of least time says that light takes the quickest route. Fermat had to make two assumptions – that light’s speed isn’t infinite (the speed of light was yet to be measured in 1661 when Fermat produced this result), and that light moves slower in a dense material like glass than it does in air. We are used to straight lines being the quickest route between any two points – but that assumes that everything remains the same on the journey. In the case of light going from air to glass, bending is the quickest route. To see why this is the case, compare the light’s journey to a lifeguard, rescuing someone drowning in the sea. The obvious route is to head straight for the drowning person. But the lifeguard can run much faster on the beach than in the water. By heading away from the victim, taking a longer path on the sand, then bending inwards and taking a more direct path in the water, the lifeguard gets there quicker.
Similarly, a light ray can reduce its journey time by spending longer in air and less time in glass. The angle that minimizes the journey time is the one that actually occurs.
When Richard Feynman was inspired by the principle of least action to come up with quantum electrodynamics, the theory that describes the interaction of light and matter so brilliantly, he imagined not just the one “best” path but every single possible path a particle could take in getting from A to B. At the heart of QED is the idea that you can identify the particles behaviour by taking a sum of every single possible path combined with the probability of that path occurring.