Einstein-Hilbert action and variational derivation of the Einstein equations
Anchor (Master): Sternberg, Curvature in Mathematics and Physics (2012), Ch. 12 (the variational derivation); Wald, General Relativity (1984), Appendix E; Hilbert 1915, Die Grundlagen der Physik
Intuition Beginner
Physics has a recurring trick. Instead of writing down the law of motion directly, you write down a single number for each possible history of a system -- its action -- and then declare that nature picks the history that makes this number as small (or as stationary) as possible. A ball thrown in the air, a ray of light bending through glass, a planet sweeping its orbit: all of them follow the path that makes the action stationary. The law of motion is what you get when you ask which path wins.
Einstein's field equations can be produced the same way. You write one number for each possible shape of spacetime. That number is the Einstein-Hilbert action: roughly, add up the curvature of spacetime everywhere, weighting each region by its proper volume. The shape of spacetime that makes this number stationary is exactly the shape that satisfies Einstein's equations. Matter enters through a second piece of the action that describes the energy it carries.
This is more than a tidy repackaging. Writing gravity as an action tells you the field equations almost uniquely. Once you decide the action depends only on the metric through its curvature, the requirement that the action be stationary forces a specific equation, and that equation is Einstein's. David Hilbert found this action in 1915, in the same weeks Einstein was finishing the equations by a different route.
Visual Beginner
The picture shows the core move. Among all conceivable spacetime shapes, each carries an action value. The physically real shape is the one where small changes leave the action unchanged to first order. Splitting the action into a curvature part and a matter part is what makes the curvature respond to the matter.
Worked example Beginner
Take a region of spacetime with no matter in it at all. The matter part of the action is then zero, so only the curvature part remains. The principle says: among all shapes for this empty region, pick the one whose total curvature is stationary.
What equation comes out? When there is no matter, the variational principle produces , where is the Einstein tensor that measures a contracted piece of the curvature. Taking the trace of this equation in four dimensions turns it into , the statement that the Ricci curvature vanishes.
Here is the takeaway worth holding onto. does not say the region is flat. The full curvature can be large -- this is exactly the spacetime outside the Sun, where light bends and orbits precess. The empty-space principle does not forbid curvature; it forbids only a particular averaged combination of it. The same action, with a matter piece added back in, gives the full Einstein equation , where the constant measures how strongly energy bends spacetime. Because is so small, it takes an enormous amount of energy to make even a little curvature.
Check your understanding Beginner
Formal definition Intermediate+
Fix an oriented four-dimensional manifold carrying a Lorentzian metric of signature , with Levi-Civita connection (the unique torsion-free metric-compatible connection), Riemann tensor , Ricci tensor , and scalar curvature . Write ; the invariant volume element is (the determinant is negative for Lorentzian signature, so ). The symbol denotes covariant differentiation; denotes a first-order variation in the field; is integration against .
The Einstein-Hilbert action is the functional on metrics
When matter is present one adds a matter action , a functional of the metric and the matter fields . The total action is [Sternberg Ch. 12]. The stress-energy tensor of the matter is defined by the metric-variation of :
A metric is a stationary point of if to first order for every smooth variation of compact support (or, on a manifold with boundary , for every variation vanishing together with appropriate boundary data on ).
Sign and convention notes
The signature is and the Riemann tensor follows the convention , with the Ricci tensor obtained by contracting the first and third indices. Different texts differ by overall signs in these definitions; the physical field equation is convention-independent once is fixed by the Newtonian limit. The variational derivative is the coefficient of in after every total-divergence term has been integrated away.
Counterexamples to common slips
- The action is a functional of the metric, not of a fixed background. The variation ranges over all symmetric tensor perturbations; one does not hold the volume element or the connection fixed while varying , since both depend on .
- The matter stress-energy defined by automatically agrees with the canonical (Noether) stress-energy only up to improvement terms. The metric (Hilbert) stress-energy is symmetric and gauge-invariant by construction; the canonical one need not be.
- Dropping the boundary term is legitimate only for variations of compact support. On a region with boundary, leaves a surface integral that must be cancelled by the Gibbons-Hawking-York term for the variational problem to be well-posed with Dirichlet data .
Key derivation Intermediate+
Theorem (Hilbert). Let on a four-dimensional Lorentzian manifold. A metric is a stationary point of under compactly supported variations if and only if
Proof. Write and vary the three metric-dependent factors , , and in turn.
Piece 1: the volume element. For any matrix with , Jacobi's formula gives , so . Hence , where the last step uses (differentiate ). Thus
Piece 2: the Ricci tensor (Palatini identity). The Christoffel symbols are not tensorial, but their variation is a tensor, being the difference of two connections. Varying and assembling the result covariantly yields the Palatini identity
The non-covariant and terms recombine into covariant derivatives of the tensor precisely because transforms as a -tensor. Contracting with and using metric compatibility to pass through the derivatives,
a total covariant divergence of the vector .
Piece 3: assembling and integrating. Since ,
Therefore
using Pieces 1 and 3. For a metric tensor, , so the last term is an ordinary divergence. By the divergence theorem it integrates to a boundary integral over , which vanishes because (and hence ) has compact support. Thus
Adding matter. By definition . Setting for all compactly supported , the fundamental lemma of the calculus of variations forces the integrand's coefficient to vanish pointwise:
which rearranges to . Conversely, if the field equation holds the integrand vanishes and .
Bridge. This derivation builds toward 13.05.01, where the vacuum equation obtained here is solved explicitly for the Schwarzschild geometry, and toward 13.08.01, where the same action with a cosmological-constant term governs the dynamics of the expanding universe. It appears again in 13.07.01, where the linearized action around flat space yields the wave equation for gravitational radiation, and in 13.06.03, where the on-shell value of the boundary-completed action computes black-hole entropy. The contracted Bianchi identity that makes the left side automatically divergence-free is the gravitational instance of the diffeomorphism-Noether identity of 05.05.08; this single structural fact is why the variational principle yields a consistent matter coupling at all, and it is the thread tying the geometry of the action to the conservation law it enforces.
Exercises Intermediate+
Lean formalization Intermediate+
The variational derivation rests on a tower of structures Mathlib does not yet provide, so this unit ships with lean_status: none. The tower is, from the bottom:
Lorentzian metrics. Mathlib has positive-definite Riemannian metrics on smooth manifolds but no indefinite pseudo-Riemannian metric as a first-class structure. The signature and the positivity of are needed even to state .
Levi-Civita connection and curvature. The torsion-free metric-compatible connection, the Riemann tensor, Ricci tensor, and scalar curvature. None are present as named objects.
Variational calculus on metrics. The functional lives on an infinite-dimensional space of metrics; its functional derivative requires either a formal variational-bicomplex apparatus or a concrete Gateaux-derivative formulation. Mathlib's coverage here is essentially absent.
A realistic first target is purely tensor-algebraic: given the curvature tensors as data, prove the contracted Bianchi identity as an identity in the connection. The three variational lemmas -- , the Palatini identity, and the integration-by-parts to the boundary term -- would follow once items 1-3 exist. The field equations themselves are then a definition (the stationarity condition of ) rather than a theorem.
Advanced results Master
The boundary term and a well-posed variational problem. The bulk variation produced the Einstein tensor cleanly only because the divergence was discarded. On a manifold with boundary this surface integral does not vanish: with Dirichlet data , the vector still contains normal derivatives of , so . The action alone therefore does not have a stationary point under fixed-boundary-metric variations. The cure, found by York and by Gibbons and Hawking, is the Gibbons-Hawking-York (GHY) boundary term
where is the induced metric on and is the trace of the extrinsic curvature of . The variation of exactly cancels the normal-derivative surface term from , so is stationary under with no constraint on normal derivatives. The boundary-completed action is also the object whose value, evaluated on a Euclidean black-hole solution, yields the free energy and entropy of the hole [Gibbons-Hawking 1977].
The cosmological constant. Replacing in the action adds the term under the integral and contributes to the field equation, giving . The vacuum solution of with maximal symmetry is de Sitter space for (and anti-de Sitter for ): a spacetime of constant curvature , with . The constant enters the action as the unique scalar of mass-dimension zero that can be added without introducing derivatives of the metric, which is why it is permitted on the same footing as .
Uniqueness — Lovelock's theorem. The Einstein-Hilbert choice for the gravitational Lagrangian is not arbitrary. Lovelock's theorem characterizes the admissible field equations among all local, divergence-free, second-order tensor equations.
Theorem (Lovelock 1971). In four spacetime dimensions, the most general symmetric -tensor that is (i) a concomitant of the metric and its first two derivatives, (ii) linear in the second derivatives of , and (iii) identically divergence-free, is for constants [Lovelock 1971].
The Einstein tensor plus a cosmological term is thus the only second-order divergence-free option in four dimensions; higher Lovelock invariants (the Gauss-Bonnet combination and beyond) are total derivatives in and contribute nothing to the equations of motion. They become dynamical only in . This is the variational counterpart of the uniqueness theorem proved component-wise in 13.04.01.
Diffeomorphism invariance and the on-shell Bianchi identity. The action is a scalar, hence invariant under the metric variation induced by any vector field . Applied to the bulk variation, this gauge invariance forces the Euler-Lagrange tensor to be divergence-free as an identity: holds for every metric, not only on solutions. This is the contracted second Bianchi identity, here arising as the Noether identity associated with the local diffeomorphism symmetry of the action -- precisely the gauge-theory phenomenon of 05.05.08.
Synthesis. The action principle reorganizes general relativity around a single functional and three computations. The variation of the volume element supplies the trace term; the Palatini identity reduces the curvature variation to a boundary contribution; and the matter action supplies, through a definition rather than a postulate, a stress-energy tensor that is symmetric, gauge-invariant, and conserved by construction. Uniqueness, via Lovelock, explains why the integrand had to be up to a constant in four dimensions, so the field equation is forced rather than chosen. Diffeomorphism invariance, via the Noether identity, explains why the left side is divergence-free and the matter coupling is consistent. The boundary term, via Gibbons-Hawking-York, makes the variational problem well-posed and simultaneously opens the door to black-hole thermodynamics. These four threads -- variation, uniqueness, gauge identity, and boundary -- are the structural content of the Einstein equations as a variational system, and together they convert a guessed field equation into a derived one.
Full proof set Master
Proposition (variation of the inverse metric and the determinant). Let be a smooth one-parameter family of non-degenerate metrics with . Then and .
Proof. From , varying gives ; contracting with isolates , the first claim. For the determinant, Jacobi's formula applied to gives , i.e. . Then , using for Lorentzian signature. Substituting from the first claim gives the final form.
Proposition (the Palatini boundary term is a pure divergence). Under a variation , the contribution to equals with , and reduces to a boundary integral.
Proof. By the Palatini identity (Exercise 6), . Contract with and use metric compatibility to move inside the covariant derivatives:
Relabel the second term's free index from to and the dummy accordingly so both terms are divergences with the same upper index: with . For any vector field on a metric manifold, , because is the standard formula for the covariant divergence. Hence by the divergence theorem. For compactly supported this vanishes; on a bounded region it is the surface term cancelled by the GHY term.
Proposition (de Sitter solves the -vacuum equations). A spacetime with satisfies in four dimensions.
Proof. From , trace with : . Then . Hence . The maximally symmetric metric with and is de Sitter space, of constant sectional curvature .
Connections Master
The vacuum equation obtained here by setting the matter action to zero is solved in 13.05.01 for the spherically symmetric Schwarzschild geometry; the variational route makes the vacuum condition a stationarity statement rather than a separate postulate.
The contracted Bianchi identity that guarantees the consistency of the matter coupling is the general-relativistic instance of Noether's second theorem for the diffeomorphism gauge group, developed in 05.05.08; the divergence-freedom of the Euler-Lagrange tensor is forced by local symmetry rather than computed by hand.
The boundary-completed action , evaluated on Euclidean black-hole backgrounds, computes the entropy and free energy studied in 13.06.03; the same boundary term that makes the Dirichlet variational problem well-posed is what gives black-hole thermodynamics its action-based footing.
The cosmological-constant term added to the action supplies the vacuum energy whose equation of state drives the accelerated expansion modeled by the Friedmann equations in 13.08.01.
The linearization of the Einstein-Hilbert action about flat space yields the quadratic action whose Euler-Lagrange equation is the gravitational-wave equation analyzed in 13.07.01.
Historical & philosophical context Master
David Hilbert presented the gravitational action and derived its field equations in a communication to the Göttingen Academy dated 20 November 1915, five days before Einstein's final field-equations paper to the Berlin Academy [Hilbert 1915]. Hilbert approached gravitation as one half of a unified variational theory of gravitation and electromagnetism, building on Mie's nonlinear electrodynamics, and took the scalar curvature as the gravitational Lagrangian on the grounds that it is the simplest diffeomorphism-invariant scalar built from the metric. Einstein reached the same equations by the physical requirements of general covariance and the Newtonian limit, without a variational principle [Einstein 1915]. The priority question has been examined repeatedly; the printer's proofs of Hilbert's paper show that his explicitly covariant field equations in the published form postdate Einstein's, while the action itself was Hilbert's. The standard modern attribution names the functional after both: the Einstein-Hilbert action.
The variational viewpoint matured into a structural statement with Lovelock's 1971 theorem, which showed that the Einstein tensor is forced in four dimensions by locality, second-order character, and the divergence identity [Lovelock 1971]. The boundary-term problem was resolved by York in 1972 and by Gibbons and Hawking in 1977, whose extrinsic-curvature term made the action a well-posed functional and, in the Euclidean continuation, a generating functional for black-hole thermodynamics [York 1972] [Gibbons-Hawking 1977]. Sternberg's account places the derivation within the broader geometry of invariant variational problems, treating the diffeomorphism-Noether identity as the organizing constraint [Sternberg Ch. 12].
Bibliography Master
@article{Hilbert1915,
author = {Hilbert, David},
title = {Die Grundlagen der Physik (Erste Mitteilung)},
journal = {Nachrichten von der K\"oniglichen Gesellschaft der Wissenschaften zu G\"ottingen, Mathematisch-Physikalische Klasse},
year = {1915},
pages = {395--407}
}
@article{Einstein1915,
author = {Einstein, Albert},
title = {Die Feldgleichungen der Gravitation},
journal = {Sitzungsberichte der Preussischen Akademie der Wissenschaften zu Berlin},
year = {1915},
pages = {844--847}
}
@article{Einstein1916,
author = {Einstein, Albert},
title = {Die Grundlage der allgemeinen Relativit\"atstheorie},
journal = {Annalen der Physik},
volume = {49},
year = {1916},
pages = {769--822}
}
@article{Lovelock1971,
author = {Lovelock, David},
title = {The Einstein Tensor and Its Generalizations},
journal = {Journal of Mathematical Physics},
volume = {12},
number = {3},
year = {1971},
pages = {498--501}
}
@article{York1972,
author = {York, James W.},
title = {Role of Conformal Three-Geometry in the Dynamics of Gravitation},
journal = {Physical Review Letters},
volume = {28},
number = {16},
year = {1972},
pages = {1082--1085}
}
@article{GibbonsHawking1977,
author = {Gibbons, G. W. and Hawking, S. W.},
title = {Action Integrals and Partition Functions in Quantum Gravity},
journal = {Physical Review D},
volume = {15},
number = {10},
year = {1977},
pages = {2752--2756}
}
@book{Wald1984,
author = {Wald, Robert M.},
title = {General Relativity},
publisher = {University of Chicago Press},
year = {1984}
}
@book{Sternberg2012,
author = {Sternberg, Shlomo},
title = {Curvature in Mathematics and Physics},
publisher = {Dover Publications},
year = {2012}
}