  This work is concerned with an optimal control problem on a Riemannian
manifold, for which two typical cases are considered. The first case is when
the endpoint is free. For this case, the control set is assumed to be a
separable metric space. By introducing suitable dual equations, which depend on
the curvature tensor of the manifold, we establish the second order necessary
and sufficient optimality conditions of integral form. In particular, when the
control set is a Polish space, the second order necessary condition is reduced
to a pointwise form. As a key preliminary result and also an interesting
byproduct, we derive a geometric lemma, which may have some independent
interest. The second case is when the endpoint is fixed. For this more
difficult case, the control set is assumed to be open in an Euclidian space. We
obtain the second order necessary and sufficient optimality conditions, in
which the curvature tensor also appears explicitly. Our optimality conditions
can be used to recover the following famous geometry result: Any geodesic
connecting two fixed points on a Riemannian manifold satisfies the second
variation of energy; while the existing optimality conditions in control
literatures fail to give the same result.
