Some Applications of the Calculus of Variations to Riemannian Geometry