It is well-known that the Gauss-Bonnet term $$\mathcal L_G =R^2 -4 R_{\mu\nu}R^{\mu\nu}+R_{\mu\nu\rho\sigma}R^{\mu\nu\rho\sigma}\tag 1$$ does not contribute to the equations of motion when adding it to the four-dimensional Einstein–Hilbert action. But how can one show that this term is indeed a total derivative in four dimensions?
2 Answers
The bulk of this post is correct for positive definite metrics, but the Lorentzian case is more subtle than I thought. See remarks at the end of the answer.
What I find odd is that nobody has mentioned that this term is not a total derivative in general.
First of all, the explicit form of the Lagrangian and the fact that in four dimensions its Euler--Lagrange equations are trivial is independent of the signature. So let $M=S^4$ be the four dimensional sphere with its standard (positive definite) metric. This is a compact, constant curvature space without boundary and with positive curvature, and the Riemann tensor can be written as $$ R_{ijkl}=K(g_{ik}g_{jl}-g_{il}g_{jk}). $$ From this the (scalarized) Lagrangian can be computed to be $$ \mathcal G=24K^2, $$ which is a positive constant. Here $\mathcal G = R^2-4 R_{ij}R^{ij}+R_{ijkl}R^{ijkl}$. So the integral $$ \int_{S^4}\mathcal G\mu_g=24K^2\mathrm{Vol}(S^4)>0 $$ is positive. However if the Gauss--Bonnet term were a total divergence, then this would reduce to a boundary integral and as $\partial S^4=\varnothing$, it would vanish.
So this Lagrangian cannot be a total derivative.
To explain what's going underneath the surface, let $\pi:\mathrm{Met}_0(M)\rightarrow M$ be the bundle of smooth Riemannian metrics over $M$ (in the notation, "0" stands for the index i.e. the maximum dimension of the negative definite subspace, which is zero here as we are considering positive definite metrics), $J^\infty(\pi)$ its infinite jet bundle and $(\Omega^{\bullet,\bullet},\delta,\overline{d})$ the variational bicomplex.
Write also $\overline{\Omega^k}:=\Omega^{0,k}$ for the horizontal $k$-forms. Then if $\dim M=m$, $\overline{\Omega^m}$ is the space of all smooth Lagrangians for Riemannian metrics. From the variational bicomplex one constructs the variational complex $$ 0\longrightarrow\overline{\Omega^0}\longrightarrow\cdots\longrightarrow\overline{\Omega^m}\longrightarrow\Phi^1\longrightarrow\Phi^2\longrightarrow\cdots, $$ where the $\Phi^k\cong\Omega^{k,m}/\overline{d}\Omega^{k,m-1}$ are the so called "functional forms" in Anderson's terminology, and the differential $E:\overline{\Omega^m}\longrightarrow\Phi^1$ is the Euler--Lagrange operator.
If $L\in\overline{\Omega^4}$ is the GB Lagrangian for $m=4$, then $E(L)=0$, so it represents a horizontal cohomology class in $\overline{H^4}(\pi)=\overline{\Omega^4}/\overline{d\Omega^{3}}$. By the preceding argument, this is a nontrivial cohomology class. It also follows from basic spectral sequence arguments applied to the bicomplex (see the referenced text) that generally $$ \overline{H^k}(\pi)\cong H^k(N), $$ where the latter is de Rham cohomology and $N$ is the total space of the fibration, in this case $N=\mathrm{Met}_0(M)$.
However if $g_0\in\Gamma(\pi)$ is a fixed smooth metric, the map $\Theta:I\times\mathrm{Met}_0(M)\rightarrow \mathrm{Met}_0(M)$ (where $I=[0,1]$) given by $$ \Theta(t,g)=tg+(1-t)g_0(\pi(g)) $$ is a deformation retraction from $\mathrm{Met}_0(M)$ to $g_0(M)\cong M$, so $\pi$ is a homotopy equivalence, and hence $H^k(\mathrm{Met}_0(M))\cong H^k(M)$.
So $L$ represents actually a possibly nontrivial de Rham cohomology class in $H^4(M)$, which was proven to be nontrivial when $M=S^4$ and in fact using a global homotopy operator constructed from $\Theta$ (similarly to the so-called "vertical homotopy operator" in Anderson's text) it may be shown that if $g_0$ is your favourite metric, the ordinary $4$-form $L(g_0)\in\Omega^4(M)$ represents this cohomology class.
Of course the question concerns Lorentzian metrics and I am not quite sure that $\mathrm{Met}_1(M)\rightarrow M$ is also a homotopy equivalence (the same argument fails for indefinite metrics).
Added later:
The indefinite case appears to be subtle, and some info can be found in Gilkey, Park: Analytic continuation, the Chern-Gauss-Bonnet theorem and the Euler-Lagrange equations in Lovelock theory for indefinite signature metrics, but this paper concerns itself with the CGB theorem relating this integral to the Euler characteristic, which does not completely cover the situation, does not apply to non-compact spaces, and when the index of the metric is odd (which is always the case for Lorentzian metrics), it is trivial anyways.
However it does appear that the GB Lagrangian is exact for the majority of "physically interesting" spacetimes. If $M$ is globally hyperbolic and orientable, then $M\cong\mathbb R\times\Sigma$, where $\Sigma$ is an orientable $3$-manifold. It is also known that every orientable 3-manifold is parallelizable.
So every spacetime $M$ that satisfies the hypotheses above is parallelizable and has a global orthonormal frame. There is the paper https://arxiv.org/abs/1008.5154 by Padmanabhan and Yale linked in the comments where they derive that the Lagrangian is exact in terms of orthonormal frames (Eq. 15, I did not double-check this). In more general circumstances this does not comprise a proof about the global exactness of the GB Lagrangian because orthonormal frames need not exist globally. However in a globally hyperbolic, orientable spacetime, there is a global orthonormal frame, and hence the GB Lagrangian is indeed exact.
- 11,869
The idea is easier to understand when working with 'pure' differential forms, or what is often referred to as the Einstein-Cartan formalism. The Gauss-Bonnet term in this language can be written as \begin{equation} \text{Tr}\big(\mathcal{R} \wedge \star \mathcal{R}), \end{equation} where $\mathcal{R}$ is the curvature 2-form and $\star$ is the Hodge dual of differential forms. The Gauss-Bonnet theorem states that the integral over this 4-form is the Euler characteristic of the manifold \begin{equation} \chi(M) = \frac{1}{16\pi^2}\int \text{Tr}\big(\mathcal{R} \wedge \star \mathcal{R}), \end{equation} which is a topological invariant. Since the term is topological, it cannot effect the equations of motion. More specifically, its variation vanishes identically as a consequence of the Bianchi identity.
- 659