The geodesics for a
sub-Riemannian metric on a three-dimensional contact manifold M form
a 1-parameter family of curves along each contact direction. However, a
collection of such contact curves on M, locally equivalent to the solutions of a
fourth-order ODE, are the geodesics of a sub-Riemannian metric only if a
sequence of invariants vanish. The first of these, which was first identified
by Fels, determines if the differential equation is variational. The next two
determine if there is a well-defined metric on M and if the given paths are its
geodesics.