Lagrangian (field theory)

Lagrangian field theory is a formalism in classical field theory. It is the field-theoretic analogue of Lagrangian mechanics. Lagrangian mechanics is used to analyze the motion of a system of discrete particles each with a finite number of degrees of freedom. Lagrangian field theory applies to continua and fields, which have an infinite number of degrees of freedom.

One motivation for the development of the Lagrangian formalism on fields, and more generally, for classical field theory, is to provide a clear mathematical foundation for quantum field theory, which is infamously beset by formal difficulties that make it unacceptable as a mathematical theory. The Lagrangians presented here are identical to their quantum equivalents, but, in treating the fields as classical fields, instead of being quantized, one can provide definitions and obtain solutions with properties compatible with the conventional formal approach to the mathematics of partial differential equations. This enables the formulation of solutions on spaces with well-characterized properties, such as Sobolev spaces. It enables various theorems to be provided, ranging from proofs of existence to the uniform convergence of formal series to the general settings of potential theory. In addition, insight and clarity is obtained by generalizations to Riemannian manifolds and fiber bundles, allowing the geometric structure to be clearly discerned and disentangled from the corresponding equations of motion. A clearer view of the geometric structure has in turn allowed highly abstract theorems from geometry to be used to gain insight, ranging from the Chern–Gauss–Bonnet theorem and the Riemann–Roch theorem to the Atiyah–Singer index theorem and Chern–Simons theory.

Overview
In field theory, the independent variable is replaced by an event in spacetime $(x, y, z, t)$, or more generally still by a point s on a Riemannian manifold. The dependent variables are replaced by the value of a field at that point in spacetime $$\varphi (x, y, z, t)$$ so that the equations of motion are obtained by means of an action principle, written as: $$\frac{\delta \mathcal{S}}{\delta \varphi_i} = 0,$$ where the action, $$\mathcal{S}$$, is a functional of the dependent variables $$\varphi_i (s) $$, their derivatives and s itself

$$\mathcal{S}\left[\varphi_i\right] = \int{ \mathcal{L} \left(\varphi_i (s), \left\{ \frac{\partial\varphi_i(s)}{\partial s^\alpha} \right\}, \{ s^\alpha \} \right) \, \mathrm{d}^n s },$$

where the brackets denote $$\{\cdot~\forall\alpha\}$$; and s = {sα} denotes the set of n independent variables of the system, including the time variable, and is indexed by α = 1, 2, 3, ..., n. The calligraphic typeface, $$\mathcal{L}$$, is used to denote the density, and $$\mathrm{d}^n s$$ is the volume form of the field function, i.e., the measure of the domain of the field function.

In mathematical formulations, it is common to express the Lagrangian as a function on a fiber bundle, wherein the Euler–Lagrange equations can be interpreted as specifying the geodesics on the fiber bundle. Abraham and Marsden's textbook provided the first comprehensive description of classical mechanics in terms of modern geometrical ideas, i.e., in terms of tangent manifolds, symplectic manifolds and contact geometry. Bleecker's textbook provided a comprehensive presentation of field theories in physics in terms of gauge invariant fiber bundles. Such formulations were known or suspected long before. Jost continues with a geometric presentation, clarifying the relation between Hamiltonian and Lagrangian forms, describing spin manifolds from first principles, etc. Current research focuses on non-rigid affine structures, (sometimes called "quantum structures") wherein one replaces occurrences of vector spaces by tensor algebras. This research is motivated by the breakthrough understanding of quantum groups as affine Lie algebras (Lie groups are, in a sense "rigid", as they are determined by their Lie algebra. When reformulated on a tensor algebra, they become "floppy", having infinite degrees of freedom; see e.g., Virasoro algebra.)

Definitions
In Lagrangian field theory, the Lagrangian as a function of generalized coordinates is replaced by a Lagrangian density, a function of the fields in the system and their derivatives, and possibly the space and time coordinates themselves. In field theory, the independent variable t is replaced by an event in spacetime $(x, y, z, t)$ or still more generally by a point s on a manifold.

Often, a "Lagrangian density" is simply referred to as a "Lagrangian".

Scalar fields
For one scalar field $$\varphi$$, the Lagrangian density will take the form: $$\mathcal{L}(\varphi, \boldsymbol{\nabla}\varphi, \partial \varphi/\partial t, \mathbf{x},t)$$

