Solution (source code)

= Solution

The autonomous <Lagrangian> has the <Beltrami identity>
$$
\sum_i\dot q_iL_{\dot q_i}-L=\text{constant}.
$$
Here $L$ is homogeneous of degree two in the velocities, so $\dot uL_{\dot u}+\dot vL_{\dot v}=2L$. Thus \b[$L$ itself is constant], say $C\geq0$.

For $C>0$, put $\ell=\sqrt L$. Its Euler-Lagrange expression along the curve is
$$
\frac{d}{dt}\ell_{\dot q_i}-\ell_{q_i}
=\frac1{2\sqrt L}\left(\frac{d}{dt}L_{\dot q_i}-L_{q_i}\right)
-\frac{\dot L}{4L^{3/2}}L_{\dot q_i}=0.
$$
The first term vanishes by stationarity for $L$, and the second by constancy of $L$. Thus the same path is stationary for its length functional $\int\sqrt L\,dt$.

On a regular segment described as a graph $v=v(u)$, reparametrize by $u$. Since $\dot v=v_u\dot u$,
$$
\sqrt L\,dt=\sqrt{E+2Fv_u+Gv_u^2}\,|du|.
$$
Choose the orientation with increasing $u$; reversing it does not change stationarity. Invariance of length under regular reparametrization therefore gives
$$
\boxed{\delta\int\sqrt{E+2Fv_u+Gv_u^2}\,du=0.}
$$
This is the principle of <length extremals from a constant quadratic energy>. The stated nonnegativity also permits the degenerate case $C=0$. Then the length is zero, its absolute minimum since the integrand is nonnegative, so it is an extremal in the minimizing sense. The differentiated square-root Euler-Lagrange equation above is only used where $L>0$; it would not be legitimate to divide by $\sqrt L$ on a null curve. For a genuine surface metric and a regular nonconstant path, $C>0$ automatically.