1. ## Euler Lagrange equation

i have no idea with the part under red line

2. The path of the light ray is given by an equation y = y(x). The time taken for the ray to travel along the path is given in infinitesimal terms by $dT = \frac{\sqrt{1+y'^2}\,dx}{c(x)}$ ("time = distance/speed"). Integrate that to get $T = \int_{x_1}^{x_2}\frac{\sqrt{1+y'^2}}{c(x)}\,dx.$ The E–L equation tells you that the extremal path is given by $0 = \frac d{dx}\Bigl(\frac\partial{\partial y'}\Bigl(\frac{\sqrt{1+y'^2}}{c(x)}\Bigr)\Bigr) = \frac d{dx}\Bigl(\frac{y'}{c(x)\sqrt{1+y'^2}}\Bigr)$. In other words, $\frac{y'}{c(x)\sqrt{1+y'^2}}$ is a constant, which for convenience we can call $k^{-1}.$

Then $ky' = c(x)\sqrt{1+y'^2}$. Square both sides, solve for $y'^2$ and take the square root again, to get $y' = \frac{c(x)}{\sqrt{k^2-c^2(x)}}.$ Integrate that to get $y_2 - y_1 = \int_{x_1}^{x_2}\frac{c(x)}{\sqrt{k^2-c^2(x)}}\,dx.$

The last part is straightforward calculus.