# Calculus of variations, Fermat's principle

Gold Member

## Homework Statement

Fermat's principle establishes that the path taken by a light ray between 2 given points is such that the time that the light takes is the smallest possible.
1)Demonstrate that a light ray which propagates through a medium with a constant refractive index follows a straight line.
2)Demonstrate that Snell's law holds for a ray of light passing by 2 points separated by a plane inter-phase which separates 2 different mediums (i.e. with different refractive indexes).
3)Determine the equation of the trajectory of a ray of light in the y-z plane assuming that the refractive index changes with z, i.e. n=n(z).

## Homework Equations

$$S=\int _{t_1} ^{t_2} L dt$$.
Optical path: $$L=\int _a ^b n(\vec r) ds$$. I'd bet it should be $$L=\int _a ^b n(\vec r) d\vec s$$, right?
Euler-Lagrange equations: $$\frac{d}{dt} \left ( \frac{\partial L}{\partial \dot q} \right ) - \frac{\partial L}{\partial q}=0$$.

## The Attempt at a Solution

1)$$S=n \int _a ^b dr = n (b-a) \square$$.
2)$$S= \int _a ^b n(\vec r) d\vec r$$. Here I'm not sure, but I think I should reach something like $$n_1 \int a ^c d\vec r + n_2 \int c ^b d\vec r$$ but I don't really trust it. I don't think I can even use the fact that $$n_1=\frac{c}{v _1}$$. It's a problem arising in Classical Mechanics, not optics. And we're dealing with variational calculus and Euler-Lagrange's equations.
Do you have any idea how to tackle part 2? I'll try to do part 3 right after I've done part 2.
Thanks for any help.

Matterwave
Gold Member
How do you do Fermat's principle while incorporating the principle of least action?

What does action have to do with these problems?

I'm not 100% but my professor once showed 1) and 2) using only maximizing and minimizing tools...without using any concept of action.

Cyosis
Homework Helper
Not sure what you're doing in 1).

To determine the shortest path light will travel between two points you will need to minimize the action, which yields the EL equations, which you then have to solve.

It is given that the refractive index is constant hence v is constant (v=cn).

The distance between two points on a curve is given by ds=vdt:

Fermat's principle then says that the path the light actually travels minimizes the time integral:

$$\int \frac{ds}{v}=\int \frac{\sqrt{dx^2+dy^2}}{v}=\int \frac{\sqrt{1+y'^2}}{v}dx$$

2) If you've done 1) correctly you should have found that the path is a straight line. Now draw the path plus refraction in an xy diagram. Also add the normal and label the refractive angle and incident angle. Now you can calculate the length of the hypotenuse of the two triangles. Find an expression for the time and minimize this expression then calculate the sin of both angles.

You can of course also split up the integral in two two integrals going from x0 to x1 and x1 to x2 then minimizing again and solving the equation, however since you already know the path the light will travel from 1) you may as well just use Pythagoras.

3)See 1) however v is no longer constant.

Last edited:
Gold Member
Ok thanks to both, this should get me started. I'm going to start this weekend.

