Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2021/iii/paper-309/4/a/ii/solution

Varying the coordinate expression for the curvature and replacing partial derivatives by covariant ones gives
Therefore
where
This is the metric variation of scalar curvature; its divergence contributes only a boundary term to the variation of the Einstein-Hilbert action.

New to topics? Read the docs here!