Take fixed-endpoint variations with . The first variation is
The boundary term vanishes by the endpoint conditions. The fundamental lemma of the calculus of variations gives the Euler-Lagrange equation . Along its solutions,
When , this proves the Beltrami identity .
For the surface , the line element is . The arc-length integrand for a graph is . It has no explicit dependence and satisfies . Thus is constant. Choosing the fixed direction along a smooth nonconstant segment and integrating yields
The same result follows by defining the transverse arc coordinate , which changes the metric to . Its geodesics are straight lines in coordinates. This proves the formula for geodesics on a generalized cylinder and shows it gives locally shortest paths. The additional straight lines in the unrolled plane are also geodesics, but cannot be represented as graphs . Classical differential-geometric statements assume the surface has sufficient smoothness; the arc-length coordinate itself only requires the displayed integral to be well defined.