Solution (source code)

= Solution

The <Fermat principle> states that the actual path of a <light ray> makes its travel time stationary under small admissible <variations> with fixed endpoints. Equivalently, its <optical path length> is stationary:
$$
\boxed{\delta T=\delta\int\frac{ds}{v(\mathbf x)}=0,\qquad\delta\int n(\mathbf x)\,ds=0,}
$$
where $v$ is the local light speed, $n$ is the <refractive index>, and the two integrals differ by the constant vacuum light speed. In a uniform medium this reduces to stationarity of geometric path length. The principle is a stationarity statement; for the planar reflection considered next the stationary path is also the unique minimum.