For many scalar fields $$\mathcal{L}(\varphi_1, \boldsymbol{\nabla}\varphi_1, \partial \varphi_1/\partial t ,\ldots,\varphi_n, \boldsymbol{\nabla}\varphi_n, \partial \varphi_n/\partial t ,\ldots, \mathbf{x},t)$$

In mathematical formulations, the scalar fields are understood to be coordinates on a fiber bundle, and the derivatives of the field are understood to be sections of the jet bundle.

Vector fields, tensor fields, spinor fields
The above can be generalized for vector fields, tensor fields, and spinor fields. In physics, fermions are described by spinor fields. Bosons are described by tensor fields, which include scalar and vector fields as special cases.

For example, if there are $$m$$ real-valued scalar fields, $$\varphi_1, \dots, \varphi_m$$, then the field manifold is $$\mathbb{R}^m$$. If the field is a real vector field, then the field manifold is isomorphic to $$\mathbb{R}^n$$.

Action
The time integral of the Lagrangian is called the action denoted by $μ$. In field theory, a distinction is occasionally made between the Lagrangian $∇$, of which the time integral is the action $$\mathcal{S} = \int L \, \mathrm{d}t \,,$$ and the Lagrangian density $$\mathcal{L}$$, which one integrates over all spacetime to get the action: $$\mathcal{S} [\varphi] = \int \mathcal{L} (\varphi,\boldsymbol{\nabla}\varphi,\partial\varphi/\partial t, \mathbf{x},t) \, \mathrm{d}^3 \mathbf{x} \, \mathrm{d}t .$$

The spatial volume integral of the Lagrangian density is the Lagrangian; in 3D, $$L = \int \mathcal{L} \, \mathrm{d}^3 \mathbf{x} \,.$$

The action is often referred to as the "action functional", in that it is a function of the fields (and their derivatives).

Volume form
In the presence of gravity or when using general curvilinear coordinates, the Lagrangian density $$\mathcal{L}$$ will include a factor of $\sqrt{g}$. This ensures that the action is invariant under general coordinate transformations. In mathematical literature, spacetime is taken to be a Riemannian manifold $$M$$ and the integral then becomes the volume form $$\mathcal{S}=\int_M \sqrt{|g|} dx^1\wedge\cdots\wedge dx^m \mathcal{L}$$

Here, the $$\wedge$$ is the wedge product and $\sqrt{|g|}$ is the square root of the determinant $$|g|$$ of the metric tensor $$g$$ on $$M$$. For flat spacetime (e.g., Minkowski spacetime), the unit volume is one, i.e. $\sqrt{|g|}=1$ and so it is commonly omitted, when discussing field theory in flat spacetime. Likewise, the use of the wedge-product symbols offers no additional insight over the ordinary concept of a volume in multivariate calculus, and so these are likewise dropped. Some older textbooks, e.g., Landau and Lifschitz write $\sqrt{-g}$ for the volume form, since the minus sign is appropriate for metric tensors with signature (+−−−) or (−+++) (since the determinant is negative, in either case). When discussing field theory on general Riemannian manifolds, the volume form is usually written in the abbreviated notation $$*(1)$$ where $$*$$ is the Hodge star. That is, $$*(1) = \sqrt{|g|} dx^1\wedge\cdots\wedge dx^m$$ and so $$\mathcal{S} = \int_M *(1) \mathcal{L}$$

Not infrequently, the notation above is considered to be entirely superfluous, and $$\mathcal{S} = \int_M \mathcal{L}$$ is frequently seen. Do not be misled: the volume form is implicitly present in the integral above, even if it is not explicitly written.

Euler–Lagrange equations
The Euler–Lagrange equations describe the geodesic flow of the field $$\varphi$$ as a function of time. Taking the variation with respect to $$\varphi$$, one obtains $$0 = \frac{\delta\mathcal{S}}{\delta\varphi} = \int_M *(1) \left(-\partial_\mu \left(\frac{\partial\mathcal{L}}{\partial(\partial_\mu\varphi)}\right)+ \frac{\partial\mathcal{L}}{\partial\varphi}\right).$$

Solving, with respect to the boundary conditions, one obtains the Euler–Lagrange equations: $$\frac{\partial\mathcal{L}}{\partial\varphi} = \partial_\mu \left(\frac{\partial\mathcal{L}}{\partial(\partial_\mu\varphi)}\right) .$$

