If light travels with speed $v_{1}$ in one medium and speed $v_{2}$ in a second medium, and if the two media are separated by a plane interface, show that a ray of light passing from point $A$ in one medium to point $B$ in the other is bent at the interface in such a way that
$$\frac{\sin i}{\sin r}=\frac{v_{1}}{v_{2}},$$
where $i$ and $r$ are the angles of incidence and refraction, as is shown in Figure 4.59. This is known as Snell's Law. Deduce it from the least-time principle stated in Exercise 39.