Let be the -variation Eric Weisstein's World of Math (which is distinct from -variation Eric Weisstein's World of Math) of the Lagrangian L, so
where is the varied path
and and are the initial and final times, respectively. Integrating by parts then yields
since
where is a generalized momentum. The two variations are connected by
so
Now, require that
But the definition of the action integral is
so
If the defining equations for generalized coordinates do not involve time explicitly, then the kinetic energy T is a quadratic function of the s,
If the potential is not velocity dependent, then
so
If there are no external forces, then T is conserved, and
which is a generalization of Fermat's principle.