# Finding Snell’s Law as a Max-Min Problem Using Fermat’s Principle

Let me be clear. My main goal is to get to the calculus of variations and use the Euler-Lagrange equation for some cool stuff. However, I think it’s important to start off with some problems that sort of do the same thing but are less complicated.

So, here is the situation. I want to find the path of light as it travels from one medium (say air) into another medium (like water). For this, I will use Fermat’s Principle. This says that light will take a path with that will take the least amount of time. Obviously in a single material, this would also be the shortest distance (which is usually a straight line) since the velocity is constant. However, with materials like air and water the apparent speed of light changes as the following.

Where *c* is the speed of light and *n* is the index of refraction. But with two different speeds (apparent speed) of light, the light would need to have a shorter distance in the slower medium. OK, let’s say light is going from point A in medium 1 (with index of refraction n1) to point B in a different material (with an index of refraction n2). Here is a diagram.

Yes, there’s a bunch of stuff there — but don’t worry, I’m going to go through all of this.

First, there is that point on the interface between the two materials. It’s a distance of *x* along the interface from the x-value for point A. The light from A travels in a straight line from A to that point, and then from another straight line from the point to B. I can move this interface point back and forth until I find the path with minimum time. Honestly, this is what is so awesome about this problem. It’s really finding a path of least time (calculus of variations), but we can set it up as a max-min problem since there is only one variable that is changing (x).

Once I find the the path lengths in the two materials (s1 and s2), then the total time would be calculated as:

But of course, s1 and s2 both are functions of x (the distance to the interface point). OK, it’s going to get a little messy — just hang on. I’m going to say the interface is at y = 0. Also, the x position of point A is at x = 0. (why make it harder than it has to be?) That means s1 and s2 can be found as:

This gives a total time of (notice the common denominator of c):

Now I just need to take the derivative of this (with respect to x) and set that equal to zero to solve for x. That’s your standard max-min problem. Let me rewrite the time function to be easier to take a derivative.

Just a reminder — the only variable here is x. Now to take the derivative (using the power rule):

Now setting this equal to zero and doing a little bit of algebra, I get:

This looks tricky to solve — so let’s just NOT. How about a trick instead? Let’s look at the diagram for the path of light again — but this time with some angles.

So, there are two angle — θ1 and θ2. Let’s look at θ1 as part of the right triangle above. I know the value for s1, so I can find an expression for sin(θ1) and sin(θ2).

Well, what do you know? Those are the same expressions in the equation for x-min above. If I substitute, I get:

Boom. That’s Snell’s Law. It’s a relationship between the indexes of refraction and the incident and refracted angles of light.