For variations with , integration by parts gives . The fundamental lemma of the calculus of variations therefore gives the Euler-Lagrange equation
For the ramp, use conservation of energy from rest at the rim. The vertical drop is , so . The spherical surface arc length is . On a monotone segment described by , the travel time is consequently
For increasing this has the printed limits to ; for a descent, reverse the decreasing angular limits to keep time positive. The azimuth is a cyclic coordinate of this integrand. Its conserved derivative gives the first integral for the brachistochrone on a hemispherical ramp:
Solving for its square yields
For a regular stationary path with finite , this tends to zero as the rim is approached. The ratio of azimuthal to meridional displacements is , which also tends to zero. Hence the initial direction is along a meridian toward the bottom. This conclusion concerns the initial heading; the later route can turn before reaching the bottom when its rim endpoints require a nonzero azimuthal displacement.