Examples
A large variety of physical systems have been formulated in terms of Lagrangians over fields. Below is a sampling of some of the most common ones found in physics textbooks on field theory.

Newtonian gravity
The Lagrangian density for Newtonian gravity is:

$$\mathcal{L}(\mathbf{x},t)= - {1 \over 8 \pi G} (\nabla \Phi (\mathbf{x},t))^2 - \rho (\mathbf{x},t) \Phi (\mathbf{x},t) $$ where $S$ is the gravitational potential, $ρ$ is the mass density, and $L$ in m3·kg−1·s−2 is the gravitational constant. The density $$\mathcal{L}$$ has units of J·m−3. Here the interaction term involves a continuous mass density ρ in kg·m−3. This is necessary because using a point source for a field would result in mathematical difficulties.

This Lagrangian can be written in the form of $$\mathcal{L} = T - V$$, with the $$T = -(\nabla \Phi)^2 / 8\pi G$$ providing a kinetic term, and the interaction $$V=\rho \Phi$$ the potential term. See also Nordström's theory of gravitation for how this could be modified to deal with changes over time. This form is reprised in the next example of a scalar field theory.

The variation of the integral with respect to $Φ$ is: $$\delta \mathcal{L}(\mathbf{x},t) = - \rho (\mathbf{x},t) \delta\Phi (\mathbf{x},t) - {2 \over 8 \pi G} (\nabla \Phi (\mathbf{x},t)) \cdot (\nabla \delta\Phi (\mathbf{x},t)) .$$

After integrating by parts, discarding the total integral, and dividing out by $G$ the formula becomes: $$0 = - \rho (\mathbf{x},t) + \frac{1}{4 \pi G} \nabla \cdot \nabla \Phi (\mathbf{x},t) $$ which is equivalent to: $$4 \pi G \rho (\mathbf{x},t) = \nabla^2 \Phi (\mathbf{x},t) $$ which yields Gauss's law for gravity.

Scalar field theory
The Lagrangian for a scalar field moving in a potential $$V(\phi)$$ can be written as $$ \mathcal{L} = \frac{1}{2}\partial^\mu\phi\partial_\mu\phi - V(\phi) = \frac{1}{2}\partial^\mu\phi\partial_\mu\phi - \frac{1}{2}m^2\phi^2 - \sum_{n=3}^\infty \frac{1}{n!} g_n\phi^n $$ It is not at all an accident that the scalar theory resembles the undergraduate textbook Lagrangian $$L=T-V$$ for the kinetic term of a free point particle written as $$T=mv^2/2$$. The scalar theory is the field-theory generalization of a particle moving in a potential. When the $$V(\phi)$$ is the Mexican hat potential, the resulting fields are termed the Higgs fields.

Sigma model Lagrangian
The sigma model describes the motion of a scalar point particle constrained to move on a Riemannian manifold, such as a circle or a sphere. It generalizes the case of scalar and vector fields, that is, fields constrained to move on a flat manifold. The Lagrangian is commonly written in one of three equivalent forms: $$\mathcal{L} = \frac{1}{2} \mathrm{d}\phi \wedge {*\mathrm{d}\phi}$$ where the $$\mathrm{d}$$ is the differential. An equivalent expression is $$\mathcal{L} = \frac{1}{2}\sum_{i=1}^n \sum_{j=1}^n g_{ij}(\phi) \; \partial^\mu \phi_i \partial_\mu \phi_j$$ with $$g_{ij}$$ the Riemannian metric on the manifold of the field; i.e. the fields $$\phi_i$$ are just local coordinates on the coordinate chart of the manifold. A third common form is $$\mathcal{L}=\frac{1}{2}\mathrm{tr}\left(L_\mu L^\mu\right)$$ with $$L_\mu=U^{-1}\partial_\mu U $$ and $$U \in \mathrm{SU}(N)$$, the Lie group SU(N). This group can be replaced by any Lie group, or, more generally, by a symmetric space. The trace is just the Killing form in hiding; the Killing form provides a quadratic form on the field manifold, the lagrangian is then just the pullback of this form. Alternately, the Lagrangian can also be seen as the pullback of the Maurer–Cartan form to the base spacetime.

