# Lagrangian

{{#invoke:Hatnote|hatnote}}

The Lagrangian, L, of a dynamical system is a mathematical function that summarizes the dynamics of the system. For a simple mechanical system, it is the value given by the kinetic energy of the particle minus the potential energy of the particle but it may be generalized to more complex systems. It is used primarily as a key component in the Euler-Lagrange equations to find the path of a particle according to the principle of least action.

The Lagrangian is named after Italian-French mathematician and astronomer Joseph Louis Lagrange. The concept of a Lagrangian was introduced in a reformulation of classical mechanics introduced by Lagrange known as Lagrangian mechanics in 1788. This reformulation was needed in order to explore mechanics in alternative systems to Cartesian coordinates such as Polar, Cylindrical and Spherical coordinates for which Newtonian mechanics was not suitable.[1]

The Lagrangian has since been used in a method to find the acceleration of a particle in a Newtonian gravitational field and to derive the Einstein field equations. This led to its use in applying electromagnetism to curved spacetime and in describing charged black holes. It also has additional uses in Mathematical formalism to find the functional derivative of an action, and in engineering for the analysis and optimisation of dynamic systems.

## Definition

In classical mechanics, the natural form of the Lagrangian is defined as the kinetic energy, T, of the system minus its potential energy, V.[2] In symbols,

${\displaystyle L=T-V.}$

If the Lagrangian of a system is known, then the equations of motion of the system may be obtained by a direct substitution of the expression for the Lagrangian into the Euler–Lagrange equation. The Lagrangian of a given system is not unique, and two Lagrangians describing the same system can differ by the total derivative with respect to time of some function ${\displaystyle f(q,t)}$, but solving any equivalent Lagrangians will give the same equations of motion.[3][4]

## The Lagrangian formulation

### Simple example

The trajectory of a thrown ball is characterized by the sum of the Lagrangian values at each time being a (local) minimum.

The Lagrangian L can be calculated at several instants of time t, and a graph of L against t can be drawn. The area under the curve is the action. Any different path between the initial and final positions leads to a larger action than that chosen by nature. Nature chooses the smallest action – this is the Principle of Least Action.

If Nature has defined the mechanics problem of the thrown ball in so elegant a fashion, might She have defined other problems similarly. So it seems now. Indeed, at the present time it appears that we can describe all the fundamental forces in terms of a Lagrangian. The search for Nature's One Equation, which rules all of the universe, has been largely a search for an adequate Lagrangian.

—Robert Adair, The Great Design: Particles, Fields, and Creation[5]

Using only the principle of least action and the Lagrangian we can deduce the correct trajectory, by trial and error or the calculus of variations.

### Importance

The Lagrangian formulation of mechanics is important not just for its broad applications, but also for its role in advancing deep understanding of physics. Although Lagrange only sought to describe classical mechanics, the action principle that is used to derive the Lagrange equation was later recognized to be applicable to quantum mechanics as well.

Physical action and quantum-mechanical phase are related via Planck's constant, and the principle of stationary action can be understood in terms of constructive interference of wave functions.

The same principle, and the Lagrangian formalism, are tied closely to Noether's theorem, which connects physical conserved quantities to continuous symmetries of a physical system.

Lagrangian mechanics and Noether's theorem together yield a natural formalism for first quantization by including commutators between certain terms of the Lagrangian equations of motion for a physical system.

• The formulation is not tied to any one coordinate system – rather, any convenient variables may be used to describe the system; these variables are called "generalized coordinates" qi and may be any quantitative attributes of the system (for example, strength of the magnetic field at a particular location; angle of a pulley; position of a particle in space; or degree of excitation of a particular eigenmode in a complex system) which are functions of the independent variable(s). This trait makes it easy to incorporate constraints into a theory by defining coordinates that only describe states of the system that satisfy the constraints.
• If the Lagrangian is invariant under a symmetry, then the resulting equations of motion are also invariant under that symmetry. This characteristic is very helpful in showing that theories are consistent with either special relativity or general relativity.

### Cyclic coordinates and conservation laws

An important property of the Lagrangian is that conservation laws can easily be read off from it. For example, if the Lagrangian ${\displaystyle \scriptstyle L}$ does not depend on ${\displaystyle \scriptstyle q_{i}}$ itself, then the generalized momentum (${\displaystyle \scriptstyle p_{i}}$), given by:

${\displaystyle p_{i}={\frac {\partial L}{\partial {\dot {q}}_{i}}},}$

is a conserved quantity, because of Lagrange's equations:

${\displaystyle {\dot {p}}_{i}={\frac {\partial L}{\partial q_{i}}}=0.}$

It doesn't matter if ${\displaystyle \scriptstyle L}$ depends on the time derivative ${\displaystyle \scriptstyle {\dot {q}}_{i}}$ of that generalized coordinate, since the Lagrangian independence of the coordinate always makes the above partial derivative zero. This is a special case of Noether's theorem. Such coordinates are called "cyclic" or "ignorable".

For example, the conservation of the generalized momentum,

${\displaystyle p_{2}={\frac {\partial L}{\partial {\dot {q}}_{2}}},}$

say, can be directly seen if the Lagrangian of the system is of the form

${\displaystyle L(q_{1},q_{3},q_{4},\dots ;{\dot {q}}_{1},{\dot {q}}_{2},{\dot {q}}_{3},{\dot {q}}_{4},\dots ;t)\,.}$

Also, if the time t, does not appear in L, then the Hamiltonian (which is related to the lagrangian by a Legendre transformation) is conserved. This is the energy conservation unless the potential energy depends on velocity, as in electrodynamics.[6][7]

## Explanation

The Lagrangian in many classical systems is a function of generalized coordinates qi and their velocities dqi/dt. These coordinates (and velocities) are, in their turn, parametric functions of time. In the classical view, time is an independent variable and qi (and dqi/dt) are dependent variables as is often seen in phase space explanations of systems. This formalism was generalized further to handle field theory. 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 manifold. The dependent variables (q) are replaced by the value of a field at that point in spacetime φ(x,y,z,t) so that the equations of motion are obtained by means of an action principle, written as:

${\displaystyle {\frac {\delta {\mathcal {S}}}{\delta \varphi _{i}}}=0,\,}$

where the action, ${\displaystyle \scriptstyle {\mathcal {S}}}$, is a functional of the dependent variables φi(s) with their derivatives and s itself

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

and where s = { sα} denotes the set of n independent variables of the system, indexed by α = 1, 2, 3,..., n. Notice L is used in the case of one independent variable (t) and ${\displaystyle \scriptstyle {\mathcal {L}}\,}$ is used in the case of multiple independent variables (usually four: x, y, z, t).

The equations of motion obtained from this functional derivative are the Euler–Lagrange equations of this action. For example, in the classical mechanics of particles, the only independent variable is time, t. So the Euler–Lagrange equations are

${\displaystyle {\frac {\mathrm {d} }{{\mathrm {d} }t}}{\frac {\partial L}{\partial {\dot {\varphi }}_{i}}}={\frac {\partial L}{\partial \varphi _{i}}}\,.}$

Dynamical systems whose equations of motion are obtainable by means of an action principle on a suitably chosen Lagrangian are known as Lagrangian dynamical systems. Examples of Lagrangian dynamical systems range from the classical version of the Standard Model, to Newton's equations, to purely mathematical problems such as geodesic equations and Plateau's problem.

## An example from classical mechanics

### In Cartesian coordinates

Suppose we have a three-dimensional space in which a particle of mass m moves under the influence of a conservative force ${\displaystyle {\mathbf {F} }}$. Since the force is conservative, it corresponds to a potential energy function ${\displaystyle V({\mathbf {x} })}$ given by ${\displaystyle \mathbf {F} =-\nabla V(\mathbf {x} )}$. The Lagrangian of the particle can be written

${\displaystyle L(\mathbf {x} ,{\dot {\mathbf {x} }})={\frac {1}{2}}m{\dot {\mathbf {x} }}^{2}-V(\mathbf {x} ).}$

The equations of motion for the particle are found by applying the Euler–Lagrange equation

${\displaystyle {\frac {\mathrm {d} }{{\mathrm {d} }t}}\left({\frac {\partial L}{\partial {\dot {x}}_{i}}}\right)-{\frac {\partial L}{\partial x_{i}}}=0,}$

where i = 1, 2, 3.

Then

${\displaystyle {\frac {\partial L}{\partial x_{i}}}=-{\frac {\partial V}{\partial x_{i}}},}$
${\displaystyle {\frac {\partial L}{\partial {\dot {x}}_{i}}}={\frac {\partial ~}{\partial {\dot {x}}_{i}}}\left({\frac {1}{2}}m{\dot {\mathbf {x} }}^{2}\right)={\frac {1}{2}}m{\frac {\partial ~}{\partial {\dot {x}}_{i}}}\left({\dot {x}}_{i}^{2}\right)=m{\dot {x}}_{i},}$

and

${\displaystyle {\frac {\mathrm {d} }{{\mathrm {d} }t}}\left({\frac {\partial L}{\partial {\dot {x}}_{i}}}\right)=m{\ddot {x}}_{i}.}$

Thus

${\displaystyle m{\ddot {\mathbf {x} }}+\nabla V=0,}$

which is Newton's second law of motion for a particle subject to a conservative force. Here the time derivative is written conventionally as a dot above the quantity being differentiated, and ∇ is the del operator.

### In spherical coordinates

Suppose we have a three-dimensional space using spherical coordinates (r, θ, φ) with the Lagrangian

${\displaystyle L={\frac {m}{2}}({\dot {r}}^{2}+r^{2}{\dot {\theta }}^{2}+r^{2}\sin ^{2}\theta \,{\dot {\varphi }}^{2})-V(r).}$

Then the Euler–Lagrange equations are:

${\displaystyle m{\ddot {r}}-mr({\dot {\theta }}^{2}+\sin ^{2}\theta \,{\dot {\varphi }}^{2})+V'=0,}$
${\displaystyle {\frac {\mathrm {d} }{{\mathrm {d} }t}}(mr^{2}{\dot {\theta }})-mr^{2}\sin \theta \cos \theta \,{\dot {\varphi }}^{2}=0,}$
${\displaystyle {\frac {\mathrm {d} }{{\mathrm {d} }t}}(mr^{2}\sin ^{2}\theta \,{\dot {\varphi }})=0.}$

Here the set of parameters si is just the time t, and the dynamical variables ϕi(s) are the trajectories ${\displaystyle \scriptstyle {\vec {x}}(t)}$ of the particle.

Despite the use of standard variables such as x, the Lagrangian allows the use of any coordinates, which do not need to be orthogonal. These are "generalized coordinates".

## Lagrangian of a test particle

A test particle is a particle whose mass and charge are assumed to be so small that its effect on external system is insignificant. It is often a hypothetical simplified point particle with no properties other than mass and charge. Real particles like electrons and up quarks are more complex and have additional terms in their Lagrangians.

### Classical test particle with Newtonian gravity

Suppose we are given a particle with mass m kilograms, and position ${\displaystyle {\mathbf {x} }}$ meters in a Newtonian gravitation field with potential Φ in J·kg−1. The particle's world line is parameterized by time t seconds. The particle's kinetic energy is:

${\displaystyle T(t)={\tfrac {1}{2}}m\left|{\dot {\mathbf {x} }}(t)\right|^{2}}$

and the particle's gravitational potential energy is:

${\displaystyle V(t)=m\Phi (\mathbf {x} (t),t).}$

Then its Lagrangian is L joules, where

${\displaystyle L(t)=T(t)-V(t)={\tfrac {1}{2}}m\left|{\dot {\mathbf {x} }}(t)\right|^{2}-m\Phi (\mathbf {x} (t),t).}$

Varying ${\displaystyle {\mathbf {x} }}$ in the integral (equivalent to the Euler–Lagrange differential equation), we get

${\displaystyle 0=\delta \int {L(t)\,\mathrm {d} t}=\int {\delta L(t)\,\mathrm {d} t}}$
${\displaystyle =\int {(m{\dot {\mathbf {x} }}(t)\cdot {\dot {\delta \mathbf {x} }}(t)-m\nabla \Phi (\mathbf {x} (t),t)\cdot \delta \mathbf {x} (t))\,\mathrm {d} t}.}$

Integrate the first term by parts and discard the total integral. Then divide out the variation to get

${\displaystyle 0=-m{\ddot {\mathbf {x} }}(t)-m\nabla \Phi (\mathbf {x} (t),t)}$

and thus

is the equation of motion – two different expressions for the force.

### Special relativistic test particle with electromagnetism

In special relativity, the energy (rest energy plus kinetic energy) of a free test particle is

${\displaystyle mc^{2}{\frac {dt}{d\tau }}={\frac {mc^{2}}{\sqrt {1-{\frac {v^{2}(t)}{c^{2}}}}}}=+mc^{2}+{1 \over 2}mv^{2}(t)+{3 \over 8}m{\frac {v^{4}(t)}{c^{2}}}+\dots \,.}$

However, the term in the Lagrangian that gives rise to the derivative of the momentum is no longer the kinetic energy. It must be changed to

${\displaystyle -mc^{2}{\frac {d\tau (t)}{dt}}=-mc^{2}{\sqrt {1-{\frac {v^{2}(t)}{c^{2}}}}}=-mc^{2}+{1 \over 2}mv^{2}(t)+{1 \over 8}m{\frac {v^{4}(t)}{c^{2}}}+\dots }$

where c is the vacuum speed of light in m·s−1, τ is the proper time in seconds (i.e. time measured by a clock moving with the particle) and ${\displaystyle \scriptstyle v^{2}(t)={\dot {\mathbf {x} }}(t)\cdot {\dot {\mathbf {x} }}(t).}$ The second term in the series is just the classical kinetic energy. Suppose the particle has electrical charge q coulombs and is in an electromagnetic field with scalar potential ϕ volts (a volt is a joule per coulomb) and vector potential ${\displaystyle \scriptstyle \mathbf {A} }$ V·s·m−1. The Lagrangian of a special relativistic test particle in an electromagnetic field is:

${\displaystyle L(t)=-mc^{2}{\sqrt {1-{\frac {v^{2}(t)}{c^{2}}}}}-q\phi (\mathbf {x} (t),t)+q{\dot {\mathbf {x} }}(t)\cdot \mathbf {A} (\mathbf {x} (t),t).}$

Varying this with respect to ${\displaystyle {\mathbf {x} }}$, we get

${\displaystyle 0=-{\frac {d}{dt}}\left({\frac {m{\dot {\mathbf {x} }}(t)}{\sqrt {1-{\frac {v^{2}(t)}{c^{2}}}}}}\right)-q\nabla \phi (\mathbf {x} (t),t)-q{\dot {\mathbf {A} }}(\mathbf {x} (t),t)-q{\dot {\mathbf {x} }}(t)\cdot \nabla \mathbf {A} (\mathbf {x} (t),t)+q\nabla {\mathbf {A} }(\mathbf {x} (t),t)\cdot {\dot {\mathbf {x} }}(t)}$

which is

${\displaystyle {\frac {d}{dt}}\left({\frac {m{\dot {\mathbf {x} }}(t)}{\sqrt {1-{\frac {v^{2}(t)}{c^{2}}}}}}\right)=q\mathbf {E} (\mathbf {x} (t),t)+q{\dot {\mathbf {x} }}(t)\times \mathbf {B} (\mathbf {x} (t),t)}$

which is the equation for the Lorentz force, where:

${\displaystyle \mathbf {E} (\mathbf {x} ,t)=-\nabla \phi (\mathbf {x} ,t)-{\dot {\mathbf {A} }}(\mathbf {x} ,t)}$
${\displaystyle \mathbf {B} (\mathbf {x} ,t)=\nabla \times \mathbf {A} (\mathbf {x} ,t)}$

are the fields and potentials.

### General relativistic test particle

In general relativity, the first term generalizes (includes) both the classical kinetic energy and the interaction with the gravitational field. It becomes:[8][9]

${\displaystyle -mc^{2}{\frac {d\tau (t)}{dt}}=-mc{\sqrt {-g_{\mu \nu }(x(t)){\frac {dx^{\mu }(t)}{dt}}{\frac {dx^{\nu }(t)}{dt}}}}.}$

The Lagrangian of a general relativistic test particle in an electromagnetic field is:Template:Cn

${\displaystyle L(t)=-mc{\sqrt {-g_{\mu \nu }(x(t)){\frac {dx^{\mu }(t)}{dt}}{\frac {dx^{\nu }(t)}{dt}}}}+q{\frac {dx^{\mu }(t)}{dt}}A_{\mu }(x(t)).}$

If the four spacetime coordinates xµ are given in arbitrary units (i.e. unitless), then gµν in m2 is the rank 2 symmetric metric tensor which is also the gravitational potential. Also, Aµ in V·s is the electromagnetic 4-vector potential. Notice that a factor of c has been absorbed into the square root because it is the equivalent of

${\displaystyle c\,{\sqrt {1-{\frac {v^{2}(t)}{c^{2}}}}}={\sqrt {-(-c^{2}+v^{2}(t))}}.}$

This notion has been directly generalized from special relativity.

## Lagrangians and Lagrangian densities in field theory

The time integral of the Lagrangian is called the action denoted by S. In field theory, a distinction is occasionally made between the Lagrangian L, of which the action is the time integral:

${\displaystyle {\mathcal {S}}=\int {L\,{\mathrm {d} }t}}$

and the Lagrangian density ${\displaystyle \scriptstyle {\mathcal {L}}}$, which one integrates over all spacetime to get the action:

${\displaystyle {\mathcal {S}}[\varphi _{i}]=\int {{\mathcal {L}}(\varphi _{i}(x))\,\mathrm {d} ^{4}x}.}$

The Lagrangian is then the spatial integral of the Lagrangian density. However, ${\displaystyle \scriptstyle {\mathcal {L}}}$ is also frequently simply called the Lagrangian, especially in modern use; it is far more useful in relativistic theories since it is a locally defined, Lorentz scalar field. Both definitions of the Lagrangian can be seen as special cases of the general form, depending on whether the spatial variable ${\displaystyle \scriptstyle {\mathbf {x} }}$ is incorporated into the index i or the parameters s in φi(s). Quantum field theories in particle physics, such as quantum electrodynamics, are usually described in terms of ${\displaystyle \scriptstyle {\mathcal {L}}}$, and the terms in this form of the Lagrangian translate quickly to the rules used in evaluating Feynman diagrams.

Notice that, in the presence of gravity or when using general curvilinear coordinates, the Lagrangian density ${\displaystyle {\mathcal {L}}}$ will include a factor of ${\displaystyle {\sqrt {\vert g\vert }}}$ or its equivalent to ensure that it is a scalar density so that the integral will be invariant.

## Selected fields

To go with the section on test particles above, here are the equations for the fields in which they move. The equations below pertain to the fields in which the test particles described above move and allow the calculation of those fields. The equations below will not give you the equations of motion of a test particle in the field but will instead give you the potential (field) induced by quantities such as mass or charge density at any point ${\displaystyle \scriptstyle (\mathbf {x} ,t)}$. For example, in the case of Newtonian gravity, the Lagrangian density integrated over spacetime gives you an equation which, if solved, would yield ${\displaystyle \scriptstyle \Phi (\mathbf {x} ,t)}$. This ${\displaystyle \scriptstyle \Phi (\mathbf {x} ,t)}$, when substituted back in equation (Template:EquationNote), the Lagrangian equation for the test particle in a Newtonian gravitational field, provides the information needed to calculate the acceleration of the particle.

### Newtonian gravity

The Lagrangian (density) is ${\displaystyle \scriptstyle {\mathcal {L}}}$ in J·m−3. The interaction term is replaced by a term involving a continuous mass density ρ in kg·m−3. This is necessary because using a point source for a field would result in mathematical difficulties. The resulting Lagrangian for the classical gravitational field is:

${\displaystyle {\mathcal {L}}(\mathbf {x} ,t)=-\rho (\mathbf {x} ,t)\Phi (\mathbf {x} ,t)-{1 \over 8\pi G}(\nabla \Phi (\mathbf {x} ,t))^{2}}$

where G in m3·kg−1·s−2 is the gravitational constant. Variation of the integral with respect to Φ gives:

${\displaystyle \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)).}$

Integrate by parts and discard the total integral. Then divide out by δΦ to get:

${\displaystyle 0=-\rho (\mathbf {x} ,t)+{1 \over 4\pi G}\nabla \cdot \nabla \Phi (\mathbf {x} ,t)}$

and thus

${\displaystyle 4\pi G\rho (\mathbf {x} ,t)=\nabla ^{2}\Phi (\mathbf {x} ,t)}$

which yields Gauss's law for gravity.

### Einstein Gravity

{{#invoke:main|main}} The Lagrange density for general relativity in the presence of matter fields is

${\displaystyle {\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}}}$

${\displaystyle \scriptstyle 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 ${\displaystyle {\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 are the gravitational force field. Plugging this Lagrangian into the Euler-Lagrange equation and taking the metric tensor ${\displaystyle g_{\mu \nu }}$ as the field, we obtain the Einstein field equations

${\displaystyle R_{\mu \nu }-{\frac {1}{2}}Rg_{\mu \nu }+g_{\mu \nu }\Lambda ={\frac {8\pi G}{c^{4}}}T_{\mu \nu }}$

The last tensor is the energy momentum tensor and is defined by

${\displaystyle 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} }.}$

${\displaystyle \scriptstyle g}$ is the determinant of the metric tensor when regarded as a matrix. ${\displaystyle \Lambda }$ is the Cosmological constant. Generally, in general relativity, the integration measure of the action of Lagrange density is ${\displaystyle {\sqrt {-g}}d^{4}x}$. 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).[11]

### Electromagnetism in special relativity

The interaction terms

${\displaystyle -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 ${\displaystyle \scriptstyle \mathbf {j} }$ in A·m−2. The resulting Lagrangian for the electromagnetic field is:

${\displaystyle {\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

${\displaystyle 0=-\rho (\mathbf {x} ,t)+\epsilon _{0}\nabla \cdot \mathbf {E} (\mathbf {x} ,t)}$

which yields Gauss' law.

Varying instead with respect to ${\displaystyle \scriptstyle \mathbf {A} }$, we get

${\displaystyle 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 ${\displaystyle -\rho \phi (\mathbf {x} ,t)+\mathbf {j} \cdot \mathbf {A} }$ is actually the inner product of two Lorentz vectors. We package the charge density into the current 4-vector and the potential into the potential 4-vector. These two new vectors are

${\displaystyle j^{\mu }=(\rho ,\mathbf {j} )\quad {\text{and}}\quad A_{\mu }=(-\phi ,\mathbf {A} )}$

We can then write the interaction term as

${\displaystyle -\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 ${\displaystyle F_{\mu \nu }}$. We define this tensor as

${\displaystyle F_{\mu \nu }=\partial _{\mu }A_{\nu }-\partial _{\nu }A_{\mu }}$

The term we are looking out for turns out to be

${\displaystyle {\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

${\displaystyle \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

${\displaystyle {\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.[12][13]

### 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 ${\displaystyle {\mathcal {L}}_{\text{matter}}}$. The Lagrangian is

${\displaystyle {\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}}}$

This Lagrangian is obtained by simply replacing the Minkowski metric in the above flat Lagrangian with a more general (possibly curved) metric ${\displaystyle 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

${\displaystyle 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_{{\text{ }}\lambda }^{\mu }(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

${\displaystyle T=g_{\mu \nu }T^{\mu \nu }=0}$

If we take the trace of both sides of the Einstein Field Equations, we obtain

${\displaystyle 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

${\displaystyle R^{\mu \nu }={\frac {8\pi G}{c^{4}}}{\frac {1}{\mu _{0}}}\left(F_{{\text{ }}\lambda }^{\mu }(x)F^{\nu \lambda }(x)-{\frac {1}{4}}g^{\mu \nu }(x)F_{\rho \sigma }(x)F^{\rho \sigma }(x)\right)}$

${\displaystyle D_{\mu }F^{\mu \nu }=-\mu _{0}j^{\nu }}$

where ${\displaystyle D_{\mu }}$ is the covariant derivative. For free space, we can set the current tensor equal to zero, ${\displaystyle j^{\mu }=0}$. Solving both Einstein and Maxwell's equations around a spherically symmetric mass distribution in free space leads to the Reissner-Nordstrom charged black hole, with the defining line element (written in natural units and with charge Q):

${\displaystyle ds^{2}=\left(1-{\frac {2M}{r}}+{\frac {Q^{2}}{r^{2}}}\right)dt^{2}+\left(1-{\frac {2M}{r}}+{\frac {Q^{2}}{r^{2}}}\right)^{-1}dr^{2}+r^{2}d\Omega ^{2}}$

### Electromagnetism using differential forms

Using differential forms, the electromagnetic action S in vacuum on a (pseudo-) Riemannian manifold ${\displaystyle \scriptstyle {\mathcal {M}}}$ can be written (using natural units, c = ε0 = 1) as

${\displaystyle {\mathcal {S}}[\mathbf {A} ]=\int _{\mathcal {M}}\left(-{\frac {1}{2}}\,\mathbf {F} \wedge \star \mathbf {F} +\mathbf {A} \wedge \star \mathbf {J} \right).}$

Here, A stands for the electromagnetic potential 1-form, J is the current 1-form, F 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

${\displaystyle \mathrm {d} {\star }\mathbf {F} =\mathbf {J} .}$

These are Maxwell's equations for the electromagnetic potential. Substituting F = dA immediately yields the equation for the fields,

${\displaystyle {\mathrm {d} }{\mathbf {F} }=0}$

because F is an exact form.

### Dirac Lagrangian

The Lagrangian density for a Dirac field is:[15]

${\displaystyle {\mathcal {L}}=i\hbar c{\bar {\psi }}{\partial }\!\!/\ \psi -mc^{2}{\bar {\psi }}\psi }$

### Quantum electrodynamic Lagrangian

The Lagrangian density for QED is:

${\displaystyle {\mathcal {L}}_{\mathrm {QED} }=i\hbar c{\bar {\psi }}{D}\!\!\!\!/\ \psi -mc^{2}{\bar {\psi }}\psi -{1 \over 4\mu _{0}}F_{\mu \nu }F^{\mu \nu }}$

### Quantum chromodynamic Lagrangian

The Lagrangian density for quantum chromodynamics is:[16][17][18]

${\displaystyle {\mathcal {L}}_{\mathrm {QCD} }=\sum _{n}\left(i\hbar c{\bar {\psi }}_{n}{D}\!\!\!\!/\ \psi _{n}-m_{n}c^{2}{\bar {\psi }}_{n}\psi _{n}\right)-{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 ${\displaystyle \scriptstyle G^{\alpha }{}_{\mu \nu }\!}$ is the gluon field strength tensor.

## Mathematical formalism

Suppose we have an n-dimensional manifold, M, and a target manifold, T. Let ${\displaystyle \scriptstyle {\mathcal {C}}}$ be the configuration space of smooth functions from M to T.

### Mathematical development

Consider a functional,

${\displaystyle {\mathcal {S}}:{\mathcal {C}}\rightarrow {\mathbb {R} }}$,

called the action. Physical considerations require it be a mapping to ${\displaystyle \scriptstyle {\mathbb {R} }}$ (the set of all real numbers), not ${\displaystyle \scriptstyle {\mathbb {C} }}$ (the set of all complex numbers).

In order for the action to be local, we need additional restrictions on the action. If ${\displaystyle \scriptstyle \varphi \ \in \ {\mathcal {C}}}$, we assume ${\displaystyle \scriptstyle {\mathcal {S}}[\varphi ]}$ is the integral over M of a function of ${\displaystyle \scriptstyle \varphi }$, its derivatives and the position called the Lagrangian, ${\displaystyle {\mathcal {L}}(\varphi ,\partial \varphi ,\partial \partial \varphi ,...,x)}$. In other words,

${\displaystyle \forall \varphi \in {\mathcal {C}},\ \ {\mathcal {S}}[\varphi ]\equiv \int _{M}{\mathrm {d} }^{n}x{\mathcal {L}}{\big (}\varphi (x),\partial \varphi (x),\partial \partial \varphi (x),...,x{\big )}.}$

It is assumed below, in addition, that the Lagrangian depends on only the field value and its first derivative but not the higher derivatives.

Given boundary conditions, basically a specification of the value of ${\displaystyle \scriptstyle \varphi }$ at the boundary if M is compact or some limit on ${\displaystyle \scriptstyle \varphi }$ as x → ∞ (this will help in doing integration by parts), the subspace of ${\displaystyle \scriptstyle {\mathcal {C}}}$ consisting of functions, ${\displaystyle \scriptstyle \varphi }$, such that all functional derivatives of S at ${\displaystyle \scriptstyle \varphi }$ are zero and ${\displaystyle \scriptstyle \varphi }$ satisfies the given boundary conditions is the subspace of on shell solutions.

The solution is given by the Euler–Lagrange equations (thanks to the boundary conditions),

${\displaystyle {\frac {\delta {\mathcal {S}}}{\delta \varphi }}=-\partial _{\mu }\left({\frac {\partial {\mathcal {L}}}{\partial (\partial _{\mu }\varphi )}}\right)+{\frac {\partial {\mathcal {L}}}{\partial \varphi }}=0.}$

The left hand side is the functional derivative of the action with respect to ${\displaystyle \scriptstyle \varphi }$.

## Uses in Engineering

50 years ago Lagrangians were a general part of the engineering curriculum, but quarter of a century later, even with the ascendency of dynamical systems, they were dropped as requirements from the majority of engineering programs, and considered to be the domain of physics. A decade ago this changed dramatically, and Lagrangians are not only a required part of many ME and EE curricula, but are now seen as far more than the province of physics. This is true of pure and applied engineering, as well as the more physics-related aspects of engineering, or engineering optimization, which itself is more the province of Lagrange multipliers.

Today, Lagrangians find their way into hundreds of direct engineering solutions, including robotics, turbulent flow analysis (Lagrangian and Eulerian specification of the flow field), signal processing, microscopic component contact and nanotechnology (superlinear convergent augmented Lagrangians), gyroscopic forcing and dissipation, semi-infinite supercomputing (which also involve Lagrange multipliers in the subfield of semi-infinite programming), chemical engineering (specific heat linear Lagrangian interpolation in reaction planning), civil engineering (dynamic analysis of traffic flows), optics engineering and design (Lagrangian and Hamiltonian optics) aerospace (Lagrangian interpolation), force stepping integrators, and even airbag deployment (coupled Eulerian-Lagrangians as well as SELM—the stochastic Eulerian Lagrangian method).[19]

## Notes

1. Template:Cite web
2. {{#invoke:citation/CS1|citation |CitationClass=book }}
3. {{#invoke:citation/CS1|citation |CitationClass=book }}
4. {{#invoke:citation/CS1|citation |CitationClass=book }}
5. The Great Design: Particles, Fields, and Creation (New York: Oxford University Press, 1989), ROBERT K. ADAIR, p.22–24
6. Classical Mechanics, T.W.B. Kibble, European Physics Series, McGraw-Hill (UK), 1973, ISBN 0-07-084018-0
7. Analytical Mechanics, L.N. Hand, J.D. Finch, Cambridge University Press, 2008, ISBN 978-0-521-57572-0
8. Lev Davidovich Landau & Evgeny Mikhailovich Lifshitz, The Classical Theory of Fields, (1975), Elsevier Ltd., ISBN 978-0-7506-2768-9, page 26
9. Noel A. Doughty, Lagrangian Interaction, (1990), Addison-Wesley Publishers Ltd., ISBN 0-201-41625-5, pages 310
10. Mandl F., Shaw G., Quantum Field Theory, chapter 2
11. {{#invoke:citation/CS1|citation |CitationClass=book }}
12. {{#invoke:citation/CS1|citation |CitationClass=book }}
13. {{#invoke:citation/CS1|citation |CitationClass=book }}
14. {{#invoke:citation/CS1|citation |CitationClass=book }}
15. Itzykson-Zuber, eq. 3-152
16. http://www.fuw.edu.pl/~dobaczew/maub-42w/node9.html
17. http://smallsystems.isn-oldenburg.de/Docs/THEO3/publications/semiclassical.qcd.prep.pdf
18. http://www-zeus.physik.uni-bonn.de/~brock/teaching/jets_ws0405/seminar09/sluka_quark_gluon_jets.pdf
19. {{#invoke:citation/CS1|citation |CitationClass=book }}