Let's generalize a bit to say we want to find the quickest path across two media:

We are traveling from point A to point B then to point C by the quickest path possible. The question is, where should point B be placed?

I have set up xy coordinate axes such that:

The distance from A to B is:

The distance from B to C is:

The speed through medium 1 is and the speed through medium 2 is . We assume both velocities are positive values. Thus, using the relationship between distance, constant velocity and time, we find the total time as a function of B is:

Differentiating with respect to B, we find:

The denominator will always be positive, so we need only consider:

Let's take a moment to rewrite this:

Thus, we have shown that Snell's law (or Descartes' law) is satisfied when .