Solution (source code)

= Solution

Put $h_{ab}=\delta g_{ab}$, $h=g^{ab}h_{ab}$, and $h^{ab}=g^{ac}g^{bd}h_{cd}$. Throughout this part use the <Riemann curvature tensor> convention printed in the paper. Varying $g^{ac}g_{cb}=\delta^a{}_b$ gives the inverse-metric variation. The <determinant> identity $\delta\log|\det g|=g^{ab}h_{ab}$ gives the <volume form> variation. Together these are
$$
\boxed{\delta g^{ab}=-h^{ab},\qquad
\delta(d\operatorname{vol}_g)=\frac12h\,d\operatorname{vol}_g.}
$$
In Lorentzian coordinates the latter reads $\delta\sqrt{-g}=\frac12\sqrt{-g}\,h$.

For the connection, vary <metric compatibility> $\nabla_a g_{bc}=0$:
$$
\nabla_a h_{bc}=g_{dc}\delta\Gamma^d{}_{ab}+g_{bd}\delta\Gamma^d{}_{ac}.
$$
Add the equations with derivatives $a,b$, subtract that with derivative $c$, and use symmetry of the lower indices of the <Levi-Civita connection>. This gives
$$
\boxed{\delta\Gamma^c{}_{ab}=\frac12g^{cd}
(\nabla_a h_{bd}+\nabla_b h_{ad}-\nabla_d h_{ab}).}
$$
The difference of two connections is a tensor, so this formula is covariant.

Varying the coordinate curvature formula yields the <Palatini identity>
$$
\delta R_{ab}=\nabla_c\delta\Gamma^c{}_{ab}-\nabla_b\delta\Gamma^c{}_{ac}.
$$
The contractions of the connection variation are
$$
g^{ab}\delta\Gamma^c{}_{ab}=\nabla_a h^{ac}-\frac12\nabla^c h,\qquad
\delta\Gamma^c{}_{ac}=\frac12\nabla_a h.
$$
Finally, $\delta R=(\delta g^{ab})R_{ab}+g^{ab}\delta R_{ab}$ gives the <metric variation of scalar curvature>:
$$
\boxed{\delta R=-R^{ab}h_{ab}-\nabla^c\nabla_c h+\nabla^a\nabla^b h_{ab},
\qquad\alpha=-1,\quad\beta=1.}
$$
The double divergence may equivalently be written $\nabla_a\nabla_bh^{ab}$: relabeling the contracted dummy indices and using symmetry of $h^{ab}$ gives the same expression. The derivative terms are a <covariant divergence>, useful when varying a curvature-dependent action.