Variation of Pontryagin density $*R^{abcd}R_{abcd}$ with inverse metric $g^{ab}$ I'am computing the variation of
$$\int *R^{abcd}R_{abcd} \sqrt{-g}\,d^4x$$
with $g^{ab}$ and find it is difficult. Is this a known result?
$$*R^{abcd}=\frac{1}{2\sqrt{-g}}\epsilon^{abij}R_{ij}{}^{cd}$$
is the dual of Riemann tensor $R^{abcd}$.
 A: The Pontryagin Lagrangian:
$$\int *R^{abcd}R_{abcd} \sqrt{-g}\,d^4x$$
is invariant against variation of metric. That is exactly why it's called a topological term.
As you can easily see, the
$$\sqrt{-g}$$
in the Lagrangian is canceled out by the
$$\frac{1}{\sqrt{-g}}$$
in the Hodge dual
$$*R^{abcd}=\frac{1}{2\sqrt{-g}}\epsilon^{abij}R_{ij}{}^{cd}$$
therefore the Pontryagin Lagrangian is metric $g$ independent.
A: EDIT: I'm not quite so sure about any usefulness of this answer right now. I was not really familiar with the Pontryagin classes and all that stuff, so I attempted to vary the functional by hand. Perhaps it really does lead to 0, but I haven't finished the calculation yet.
I will not be writing the full expression at the end, but I will provide all the building blocks so that you can write everything everything in terms of the functional derivative of the action
$$ S = \int_{\mathcal{M}} \star R^{abcd}R_{abcd}\sqrt{-\det g}\; d^{4}x $$
$$ \frac{\delta S}{\delta g^{-1}} = \int_{\mathcal{M}} \delta_{g^{-1}}\Big{[}\star R^{abcd}R_{abcd}\sqrt{-\det g}\Big{]}d^{4}x $$
The expression $\star R^{abcd}R_{abcd}\sqrt{-\det g}\;$ is a scalar density, and thus, $\delta_{g^{-1}}\Big{[} \star R^{abcd}R_{abcd}\sqrt{-\det g}\Big{]}$ has to be one as well.
The variational derivative $\delta$ shares the properties of regular derivatives, i.e. it satisfies the product rule; we'll have to calculate the three individual terms therein, but specifically the only effort lies in varying the Riemann tensor $R^{a}_{bcd}$ and the metric  determinant $\det g$.
\begin{align}
\delta_{g^{-1}}\Big{[} \star R^{abcd}R_{abcd}\sqrt{-\det g}\Big{]} &=(\delta_{g^{-1}}\star R)^{abcd}R_{abcd}\sqrt{-\det g}\\
& +\star R^{abcd}(\delta_{g^{-1}}R)_{abcd}\sqrt{-\det g} \\
& +\star R^{abcd}R_{abcd}\delta_{g^{-1}}(\sqrt{-\det g})
\end{align}
Let us start from the variation of the Riemann tensor. For brevity I'll omit the subscript $g^{-1}$ from the $\delta$, with the understanding that until some points the variation is agnostic with respect to what underlying field we're varying, but also that at the end I'll express the scalar density integrand as $\delta_{g^{-1}} I = \frac{\delta I}{\delta g^{ab}}\delta g^{ab}$.
If mathematical rigour is required, taking the field-agnostic variation of a parametrized field $\Psi_{t}$ in a formal way is expressed as:
$$ \delta_{t} \Psi[t] = \frac{d}{dt}\vert_{t=0}\Psi[t]  $$
The variation of a field wrt. another field is inferred from generalizing the composite function differentation rule, as well as from multivariable calculus (full derivative of an object with respect to all of its dependencies, here - metric components as functions):
$$ \delta_{t} \Psi[g^{-1}(t)] = \frac{d}{dt}\vert_{t=0}\Psi[g^{-1}(t)] 
= \frac{\delta \Psi}{\delta g^{-1}} \cdot\frac{d}{dt} \vert_{t=0}g^{-1}(t)$$
with suitable contraction understood.
Let us start from the Riemann tensor variation.
$$R^{a}_{bcd} = \partial_{c}\Gamma^{a}_{bd} - \partial_{d}\Gamma^{a}_{cd} + \Gamma^{a}_{cm}\Gamma^{m}_{bd} - \Gamma^{a}_{dm}\Gamma^{m}_{bc}   $$
$$
(\delta R)^{a}_{bcd} = \delta(\partial_{c}\Gamma^{a}_{bd}) - \delta(\partial_{d}\Gamma^{a}_{cd}) + \delta\Gamma^{a}_{cm}\Gamma^{m}_{bd} +\Gamma^{a}_{cm}\delta\Gamma^{m}_{bd} - \delta\Gamma^{a}_{dm}\Gamma^{m}_{bc}  - \Gamma^{a}_{dm}\delta\Gamma^{m}_{bc}
\tag{1}\label{eq1}
$$
Coordinate vector field derivative commutes with the variational derivative, therefore:
$$ \delta(\partial_{c}\Gamma^{a}_{bd}) = \partial_{c}(\delta\Gamma^{a}_{bd})$$
$\delta\Gamma^{a}_{bd}$ is an infinitesimal difference between two Christoffel symbols, and therefore is a tensor field (known GR fact).
This means that we can act with a covariant derivative on it:
$$ \nabla_{c}(\delta\Gamma^{a}_{bd}) =  \partial_{c}(\delta\Gamma^{a}_{bd})  + \delta\Gamma^{m}_{bd}\Gamma^{a}_{cm} - \delta\Gamma^{a}_{md}\Gamma^{m}_{bc} - \delta\Gamma^{a}_{bm}\Gamma^{m}_{dc} $$
If we take the expression of $\partial_{c}(\delta\Gamma^{a}_{bd})$ from the above relation, and plug it into \eqref{eq1}.
This will make all the $\delta\Gamma \; \Gamma$ contractions cancel out (careful with the indices!).
We'll be left with:
$$(\delta R)^{a}_{bcd} = \nabla_{c}(\delta\Gamma^{a}_{bd}) - \nabla_{d}(\delta\Gamma^{a}_{cd})$$
If we want to express this in terms of $\frac{(\delta R)^{a}_{bcd}}{\delta g^{mn}} \delta g^{mn}$, we write out the Christoffel symbol and its variation:
$$\Gamma^{a}_{bc}=\frac{1}{2}g^{am}\Big{[} g_{bm,c} + g_{cm,b} - g_{bc,m}\Big{]} $$
$$\delta\Gamma^{a}_{bc}=\frac{1}{2}\delta g^{am}\Big{[} g_{bm,c} + g_{cm,b} - g_{bc,m}\Big{]} + \frac{1}{2}g^{am}\Big{[} \delta g_{bm,c} + \delta g_{cm,b} - \delta g_{bc,m}\Big{]} $$
To express the variation of the lower-index metric through the upper index one, we use:
$$ \delta (g_{ab}g^{bc}) = \delta(\delta^{c}_{a}) = 0 $$
and on the other hand:
$$ \delta (g_{ab}g^{bc}) =  \delta g_{ab}\;g^{bc} +  g_{ab}\; \delta g^{bc}  = 0 $$
Therefore,if we contract the above with $g_{cd}$ and change the indices, we find that whenever the $\delta$ hits the metric $g_{ab}$, we can trade it via:
$$\delta g_{ab} = g_{am}g_{bn}\delta g^{mn}$$
Mind you that the $\delta g_{ab}$ parts will then be covariantly differentiated. Before we get the expression for the functional derivative, we'll need to integrate by parts to push the $\nabla$ onto the other terms in the integrand.
Now, onto the other terms.
The functional derivative of the metric determinant is derived by using the Jacobi formula:
$$ \frac{d \det(A)}{dt} = \rm tr \Big{[} adj(A) \times \frac{dA}{dt}  \Big{]} = \rm tr \Big{[} \det(A) \cdot (A^{-1})^{T} \times \frac{dA}{dt}  \Big{]}$$
or to see the parallel more easily:
$$ d \det(A) = \rm tr \Big{[} adj(A) \times dA  \Big{]} = \rm tr \Big{[} \det(A) \cdot (A^{-1})^{T} \times dA  \Big{]}$$
In terms of the metric determinant variation wrt. the upper-indices metric:
$$ \delta_{g^{-1}} \det g = \frac{\delta \det g}{\delta g^{ab}}\delta g_{ab} = \det g \; g_{ab} \; \delta g^{ab}$$
The inverse of the square root of the determinant, by using the result above and the chain rule:
$$ \delta_{g^{-1}} (-\det g)^{-\frac{1}{2}}  = -\frac{1}{2} (-\det g)^{-\frac{3}{2}}\cdot (\delta_{g^{-1}}(-\det g)) = \frac{1}{2} (-\det g)^{-\frac{1}{2}}g_{ab} \; \delta g^{ab} $$.
The previous-to-last ingredient is in treating the contractions of the Riemann tensor with some metric components:
$$ \delta_{g^{-1}}(R_{ij}^{\;\; cd}) = \delta_{g^{-1}}(R^{m}_{\;\;jkl}g^{kc}g^{ld}g_{mi})  $$
This has to be expanded per the product rule appropriately.
Finally, the Levi-Civita symbol with all indices downstairs (I mean the pseudo-tensor density, with the opposite density weight to that of $\sqrt{-\det g}$),  $\epsilon_{abcd}$, is independent of the metric (its components in each coordinate system are equal to $+1$, $0$ or $-1$ per usual). Therefore its variation wrt. to $g^{-1}$ is 0. However, if we want to vary its version with the upper indices, we'll need to take into account the metric tensor with upper indices that it's contracted with.
