## Fermat's Principle

Fermat's principle states that the path taken between two points by a ray of light is the path that can be traversed in the least time and can be taken to define the path taken by a light ray. Equivalently we may say that the optical path length is the least possible.

Fermat's principle can be used to describe the properties of light rays reflected off mirrors, refracted through different media, or undergoing total internal reflection. It follows mathematically from Huygens' principle (at the limit of small wavelength), and can be used to derive Snell's law of refraction and the law of reflection.

Fermat's principle has the same form as Hamilton's principle and it is the basis of Hamiltonian optics, the Hamiltonian formulation of geometrical optics, which shares much of the mathematical formalism with Hamiltonian mechanics. It can be generalised to describe the paths taken by material particles, giving the method of variation of parameters and the principle of least action.

The time a light ray takes to travel from a point A to a point B is an minimum according to the principle, though in fact a full treatment only demands that it is an extremum of some sort.

If where is the speed of light in vacuum, an infinitesimal displacement along the ray, is the speed of light in a medium and the refractive index of that medium, then the path taken by light will be that path that minimises this integral. The optical path length of a ray from a point A to a point B is defined by and is related to the travel time by It is a purely geometrical quantity since time is not considered.

In the context of calculus of variations this can be written as The calculus of variations is a much more wide ranging method, with wide applications in mechanics, and used to derive the Lagrangian equation of motion for example. 