Help With Calculus of Variations I've been given the problem 

"Use Fermat's Principle to find the path followed by a light Ray if the index of refraction is proportional to $y^{-1}$."

Honestly I'm not too sure at all how to begin. I figured Snell's law may come into play here, but not entirely sure. I know that Fermat's Principle is that light will take the quickest path from point A to B, so I figured I should minimize some functional F.  But can't seem to figure this one out.
 A: Fermat's  Principle states that light travels along the path of least time. From basic mechanics, the time for a particle to travel from a point $A$ to a point $B$ is $$t_{a\rightarrow b} = \int_{a}^{b}\frac{ds}{v}.$$ Here $ds$ is an arc length and $v$ is the velocity of particle. In general, the speed of the particle has a dependence on the path taken. I can't give you the answer but you should be able to relate the given parameters of the problem to the ones that I have provided.
These types of problems are known as brachistochrones, this link discusses them in more detail.
A: This question is interesting conceptually because different choices of integration variable may or may not lead to a first integral.  First, note that
$$
\frac{ds}{v}=\frac{\sqrt{dx^2+dy^2}}{c/n}=\frac{\sqrt{dx^2+dy^2}}{c}n(y)
=\frac{\sqrt{dx^2+dy^2}}{c}\frac{1}{y}
$$


*

*Write $ds=\sqrt{dx^2+dy^2}=dy\sqrt{1+(x')^2}$ with $x':= dx/dy$.  Then we get as an integrand 
$$
t=\int dy\, , L(x',y)\qquad \qquad  L(x',y)=\sqrt{1+(x')^2}\frac{1}{y}\, .
$$
The Euler-Lagrange equation is just
$$
\frac{d}{dy}\left(\frac{\partial L}{\partial x'}\right)-\frac{\partial L}{\partial x}=0
$$
but since $L$ does not depend explicitly on $x$ we immediately get a first integral:
$$
\frac{\partial L}{\partial x'}=\frac{x'}{\sqrt{1+(x')^2}}\frac{1}{c\,y}=\hbox{constant}\, ,
$$
from which $x(y)$ can be easily obtained.

*If, on the other hand, we write $ds=dx\sqrt{1+(y')^2}$, we get this time
$$
t=\int dx\, L(y,y')\, ,\qquad\qquad L=\sqrt{1+(y')^2}\,\frac{1}{c\,y}
$$
and the ELE as
$$
\frac{d}{dx}\left(\frac{\partial L}{\partial y'}\right)-\frac{\partial L}{\partial y}=0
$$
which does not produce a first integral.

