How to derive Snell's law through Fermat's principle?

195 Views Asked by At

It is an exercise from an textbook of Classical Mechanics. Specifically a chapter about calculus of variations. I would like a hint first. What I don't understand is how to apply Euler equation when $y(x)$ is defined by parts (is it a function $y_1$ in the first media and $y_2$ in the second?).