In general, sigma models exhibit topological soliton solutions. The most famous and well-studied of these is the Skyrmion, which serves as a model of the nucleon that has withstood the test of time.

Electromagnetism in special relativity
Consider a point particle, a charged particle, interacting with the electromagnetic field. The interaction terms $$- q \phi (\mathbf{x}(t),t) + q \dot{\mathbf{x}}(t) \cdot \mathbf{A} (\mathbf{x}(t),t)$$ are replaced by terms involving a continuous charge density ρ in A·s·m−3 and current density $$\mathbf{j}$$ in A·m−2. The resulting Lagrangian density for the electromagnetic field is: $$\mathcal{L}(\mathbf{x},t) = - \rho (\mathbf{x},t) \phi (\mathbf{x},t) + \mathbf{j} (\mathbf{x},t) \cdot \mathbf{A} (\mathbf{x},t) + {\epsilon_0 \over 2} {E}^2 (\mathbf{x},t) - {1 \over {2 \mu_0}} {B}^2 (\mathbf{x},t) .$$

Varying this with respect to $ϕ$, we get $$0 = - \rho (\mathbf{x},t) + \epsilon_0 \nabla \cdot \mathbf{E} (\mathbf{x},t) $$ which yields Gauss' law.

Varying instead with respect to $$\mathbf{A}$$, we get $$0 = \mathbf{j} (\mathbf{x},t) + \epsilon_0 \dot{\mathbf{E}} (\mathbf{x},t) - {1 \over \mu_0} \nabla \times \mathbf{B} (\mathbf{x},t) $$ which yields Ampère's law.

Using tensor notation, we can write all this more compactly. The term $$ - \rho \phi (\mathbf{x},t) + \mathbf{j} \cdot \mathbf{A} $$ is actually the inner product of two four-vectors. We package the charge density into the current 4-vector and the potential into the potential 4-vector. These two new vectors are $$ j^\mu = (\rho,\mathbf{j})\quad\text{and}\quad A_\mu = (-\phi,\mathbf{A}) $$ We can then write the interaction term as $$ - \rho \phi + \mathbf{j} \cdot \mathbf{A} = j^\mu A_\mu $$ Additionally, we can package the E and B fields into what is known as the electromagnetic tensor $$ F_{\mu\nu} $$. We define this tensor as $$ F_{\mu\nu}=\partial_\mu A_\nu-\partial_\nu A_\mu $$ The term we are looking out for turns out to be $$ {\epsilon_0 \over 2} {E}^2 - {1 \over {2 \mu_0}} {B}^2 = -\frac{1}{4\mu_0} F_{\mu\nu}F^{\mu\nu}= -\frac{1}{4\mu_0} F_{\mu\nu} F_{\rho\sigma}\eta^{\mu\rho}\eta^{\nu\sigma}$$ We have made use of the Minkowski metric to raise the indices on the EMF tensor. In this notation, Maxwell's equations are $$ \partial_\mu F^{\mu\nu}=-\mu_0 j^\nu\quad\text{and}\quad \epsilon^{\mu\nu\lambda\sigma}\partial_\nu F_{\lambda\sigma}=0 $$ where ε is the Levi-Civita tensor. So the Lagrange density for electromagnetism in special relativity written in terms of Lorentz vectors and tensors is $$ \mathcal{L}(x) = j^\mu(x) A_\mu(x) - \frac{1}{4\mu_0} F_{\mu\nu}(x) F^{\mu\nu}(x) $$ In this notation it is apparent that classical electromagnetism is a Lorentz-invariant theory. By the equivalence principle, it becomes simple to extend the notion of electromagnetism to curved spacetime.

Electromagnetism and the Yang–Mills equations
Using differential forms, the electromagnetic action S in vacuum on a (pseudo-) Riemannian manifold $$\mathcal M$$ can be written (using natural units, $Φ$) as $$\mathcal S[\mathbf{A}] = -\int_{\mathcal{M}} \left(\frac{1}{2}\,\mathbf{F} \wedge \ast\mathbf{F} - \mathbf{A} \wedge\ast \mathbf{J}\right) .$$ Here, A stands for the electromagnetic potential 1-form, J is the current 1-form, $δΦ$ is the field strength 2-form and the star denotes the Hodge star operator. This is exactly the same Lagrangian as in the section above, except that the treatment here is coordinate-free; expanding the integrand into a basis yields the identical, lengthy expression. Note that with forms, an additional integration measure is not necessary because forms have coordinate differentials built in. Variation of the action leads to $$\mathrm{d} {\ast}\mathbf{F} = {\ast}\mathbf{J} .$$ These are Maxwell's equations for the electromagnetic potential. Substituting $c = ε_{0} = 1$ immediately yields the equation for the fields, $$\mathrm{d}\mathbf{F} = 0$$ because $F$ is an exact form.

