Under what conditions can the metric tensor be integrated to a global metric function? i.e., a function g(x,y) that gives the distance along a geodesic between x and y? For example, we can do this on the sphere using spherical trigonometry (cf. http://en.wikipedia.org/wiki/Spherical_law_of_cosines). It looks like we can also do this on a surface of constant negative curvature. Some obvious conditions are that a geodesic must exist between all pairs (x,y), and it must be unique (possibly with some restriction such as the spherical example above). These conditions are necessary, but are they sufficient?