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 ("time = distance/speed"). Integrate that to get The E–L equation tells you that the extremal path is given by . In other words, is a constant, which for convenience we can call
Then . Square both sides, solve for and take the square root again, to get Integrate that to get
The last part is straightforward calculus.