= Solution
<Fermat's principle> states that the travel time, or equivalently the <optical path length> $\int n\,ds$ in a stationary medium, is stationary under small variations of the path with endpoints held fixed. It need not be a global minimum.
Let a <light ray> join a point at height $h_1$ above a plane interface to a point at depth $h_2$ below it, with horizontal separation $D$. If the crossing point is horizontally $\xi$ from the first endpoint, its <optical path length> is
$$
\mathcal L(\xi)=n_1\sqrt{h_1^2+\xi^2}
+n_2\sqrt{h_2^2+(D-\xi)^2}.
$$
Setting its derivative to zero gives
$$
\frac{n_1\xi}{\sqrt{h_1^2+\xi^2}}
=\frac{n_2(D-\xi)}{\sqrt{h_2^2+(D-\xi)^2}}.
$$
The two geometric ratios are the sines of the incident and refracted <angles>, measured from the interface <normal vector>. Hence <Snell's law> is
$$
\boxed{n_1\sin\theta_1=n_2\sin\theta_2.}
$$
Back to article page