Light Ray Trajectory through Periodic Refractive Index Consider a ray of light travelling between two points A and B on the $xy$ plane. Using the calculus of variations and Fermat's Principle we can derive equations which give the trajectory of a ray of light through a medium of given refractive index $n(y)$ by minimising,
\begin{equation}
T = \int n(y) \sqrt{1+{\Big(\frac{dy}{dx}\Big)}^2}dx
\end{equation}
and using the Euler-Lagrange equations we arrive quickly at an integral expression for the trajectory as
\begin{equation}
x = \int \frac{\alpha\> dy}{\sqrt{{n(y)^2-\alpha}^2}}
\end{equation}
with $\alpha$ as some arbitrary constant based on initial conditions. 
Now consider the refractive index of the medium to be $\> n(y)= n_0 \cos(ky)$.  
At this point I can't seem to progress; Is this integral solvable with this continuously varying index? Is this the correct approach or is there a more convenient way to find the trajectory?
 A: The integral you're trying to solve is
$$
x = \int \frac{\beta}{\sqrt{\cos^2 (ky) - \beta^2}} dy = \int \frac{\beta}{\sqrt{(1 - \beta^2) - \sin^2 (ky)}} dy \\= \frac{\beta}{\sqrt{1 - \beta^2}} \int \frac{dy}{\sqrt{1 -  \sin^2 (ky)/(1 - \beta^2)}} dy,
$$
where $\beta \equiv \alpha/n_0$.  This can be recognized to be an incomplete elliptic integral of the first kind:
$$
x - x_0 = F \left( ky  \left|  \frac{1}{1 - \beta^2}\right) \right.
$$
where $x_0$ is the $x$-coordinate when $y = 0$.  If desired, this can be inverted to find $y(x)$ in terms of the Jacobi elliptic functions:
$$
y = \frac{1}{k} \sin^{-1} (\mathrm{sn} (x - x_0)).
$$
In this notation, the use of the parameter $1/(1- \beta^2)$ in the definition of the inverse function is understood.
In some sense, I haven't really told you how to evaluate this integral;  I've just told you that this integral has a name and has been studied (along with its inverse function.)  The problem of plotting $y(x)$ (or $x(y)$) and understanding where the trajectories go is still there;  and unless you have a completely intuitive understanding of the elliptic functions (I don't), then this is probably unilluminating.  Still, it might give you somewhere to go from here;  most mathematical handbooks can tell you about the analytical properties of the elliptic integrals and the Jacobi elliptic functions, and a computer language that can do upper-level math (e.g., Mathematica, Maple, MATLAB, etc.) could plot the trajectories out for you.
