We figure out the explicit expression for the trace of the field equations associated to generic higher derivative theories of gravity endowed with Lagrangians depending upon the metric and its Riemann tensor, together with arbitrary order covariant derivatives of the Riemann tensor. Then an equality linking the Lagrangian density with the covariant divergence of a vector field is put forward in terms of the trace of the field equations. As a significant application, we particularly concentrate on a broad range of higher derivative theories of gravity with the Lagrangian density constructed from the contraction of the product for metric tensors with the product of the Riemann tensors and the arbitrary order covariant derivatives of the Riemann tensor. By utilizing the trace for the equations of motion, such a type of Lagrangian density is expressed as the covariant divergence of a vector field.
Peng et al. (Fri,) studied this question.