Gold Member
Ok, I need some further help for 1).
So the Lagrangian is $$\sqrt {1+y' ^2}$$ since v is a constant and minimizing the integral is the same as minimizing the integral without the 1/v factor.
So now I have to put this Lagrangian in Euler-Lagrange's equations.
When $$q_i =x$$, there's nothing special, 0=0.
When $$q_i = y$$, I get that $$\frac{\partial \sqrt {1 + y'^2}}{\partial y}=\frac{y '}{\sqrt {1+y'^2}}$$.
So E-L equations become $$\frac{y '}{\sqrt {1+y'^2}}-\frac{d}{dt} \left ( \frac{y'}{\sqrt {1+y'^2}} \right ) =0$$. Is the second term just 0? I'm not 100% sure because y' might depend on ds which depends on t.
If it is 0 then y'=0 and so y, which is false. So clearly the second term is not null. How should I calculate it?

gabbagabbahey
Homework Helper
Gold Member
I get that $$\frac{\partial \sqrt {1 + y'^2}}{\partial y}=\frac{y '}{\sqrt {1+y'^2}}$$.

No,

$$\frac{\partial}{\partial y'}\sqrt{1+(y')^2}=\frac{y'}{\sqrt{1+(y')^2}}[/itex] But, [tex]\frac{\partial}{\partial y}\sqrt{1+(y')^2}=0[/itex] Since there is no explicit y-dependence. Gold Member No, [tex]\frac{\partial}{\partial y'}\sqrt{1+(y')^2}=\frac{y'}{\sqrt{1+(y')^2}}[/itex] But, [tex]\frac{\partial}{\partial y}\sqrt{1+(y')^2}=0[/itex] Since there is no explicit y-dependence. Oops, you're right. A little question: how do you know that y' does not depend on y? Gold Member Now I get [tex]\frac{d}{dt} \left ( \frac{y'}{\sqrt {1+(y')^2}} \right )=0 \Rightarrow y' = C \Rightarrow y(x)=ax+b$$. Which is the equation of a straight line as required.
Now, is it safe to assume that y depends on x? I don't understand why.

gabbagabbahey
Homework Helper
Gold Member
Why not? Keep in mind that even a function that doesn't depend on $x$, say $y=2$ , Can be thought of as being constant w.r.t $x$. It is more general to assume that $y$ depends on both $x$ (explicitly) and $t$ (implicitly)...and if you find that $y'(x)=0$...then you know that it is constant w.r.t. $x$.

gabbagabbahey
Homework Helper
Gold Member
Oops, you're right. A little question: how do you know that y' does not depend on y?

Because it's a partial derivative, you are only concerned with explicit dependence and not implicit dependence.

Gold Member
Why not? Keep in mind that even a function that doesn't depend on $x$, say $y=2$ , Can be thought of as being constant w.r.t $x$. It is more general to assume that $y$ depends on both $x$ (explicitly) and $t$ (implicitly)...and if you find that $y'(x)=0$...then you know that it is constant w.r.t. $x$.

Because it's a partial derivative, you are only concerned with explicit dependence and not implicit dependence.
Thank you, it makes sense.

I tried 2), but I get into a horrible Lagrangian.
I took the point (x_1,y_1) as in the medium with refractive index n_1 and (x_2, y_2) the point in the medium with refractive index of n_2.
$$t=\frac{s_1}{v_1}+\frac{s_2}{v_2}=\frac{\sqrt {x_1 ^2 + y_1 ^2}}{v_1}+\frac{\sqrt {x_2^2+ y_2^2}}{v_2}$$ where $$v_1=cn_1$$ and $$v_2=cn_2$$.
But $$x_i$$ are given (they are not variables), so I can rewrite $$s_1$$ as $$\frac{x_1}{\cos \theta _i}$$ and $$s_2$$ as $$\frac{x_2}{\cos \theta _r}$$.
Thus $$s=\frac{x_1}{\cos \theta _i}+\frac{x_2}{\cos \theta _r}$$.
Since $$t=\int \frac{ds}{v}$$, I must find the total derivative of s.
I found it to be ... $$d\theta _i \left ( \frac{x_1 \sin \theta _i}{(\cos \theta _i)^2} \right ) + d\theta _r \left ( \frac{x_2 \sin \theta _r}{(\cos \theta _r)^2} \right )$$. I don't really trust this result. How could I find the Lagrangian from here? (factorizing by $$d\theta _i$$ for instance?)

Cyosis
Homework Helper
The two light rays are connected with each other. With the way you have set up your problem there is some gap between the two rays (which is really just one ray).

Call the x coordinate where the light ray gets refracted x. The start of the beam before refraction x1 and the 'end' of the second beam x2. Then we can calculate the length of the path as $s_1^2=(x-x_1)^2+y_1^2$ and $s_2^2=(x_1-x)^2+y_2^2$. Now you can minimize.

Gold Member
The two light rays are connected with each other. With the way you have set up your problem there is some gap between the two rays (which is really just one ray).

Call the x coordinate where the light ray gets refracted x. The start of the beam before refraction x1 and the 'end' of the second beam x2. Then we can calculate the length of the path as $s_1^2=(x-x_1)^2+y_1^2$ and $s_2^2=(x_1-x)^2+y_2^2$. Now you can minimize.

Did you mean $$s_2^2=(x_2-x)^2+y_2^2$$?
When you say "the start of the beam before refraction x1", do you mean the orthogonal projection of the point (x_1,y_1) into the x axis, axis of the refraction?

Cyosis
Homework Helper
Yes it should be x_2 and yes I mean the orthogonal projection. Just make a quick drawing if you haven't already.

Gold Member
Yes it should be x_2 and yes I mean the orthogonal projection. Just make a quick drawing if you haven't already.

Thank you very much. I had made a drawing and wanted to be sure I wasn't missing something.