The A field can be understood to be the affine connection on a U(1)-fiber bundle. That is, classical electrodynamics, all of its effects and equations, can be completely understood in terms of a circle bundle over Minkowski spacetime.

The Yang–Mills equations can be written in exactly the same form as above, by replacing the Lie group U(1) of electromagnetism by an arbitrary Lie group. In the Standard model, it is conventionally taken to be $$\mathrm{SU}(3) \times \mathrm{SU}(2) \times \mathrm{U}(1)$$ although the general case is of general interest. In all cases, there is no need for any quantization to be performed. Although the Yang–Mills equations are historically rooted in quantum field theory, the above equations are purely classical.

Chern–Simons functional
In the same vein as the above, one can consider the action in one dimension less, i.e. in a contact geometry setting. This gives the Chern–Simons functional. It is written as $$\mathcal S[\mathbf{A}] = \int_{\mathcal{M}} \mathrm {tr} \left(\mathbf{A} \wedge d\mathbf{A} + \frac{2}{3}\mathbf{A} \wedge \mathbf{A} \wedge \mathbf{A}\right) .$$

Chern–Simons theory was deeply explored in physics, as a toy model for a broad range of geometric phenomena that one might expect to find in a grand unified theory.

Ginzburg–Landau Lagrangian
The Lagrangian density for Ginzburg–Landau theory combines the Lagrangian for the scalar field theory with the Lagrangian for the Yang–Mills action. It may be written as: $$\mathcal{L}(\psi, A)=\vert F \vert^2 + \vert D \psi\vert^2 + \frac{1}{4} \left( \sigma-\vert\psi\vert^2\right)^2$$ where $$\psi$$ is a section of a vector bundle with fiber $$\Complex^n$$. The $$\psi$$ corresponds to the order parameter in a superconductor; equivalently, it corresponds to the Higgs field, after noting that the second term is the famous "Sombrero hat" potential. The field $$A$$ is the (non-Abelian) gauge field, i.e. the Yang–Mills field and $$F$$ is its field-strength. The Euler–Lagrange equations for the Ginzburg–Landau functional are the Yang–Mills equations $$D {\star} D\psi = \frac{1}{2}\left(\sigma - \vert\psi\vert^2\right)\psi$$ and $$D {\star} F=-\operatorname{Re}\langle D\psi, \psi\rangle$$ where $${\star}$$ is the Hodge star operator, i.e. the fully antisymmetric tensor. These equations are closely related to the Yang–Mills–Higgs equations. Another closely related Lagrangian is found in Seiberg–Witten theory.

Dirac Lagrangian
The Lagrangian density for a Dirac field is: $$\mathcal{L} = \bar \psi ( i \hbar c {\partial}\!\!\!/\ - mc^2) \psi$$ where $$\psi $$ is a Dirac spinor, $$\bar \psi = \psi^\dagger \gamma^0$$ is its Dirac adjoint, and $${\partial}\!\!\!/$$ is Feynman slash notation for $$\gamma^\sigma \partial_\sigma$$. There is no particular need to focus on Dirac spinors in the classical theory. The Weyl spinors provide a more general foundation; they can be constructed directly from the Clifford algebra of spacetime; the construction works in any number of dimensions, and the Dirac spinors appear as a special case. Weyl spinors have the additional advantage that they can be used in a vielbein for the metric on a Riemannian manifold; this enables the concept of a spin structure, which, roughly speaking, is a way of formulating spinors consistently in a curved spacetime.

