The Variational Formulation
The Einstein field equations were first obtained by demanding a divergence-free geometric tensor equal to the stress–energy tensor. They follow far more economically from a variational principle: extremizing a single scalar action. This is Hilbert's route (1915, essentially simultaneous with Einstein), and it is the modern foundation — it makes the conservation laws automatic via Noether's theorem, defines the stress–energy tensor unambiguously, exposes gravity's place among field theories (QFT), and is the starting point for both the canonical formulation and every attempt to quantize gravity.
We use , keep explicit, mostly-plus signature.
The Einstein–Hilbert action
The action must be a coordinate-invariant (scalar) integral over spacetime. With the invariant volume element , the simplest nontrivial scalar built from the metric is the Ricci scalar . The Einstein–Hilbert action is
and the total action adds a matter piece for whatever fields are present:
That is the unique choice (up to a constant and the cosmological term) among scalars giving second-order field equations is the variational face of Lovelock's theorem: higher curvature invariants (, ) would raise the derivative order.
Varying the metric: deriving the field equations
Treat the inverse metric as the dynamical field and demand under . Three ingredients:
- ;
- ;
- the second term is a total derivative, (the Palatini identity), integrating to a boundary term.
Setting aside the boundary term (see below), variation of gives
Defining the stress–energy tensor as the metric-response of the matter action (the Hilbert definition),
the condition for arbitrary yields exactly
Adding a constant to the Lagrangian, , reproduces the cosmological term . The variational route thus delivers the field equations and the correct, symmetric, generally-covariant source in one stroke.
The Gibbons–Hawking–York boundary term
The Palatini total-derivative term integrates to a boundary contribution that does not vanish for the natural boundary condition (fixing the metric, but not its normal derivative, on the boundary). Because contains second derivatives of the metric, a well-posed variational principle requires adding the Gibbons–Hawking–York (GHY) surface term:
with the trace of the extrinsic curvature of the boundary and its induced metric. The combination has a genuine extremum for fixed boundary metric. The GHY term is not a technicality: it is essential for
- a consistent canonical (ADM) formulation, where it supplies the correct Hamiltonian;
- the ADM mass and other quasi-local energies of asymptotically flat spacetimes;
- the Euclidean action whose saddle point yields the black-hole entropy — the GHY term contributes the entire finite result.
Diffeomorphism invariance and conservation
The action is invariant under coordinate changes (diffeomorphisms) — this is general covariance as a symmetry of . By Noether's second theorem, a local (gauge) symmetry implies an identity among the field equations, not merely a conserved current. For gravity, diffeomorphism invariance of forces
identically — whenever the matter fields obey their own equations of motion. So local energy–momentum conservation is a consequence of general covariance, mirroring the geometric side, where the same conservation follows from the contracted Bianchi identity . The two derivations — Noether on the matter action, Bianchi on the geometry — are the two faces of the same fact, and their consistency is what makes the coupled Einstein–matter system well-defined.
Metric vs. Palatini variation
There are two inequivalent-looking ways to vary the action:
- Metric (second-order) formalism. The connection is fixed to be Levi-Civita, so and is the only variable — the derivation above.
- Palatini (first-order) formalism. Treat the metric and the connection as independent fields. Varying then derives metric compatibility — the connection equation of motion forces to be Levi-Civita — while varying gives the Einstein equations.
For pure Einstein–Hilbert gravity the two agree. They diverge for modified actions (e.g. gravity) or when matter couples to the connection (fermions via the tetrad/spin-connection), where Palatini can generate torsion. The first-order (Palatini/tetrad) formulation is also the natural starting point for loop quantum gravity and for coupling spinors to gravity, since Dirac fields require a tetrad rather than a metric.
Summary
- The field equations follow from extremizing the Einstein–Hilbert action plus matter; is the unique scalar giving second-order equations (Lovelock).
- Varying gives , with ; adds the cosmological term.
- A well-posed variation requires the Gibbons–Hawking–York boundary term, essential for the Hamiltonian, ADM mass, and black-hole entropy.
- Diffeomorphism invariance ⇒ (Noether's 2nd theorem) , the matter-side mirror of the Bianchi identity.
- Metric and Palatini variations agree for pure GR but differ for modified/spinor theories; the first-order form underlies loop quantum gravity.
Next
The action is covariant but hides the dynamics — how a spacetime evolves from initial data. Splitting spacetime into space + time gives the 3+1 / ADM formulation, the Hamiltonian of gravity, the constraint structure, and the initial-value problem behind numerical relativity.