The Einstein–Hilbert action (also referred to as Hilbert action) in general relativity is the action that yields the Einstein field equations through the stationary-action principle. With the metric signature, the gravitational part of the action is given as where is the determinant of the metric tensor matrix, is the Ricci scalar, and is the Einstein gravitational constant ( is the gravitational constant and is the speed of light in vacuum). If it converges, the integral is taken over the whole spacetime. If it does not converge, is no longer well-defined, but a modified definition where one integrates over arbitrarily large, relatively compact domains, still yields the Einstein equation as the Euler–Lagrange equation of the Einstein–Hilbert action. The action was first proposed by David Hilbert in 1915. Discussion Deriving equations of motion from an action has several advantages. First, it allows for easy unification of general relativity with other classical field theories (such as Maxwell theory), which are also formulated in terms of an action. In the process, the derivation identifies a natural candidate for the source term coupling the metric to matter fields. Moreover, symmetries of the action allow for easy identification of conserved quantities through Noether's theorem. In general relativity, the action is usually assumed to be a functional of the metric (and matter fields), and the connection is given by the Levi-Civita connection. The Palatini formulation of general relativity assumes the metric and connection to be independent, and varies with respect to both independently, which makes it possible to include fermionic matter fields with non-integer spin. The Einstein equations in the presence of matter are given by adding the matter action to the Einstein–Hilbert action. Derivation of Einstein field equations Suppose that the full action of the theory is given by the Einstein–Hilbert term plus a term describing any matter fields appearing in the theory. The stationary-action principle then tells us that to recover a physical law, we must demand that the variation of this action with respect to the inverse metric be zero, yielding . Since this equation should hold for any variation , it implies that is the equation of motion for the metric field. The right hand side of this equation is (by definition) proportional to the stress–energy tensor, . To calculate the left hand side of the equation we need the variations of the Ricci scalar and the determinant of the metric. These can