Quantum electrodynamic Lagrangian
The Lagrangian density for QED combines the Lagrangian for the Dirac field together with the Lagrangian for electrodynamics in a gauge-invariant way. It is: $$\mathcal{L}_{\mathrm{QED}} = \bar \psi (i\hbar c {D}\!\!\!\!/\ - mc^2) \psi - {1 \over 4\mu_0} F_{\mu \nu} F^{\mu \nu}$$ where $$F^{\mu \nu}$$ is the electromagnetic tensor, D is the gauge covariant derivative, and $${D}\!\!\!\!/$$ is Feynman notation for $$\gamma^\sigma D_\sigma$$ with $$ D_\sigma = \partial_\sigma - i e A_\sigma $$ where $$A_\sigma$$ is the electromagnetic four-potential. Although the word "quantum" appears in the above, this is a historical artifact. The definition of the Dirac field requires no quantization whatsoever, it can be written as a purely classical field of anti-commuting Weyl spinors constructed from first principles from a Clifford algebra. The full gauge-invariant classical formulation is given in Bleecker.

Quantum chromodynamic Lagrangian
The Lagrangian density for quantum chromodynamics combines the Lagrangian for one or more massive Dirac spinors with the Lagrangian for the Yang–Mills action, which describes the dynamics of a gauge field; the combined Lagrangian is gauge invariant. It may be written as: $$\mathcal{L}_{\mathrm{QCD}} = \sum_n \bar\psi_n \left( i\hbar c{D}\!\!\!\!/\ - m_n c^2 \right) \psi_n - {1\over 4} G^\alpha {}_{\mu\nu} G_\alpha {}^{\mu\nu}$$ where D is the QCD gauge covariant derivative, n = 1, 2, ...6 counts the quark types, and $$G^\alpha {}_{\mu\nu}\!$$ is the gluon field strength tensor. As for the electrodynamics case above, the appearance of the word "quantum" above only acknowledges its historical development. The Lagrangian and its gauge invariance can be formulated and treated in a purely classical fashion.

Einstein gravity
The Lagrange density for general relativity in the presence of matter fields is $$\mathcal{L}_\text{GR} = \mathcal{L}_\text{EH}+\mathcal{L}_\text{matter} = \frac{c^4}{16\pi G} \left(R-2\Lambda\right) + \mathcal{L}_\text{matter}$$ where $$\Lambda$$ is the cosmological constant, $$R$$ is the curvature scalar, which is the Ricci tensor contracted with the metric tensor, and the Ricci tensor is the Riemann tensor contracted with a Kronecker delta. The integral of $$ \mathcal{L}_\text{EH}$$ is known as the Einstein–Hilbert action. The Riemann tensor is the tidal force tensor, and is constructed out of Christoffel symbols and derivatives of Christoffel symbols, which define the metric connection on spacetime. The gravitational field itself was historically ascribed to the metric tensor; the modern view is that the connection is "more fundamental". This is due to the understanding that one can write connections with non-zero torsion. These alter the metric without altering the geometry one bit. As to the actual "direction in which gravity points" (e.g. on the surface of the Earth, it points down), this comes from the Riemann tensor: it is the thing that describes the "gravitational force field" that moving bodies feel and react to. (This last statement must be qualified: there is no "force field" per se; moving bodies follow geodesics on the manifold described by the connection. They move in a "straight line".)

The Lagrangian for general relativity can also be written in a form that makes it manifestly similar to the Yang–Mills equations. This is called the Einstein–Yang–Mills action principle. This is done by noting that most of differential geometry works "just fine" on bundles with an affine connection and arbitrary Lie group. Then, plugging in SO(3,1) for that symmetry group, i.e. for the frame fields, one obtains the equations above.

Substituting this Lagrangian into the Euler–Lagrange equation and taking the metric tensor $$ g_{\mu\nu}$$ as the field, we obtain the Einstein field equations $$ R_{\mu\nu}-\frac{1}{2}Rg_{\mu\nu}+g_{\mu\nu}\Lambda=\frac{8\pi G}{c^4}T_{\mu\nu}\,. $$ $$T_{\mu\nu}$$ is the energy momentum tensor and is defined by $$T_{\mu\nu} \equiv \frac{-2}{\sqrt{-g}}\frac{\delta (\mathcal{L}_{\mathrm{matter}} \sqrt{-g}) }{\delta g^{\mu\nu}} = -2 \frac{\delta \mathcal{L}_\mathrm{matter}}{\delta g^{\mu\nu}} + g_{\mu\nu} \mathcal{L}_\mathrm{matter}\,.$$ where $$g$$ is the determinant of the metric tensor when regarded as a matrix. Generally, in general relativity, the integration measure of the action of Lagrange density is $\sqrt{-g}\,d^4x $. This makes the integral coordinate independent, as the root of the metric determinant is equivalent to the Jacobian determinant. The minus sign is a consequence of the metric signature (the determinant by itself is negative). This is an example of the volume form, previously discussed, becoming manifest in non-flat spacetime.

