A ray of light goes from point $A$ in a medium in which the speed of light is $v_{1}$ to point $B$ in a medium in which the speed is $v_{2}$ (Fig. 33.55$)$ . The ray strikes the interface a horizontal distance $x$ to the right of point $A$ . (a) Show that the time required for the light to go from $A$ to $B$ is
$$
t=\frac{\sqrt{h_{1}^{2}+x^{2}}}{v_{1}}+\frac{\sqrt{h_{2}^{2}+(l-x)^{2}}}{v_{2}}
$$
(b) Take the derivative of $t$ with respect to $x$ . Set this derivative equal to zero to show that this time reaches its minimum value when $n_{1} \sin \theta_{1}=n_{2} \sin \theta_{2}$ . This is Snell's law, and corresponds to the actual path taken by the light. This is another example of Fermat's principle of least time (see Problem 33.56 ).