For , the Ricci scalar varies as
The last two terms form a covariant divergence and hence contribute only a boundary term to a compactly supported variation of the Einstein-Hilbert action.