Electromagnetism in general relativity
The Lagrange density of electromagnetism in general relativity also contains the Einstein–Hilbert action from above. The pure electromagnetic Lagrangian is precisely a matter Lagrangian $$ \mathcal{L}_\text{matter}$$. The Lagrangian is $$\begin{align} \mathcal{L}(x) &= j^\mu (x) A_\mu (x) - {1 \over 4\mu_0} F_{\mu \nu}(x) F_{\rho\sigma}(x) g^{\mu\rho}(x) g^{\nu\sigma}(x) + \frac{c^4}{16\pi G}R(x)\\ &= \mathcal{L}_\text{Maxwell} + \mathcal{L}_\text{Einstein–Hilbert}. \end{align}$$

This Lagrangian is obtained by simply replacing the Minkowski metric in the above flat Lagrangian with a more general (possibly curved) metric $$ g_{\mu\nu}(x)$$. We can generate the Einstein Field Equations in the presence of an EM field using this lagrangian. The energy-momentum tensor is $$ T^{\mu\nu}(x) = \frac{2}{\sqrt{-g(x)}}\frac{\delta}{\delta g_{\mu\nu}(x)}\mathcal{S}_\text{Maxwell}=\frac{1}{\mu_{0}}\left(F^{\mu}_{\text{ }\lambda}(x)F^{\nu\lambda}(x)-\frac{1}{4}g^{\mu\nu}(x)F_{\rho\sigma}(x)F^{\rho\sigma}(x)\right) $$ It can be shown that this energy momentum tensor is traceless, i.e. that $$ T = g_{\mu\nu}T^{\mu\nu} = 0 $$ If we take the trace of both sides of the Einstein Field Equations, we obtain $$ R = -\frac{8\pi G}{c^4}T $$ So the tracelessness of the energy momentum tensor implies that the curvature scalar in an electromagnetic field vanishes. The Einstein equations are then $$ R^{\mu\nu} = \frac{8\pi G}{c^4}\frac{1}{\mu_0}\left({F^{\mu}}_{\lambda}(x)F^{\nu\lambda}(x) - \frac{1}{4} g^{\mu\nu}(x)F_{\rho\sigma}(x)F^{\rho\sigma}(x)\right) $$ Additionally, Maxwell's equations are $$ D_{\mu}F^{\mu\nu} = -\mu_0 j^\nu $$ where $$D_\mu$$ is the covariant derivative. For free space, we can set the current tensor equal to zero, $$ j^\mu = 0 $$. Solving both Einstein and Maxwell's equations around a spherically symmetric mass distribution in free space leads to the Reissner–Nordström charged black hole, with the defining line element (written in natural units and with charge $Q$): $$ \mathrm{d}s^2 = \left(1-\frac{2M}{r}+\frac{Q^2}{r^2}\right)\mathrm{d}t^2- \left(1-\frac{2M}{r}+\frac{Q^2}{r^2}\right)^{-1}\mathrm{d}r^2 -r^2\mathrm{d}\Omega^2$$

One possible way of unifying the electromagnetic and gravitational Lagrangians (by using a fifth dimension) is given by Kaluza–Klein theory. Effectively, one constructs an affine bundle, just as for the Yang–Mills equations given earlier, and then considers the action separately on the 4-dimensional and the 1-dimensional parts. Such factorizations, such as the fact that the 7-sphere can be written as a product of the 4-sphere and the 3-sphere, or that the 11-sphere is a product of the 4-sphere and the 7-sphere, accounted for much of the early excitement that a theory of everything had been found. Unfortunately, the 7-sphere proved not large enough to enclose all of the Standard model, dashing these hopes.

Additional examples

 * The BF model Lagrangian, short for "Background Field", describes a system with trivial dynamics, when written on a flat spacetime manifold. On a topologically non-trivial spacetime, the system will have non-trivial classical solutions, which may be interpreted as solitons or instantons. A variety of extensions exist, forming the foundations for topological field theories.