Lagrangian Density and Continuum Lagrangian Formalism

In particle mechanics the configuration of a system at an instant is a finite set of generalized coordinates qi(t)q_i(t), and the Lagrangian L(qi,q˙i,t)L(q_i,\dot q_i,t) is a single function whose time integral is the action. Many physical systems, however, are most naturally described by a continuous degree of freedom at every point of space: the transverse displacement of a string, the density of a gas, the components of the electromagnetic potential. Such a system has an uncountable infinity of degrees of freedom, one ϕ\phi for each spatial point, and the discrete index ii is replaced by a continuous label xx. The continuum Lagrangian formalism is the systematic extension of Hamilton's principle to this case. The central object is the Lagrangian density L\mathcal{L}, a function of the field ϕ\phi, its time derivative ϕ˙=∂tϕ\dot\phi=\partial_t\phi, its spatial derivatives ∂xϕ\partial_x\phi (and in higher dimensions ∇ϕ\nabla\phi), and possibly the coordinates explicitly. The total Lagrangian is L=∫L d3xL=\int \mathcal{L}\,\mathrm{d}^3x, and the action is the spacetime integral S=∫L d3x dtS=\int \mathcal{L}\,\mathrm{d}^3x\,\mathrm{d}t. The appearance of spatial gradients in L\mathcal{L} is the new ingredient: it encodes the coupling between neighbouring field values, which in the discrete picture came from springs linking adjacent masses. Requiring the action to be stationary under variations that vanish on the boundary produces the field Euler–Lagrange equations — partial differential equations rather than ordinary ones. The price of treating space and time symmetrically is PDEs; the reward is a single variational framework that handles waves, elastic media, and ultimately relativistic fields. Historically and pedagogically, the continuum Lagrangian is best understood as the limit of a discrete chain — the loaded string — which makes manifest that L\mathcal{L} is a true density and that the gradient term descends from spring stretching energy.

Key takeaways
  • For a system with infinitely many degrees of freedom — a field ϕ(x,t)\phi(x,t) — the discrete Lagrangian L=∑iLiL=\sum_i L_i becomes a spatial integral of a Lagrangian density L\mathcal{L}, and the action is S=∫L dx dtS=\int \mathcal{L}\, \mathrm{d}x\, \mathrm{d}t.
  • The density L(ϕ,∂tϕ,∂xϕ,x,t)\mathcal{L}(\phi,\partial_t\phi,\partial_x\phi,x,t) depends not only on the field and its time derivative but also on its spatial gradients, treating space and time on a more even footing.
  • Hamilton's principle δS=0\delta S=0, applied to the field, yields the field Euler–Lagrange equations — partial differential equations governing ϕ\phi.
  • The canonical example is the stretched string, whose density L=12μϕ˙2−12Tϕ′2\mathcal{L}=\tfrac12\mu\dot\phi^2-\tfrac12 T\phi'^2 produces the one-dimensional wave equation with c=T/μc=\sqrt{T/\mu}.
  • The formalism arises rigorously as the continuum limit of a discrete loaded string and generalizes naturally to relativistic field theory, where L\mathcal{L} is a Lorentz scalar built from four-vectors.
  • Symmetries of L\mathcal{L} give conservation laws (Noether), and a Legendre transform of L\mathcal{L} defines the Hamiltonian density and canonical field momentum.
  • Key idea: Replace the discrete index by a continuous coordinate: qi(t)→ϕ(x,t)q_i(t)\to\phi(x,t), ∑i→∫dx\sum_i\to\int\mathrm{d}x, L→∫L dxL\to\int\mathcal{L}\,\mathrm{d}x. The Lagrangian density depends on the field, its time derivative, AND its spatial gradient — the gradient term being the continuum residue of nearest-neighbour coupling — and Hamilton's principle δS=0\delta S=0 becomes a field PDE.

Where this lives today

The single most computationally intensive use of a Lagrangian density in 2026 is lattice quantum chromodynamics: to compute hadron masses from first principles, the QCD action S=∫L d4xS=\int\mathcal{L}\,\mathrm{d}^4x is discretized on a spacetime grid — deliberately running Derivation B in reverse — and sampled on exascale machines. The continuum limit a→0a\to0 that this article performs analytically for a string is performed numerically there, with the same anxieties about what must be held fixed as the spacing shrinks. Meanwhile, effective field theory has turned the Lagrangian density into an organizing principle for ignorance: gravitational-wave groups match LIGO–Virgo signals against post-Newtonian actions, and machine-learning groups now fit symbolic Lagrangian densities directly to field data, with the fitted L\mathcal{L} as the interpretable output. For the student the density is the gateway object: everything in this chapter — the wave equation, Hamiltonian field theory, elasticity — and everything beyond it in the action-principle-to-QFT capstone is a choice of L\mathcal{L} fed through the same Euler–Lagrange crank.

The physical picture

Picture a chain of beads connected by springs. Each bead is a degree of freedom with its own kinetic energy, coupled to its neighbours by spring potential energy that depends on the DIFFERENCE of adjacent displacements. As you pack the beads infinitely densely, the difference becomes a derivative ∂xϕ\partial_x\phi, the sum becomes an integral, and the per-bead Lagrangian becomes a per-length density. The spatial gradient in L\mathcal{L} is literally the memory of those springs. This is not an analogy: the companion article on the loaded string performs the limit line by line, and everything below is its payoff.

Figure
From beads to a field — the discrete chain's sum over masses becomes an integral over a Lagrangian density, and the spring stretching between neighbours becomes the gradient term
Discrete chain q(i-1) q(i) q(i+1) spacing a springs store energy in differences q(i+1) - q(i) a → 0 Continuum field φ(x,t) 𝓛 dx Σ 𝓛(i) a → ∫ 𝓛 dx (q(i+1) - q(i))/a → ∂φ/∂x Dictionary: index i → label x · coordinate q(i,t) → field φ(x,t) · spring energy → gradient term

Think of L dx dt\mathcal{L}\,\mathrm{d}x\,\mathrm{d}t as the elementary contribution to the action from a tiny spacetime cell. Stationarity of the total action means the field arranges itself so that, locally, no infinitesimal wiggle changes SS to first order — this local condition, integrated over the cell with the boundary terms thrown away, IS the field equation. Field theory is Hamilton's principle democratized over space: every cell votes, and the equation of motion is the unanimous verdict.

Figure
The action as a sum over spacetime cells — a variation of the field wiggles the interior but is pinned to zero on the boundary, so only the bulk Euler-Lagrange combination survives
x t spacetime region Ω, boundary: δφ = 0 𝓛 dx dt φ φ + δφ S = ∫∫ 𝓛 dx dt every cell contributes; δS = 0 for all wiggles pinned at the boundary ⇒ bulk condition at every point = field PDE Locality of the action: the field equation is the per-cell stationarity condition

The formalism puts ∂tϕ\partial_t\phi and ∂xϕ\partial_x\phi on a similar footing inside L\mathcal{L}, which is why it is the natural language for waves and for relativity: a Lorentz boost mixes space and time derivatives, and a density that is a scalar function of ∂μϕ\partial_\mu\phi is automatically frame-independent.

The core equations

Everything in the continuum formalism flows from a single functional. Where particle mechanics integrates L(q,q˙)L(q,\dot q) over time alone, field mechanics assigns an action contribution to every spacetime cell, so the action becomes a double (in 3D, quadruple) integral. This is the master object; every equation below is extracted from it.

S=∫t1t2 ⁣ ⁣∫L(ϕ,∂tϕ,∇ϕ,x,t) d3x dt(1)S=\int_{t_1}^{t_2}\!\!\int \mathcal{L}\big(\phi,\partial_t\phi,\nabla\phi,x,t\big)\,\mathrm{d}^3x\,\mathrm{d}t \qquad (1)

where: SS — action functional of the field configuration; L\mathcal{L} — Lagrangian density (energy per unit volume in 3D, per unit length in 1D); ϕ\phi — the field, the value of the dynamical variable at each spacetime point; ∂tϕ\partial_t\phi — time derivative of the field (analogue of q˙\dot q); ∇ϕ\nabla\phi — spatial gradient of the field (new compared to particle mechanics). Note that xx and tt enter as integration labels, not as dynamical variables — the field ϕ\phi is the only thing that gets varied. The translation between the discrete and continuum descriptions is a strict dictionary, established term by term in the loaded-string article. Keeping it in view prevents the most common conceptual error — treating xx as a coordinate to be varied.

L(t)=∫L d3x,qi(t)→ϕ(x,t),∑i→∫dx(2)L(t)=\int \mathcal{L}\,\mathrm{d}^3x,\qquad q_i(t)\to\phi(x,t),\quad \sum_i\to\int\mathrm{d}x \qquad (2)

where: L(t)L(t) — the ordinary Lagrangian, recovered by integrating the density over space at fixed time; qiq_i — discrete generalized coordinate, replaced by the field; xx — continuous label that replaces the discrete index ii. The ordinary Lagrangian still exists at every instant; the density is simply its local bookkeeping. Demanding δS=0\delta S=0 for all variations that vanish on the boundary yields the central dynamical statement of the whole subject — the field Euler–Lagrange equation. Compared with the particle version (owned by the Euler–Lagrange article at finite degrees of freedom, which this equation generalizes), one new term appears: the divergence of the derivative of L\mathcal{L} with respect to the gradient. It is derived as Derivation A below.

∂∂t∂L∂(∂tϕ)+∇ ⁣⋅ ⁣∂L∂(∇ϕ)−∂L∂ϕ=0(3)\frac{\partial}{\partial t}\frac{\partial\mathcal{L}}{\partial(\partial_t\phi)}+\nabla\!\cdot\!\frac{\partial\mathcal{L}}{\partial(\nabla\phi)}-\frac{\partial\mathcal{L}}{\partial\phi}=0 \qquad (3)

where: ∂L/∂(∂tϕ)\partial\mathcal{L}/\partial(\partial_t\phi) — canonical momentum density π\pi conjugate to ϕ\phi; ∂L/∂(∇ϕ)\partial\mathcal{L}/\partial(\nabla\phi) — momentum-flux (stress) contribution from the gradient; ∂L/∂ϕ\partial\mathcal{L}/\partial\phi — generalized force density. Read physically: the rate of change of local momentum plus the divergence of the local stress equals the local force — Newton's second law written for a cell of the medium. The prototype density, extracted from the loaded string in Derivation B, is the stretched string. It is worth memorizing because every other classical field density is a decoration of this template: a kinetic term quadratic in ϕ˙\dot\phi minus a stiffness term quadratic in gradients.

Lstring=12 μ ϕ˙2−12 T ϕ′2(4)\mathcal{L}_{\text{string}}=\tfrac12\,\mu\,\dot\phi^2-\tfrac12\,T\,\phi'^2 \qquad (4)

where: μ\mu — mass per unit length; TT — tension; ϕ˙=∂tϕ\dot\phi=\partial_t\phi — transverse velocity; ϕ′=∂xϕ\phi'=\partial_x\phi — local slope; 12Tϕ′2\tfrac12 T\phi'^2 — stretching potential per unit length, valid to quadratic order in the slope. Feeding (4) into (3) takes three lines: ∂L/∂ϕ=0\partial\mathcal{L}/\partial\phi=0, ∂L/∂ϕ˙=μϕ˙\partial\mathcal{L}/\partial\dot\phi=\mu\dot\phi, and ∂L/∂ϕ′=−Tϕ′\partial\mathcal{L}/\partial\phi'=-T\phi', so the field equation reads ∂t(μϕ˙)−∂x(Tϕ′)=0\partial_t(\mu\dot\phi)-\partial_x(T\phi')=0. For constant μ\mu and TT this is the one-dimensional wave equation — the full solution theory lives in the companion wave-equation article.

μ ϕ¨−T ϕ′′=0  ⟹  ∂t2ϕ=c2∂x2ϕ,c=T/μ(5)\mu\,\ddot\phi-T\,\phi''=0\;\Longrightarrow\; \partial_t^2\phi=c^2\partial_x^2\phi,\quad c=\sqrt{T/\mu} \qquad (5)

where: cc — wave speed on the string; ϕ′′=∂x2ϕ\phi''=\partial_x^2\phi — curvature of the string profile. Stiffer (larger TT) means faster; heavier (larger μ\mu) means slower — the template scaling for every restoring-force-over-inertia wave speed in physics. The formalism does not stop at equations of motion. A Legendre transform of the density — the field version of the passage from LL to HH at finite degrees of freedom — defines the canonical momentum density and the Hamiltonian density, whose conservation is proved in Derivation C. The full canonical field theory built on these objects is the subject of the Hamiltonian-density article; here we need only the definitions.

π(x,t)=∂L∂(∂tϕ),H=π ∂tϕ−L(6)\pi(x,t)=\frac{\partial\mathcal{L}}{\partial(\partial_t\phi)},\qquad \mathcal{H}=\pi\,\partial_t\phi-\mathcal{L} \qquad (6)

where: π\pi — canonical momentum density conjugate to the field (kg/(m⋅s)\text{kg}/(\text{m}\cdot\text{s}) times displacement units in 1D — a density, not a momentum); H\mathcal{H} — Hamiltonian (energy) density obtained by the Legendre transform. For the string, π=μϕ˙\pi=\mu\dot\phi and H=12μϕ˙2+12Tϕ′2\mathcal{H}=\tfrac12\mu\dot\phi^2+\tfrac12 T\phi'^2 — the sum, not the difference, of kinetic and potential densities. Finally, the payoff that motivates the whole construction: if L\mathcal{L} is built as a Lorentz scalar from the four-gradient, the action is frame-independent because the measure d4x\mathrm{d}^4x is too. This is the doorway from mechanics to relativistic field theory, walked through in the action-principle-to-QFT capstone.

L=12 ∂μϕ ∂μϕ−V(ϕ),∂μϕ ∂μϕ=1c2ϕ˙2−(∇ϕ)2(7)\mathcal{L}=\tfrac12\,\partial_\mu\phi\,\partial^\mu\phi-V(\phi),\qquad \partial_\mu\phi\,\partial^\mu\phi=\tfrac1{c^2}\dot\phi^2-(\nabla\phi)^2 \qquad (7)

where: ∂μ\partial_\mu — four-gradient (1c∂t,∇)(\tfrac1c\partial_t,\nabla); ∂μ\partial^\mu — contravariant four-gradient (1c∂t,−∇)(\tfrac1c\partial_t,-\nabla) with metric (+,−,−,−)(+,-,-,-); V(ϕ)V(\phi) — scalar potential, e.g. 12m2ϕ2\tfrac12 m^2\phi^2 giving the Klein–Gordon equation. The string density (4) is the 1+11{+}1-dimensional, V=0V=0 shadow of this structure.

Which equation when:

You wantUseBecause
Equation of motion for a given medium(3) with the medium's L\mathcal{L}The field EL equation is the universal crank
To construct L\mathcal{L} from a microscopic modelContinuum limit, Derivation BDensities inherit their meaning from the discrete chain
Energy bookkeeping, canonical structure(6), then Derivation CLegendre transform hands you H\mathcal{H} and π\pi
A relativistic or frame-independent theory(7)Scalar L\mathcal{L} + invariant measure = invariant action
Derivation AField Euler-Lagrange equation from Hamilton's principle

We derive the field equation (3) by demanding that the action (1) be stationary under an arbitrary infinitesimal deformation of the field. The strategy mirrors the finite-dimensional proof in the Euler–Lagrange article — vary, integrate by parts, invoke arbitrariness of the variation — but with two integration-by-parts moves instead of one, because L\mathcal{L} now depends on spatial gradients as well as the time derivative. The step to watch is the disposal of boundary terms: the variation must vanish on the entire boundary of the spacetime region, both at the initial and final times AND at the spatial edges.

Step 1. Deform the field by ϕ→ϕ+δϕ\phi\to\phi+\delta\phi with δϕ=0\delta\phi=0 on the boundary of the integration region, and expand the density to first order:

δS=∫ ⁣[∂L∂ϕδϕ+∂L∂(∂tϕ)δ(∂tϕ)+∂L∂(∇ϕ) ⁣⋅ ⁣δ(∇ϕ)]d3x dt\delta S=\int\!\Big[\frac{\partial\mathcal{L}}{\partial\phi}\delta\phi+\frac{\partial\mathcal{L}}{\partial(\partial_t\phi)}\delta(\partial_t\phi)+\frac{\partial\mathcal{L}}{\partial(\nabla\phi)}\!\cdot\!\delta(\nabla\phi)\Big]\mathrm{d}^3x\,\mathrm{d}t

Why: L\mathcal{L} is an ordinary function of its slots (ϕ,∂tϕ,∇ϕ)(\phi,\partial_t\phi,\nabla\phi); the chain rule distributes the variation across all three dependences.

Step 2. Commute variation and differentiation:

δ(∂tϕ)=∂t(δϕ),δ(∇ϕ)=∇(δϕ)\delta(\partial_t\phi)=\partial_t(\delta\phi),\qquad \delta(\nabla\phi)=\nabla(\delta\phi)

Why: δϕ\delta\phi is a difference of two field configurations evaluated at the SAME spacetime point, so derivatives with respect to the labels x,tx,t pass through it freely.

Step 3. Integrate the second term by parts in tt and the third term by parts in xx (divergence theorem in 3D). The boundary contributions are [π δϕ]t1t2\big[\pi\,\delta\phi\big]_{t_1}^{t_2} and the flux of δϕ ∂L/∂(∇ϕ)\delta\phi\,\partial\mathcal{L}/\partial(\nabla\phi) through the spatial boundary; both vanish because δϕ=0\delta\phi=0 there. What survives is

δS=∫ ⁣[∂L∂ϕ−∂t∂L∂(∂tϕ)−∇ ⁣⋅ ⁣∂L∂(∇ϕ)]δϕ d3x dt\delta S=\int\!\Big[\frac{\partial\mathcal{L}}{\partial\phi}-\partial_t\frac{\partial\mathcal{L}}{\partial(\partial_t\phi)}-\nabla\!\cdot\!\frac{\partial\mathcal{L}}{\partial(\nabla\phi)}\Big]\delta\phi\,\mathrm{d}^3x\,\mathrm{d}t

Why: integration by parts moves the derivative off δϕ\delta\phi and onto the conjugate quantity at the cost of a sign — exactly the manoeuvre of the particle case, done once per independent variable.

Step 4. The deformation δϕ(x,t)\delta\phi(x,t) is arbitrary in the interior. A vanishing integral against an arbitrary function forces the bracket to vanish pointwise:

∂t∂L∂(∂tϕ)+∇ ⁣⋅ ⁣∂L∂(∇ϕ)−∂L∂ϕ=0\partial_t\frac{\partial\mathcal{L}}{\partial(\partial_t\phi)}+\nabla\!\cdot\!\frac{\partial\mathcal{L}}{\partial(\nabla\phi)}-\frac{\partial\mathcal{L}}{\partial\phi}=0

Why: choose δϕ\delta\phi to be a sharply localized bump at any point; the integral then samples the bracket there, so the bracket must vanish everywhere — the fundamental lemma of the calculus of variations, upgraded to spacetime. *Two quick checks confirm the result: setting the ∇ϕ\nabla\phi-dependence to zero collapses equation (3) to the familiar particle Euler–Lagrange equation, and applying it to the string density (4) reproduces the wave equation (5).*

Go deeper · Derivation B · 1 minContinuum limit of the loaded string defines the Lagrangian density
Derivation BContinuum limit of the loaded string defines the Lagrangian density

We take NN equal masses on a taut chain, write the discrete Lagrangian, and let the spacing a→0a\to0 to obtain the density L\mathcal{L}. The strategy is to multiply and divide by the spacing until the sum looks like a Riemann sum, then hold the macroscopic quantities — mass per length μ=m/a\mu=m/a and tension T=kaT=ka — fixed as mm and aa vanish together. The trap to avoid: sending m→0m\to0 at fixed aa (or vice versa) destroys the physics, because the wave speed T/μ\sqrt{T/\mu} would diverge or vanish.

Step 1. Write the discrete Lagrangian for masses mm at nodes xi=iax_i=ia with nearest-neighbour spring constant k=T/ak=T/a:

L=∑i[12m q˙i2−12k (qi+1−qi)2]L=\sum_i\Big[\tfrac12 m\,\dot q_i^2-\tfrac12 k\,(q_{i+1}-q_i)^2\Big]

Why: kinetic energy of each mass minus the spring energy stored in stretching between neighbours — the standard coupled-oscillator Lagrangian from the normal-modes chapter.

Step 2. Multiply and divide by aa to expose the densities:

L=∑ia[12maq˙i2−12 (ak)(qi+1−qia)2]L=\sum_i a\Big[\tfrac12\frac{m}{a}\dot q_i^2-\tfrac12\,(a k)\Big(\frac{q_{i+1}-q_i}{a}\Big)^2\Big]

Why: m/a=μm/a=\mu is finite mass per length and ak=a⋅(T/a)=Tak=a\cdot(T/a)=T is the tension; the difference quotient is engineered to become a derivative.

Step 3. Take a→0a\to0 at fixed μ\mu and TT:

∑ia→∫dx,qi(t)→ϕ(x,t),qi+1−qia→∂xϕ\sum_i a\to\int\mathrm{d}x,\qquad q_i(t)\to\phi(x,t),\qquad \frac{q_{i+1}-q_i}{a}\to\partial_x\phi

Why: the sum over cells of width aa is a Riemann sum for the spatial integral; the label ii merges into the continuous label xx.

Step 4. Read off the density:

L=∫(12μ ϕ˙2−12T ϕ′2)dx  ≡  ∫L dxL=\int\Big(\tfrac12\mu\,\dot\phi^2-\tfrac12 T\,\phi'^2\Big)\mathrm{d}x\;\equiv\;\int\mathcal{L}\,\mathrm{d}x

Why: the gradient term is the direct descendant of the spring energy — nearest-neighbour coupling has become a local penalty on slope. *Dimensional check: μϕ˙2\mu\dot\phi^2 carries units (kg/m)(m/s)² = J/m, and Tϕ′2T\phi'^2 carries units (N)(dimensionless)² = J/m; both terms are energy per unit length, confirming that L\mathcal{L} is a genuine 1D density.*

Go deeper · Derivation C · 1 minEnergy density by Legendre transform and its local conservation
Derivation CEnergy density by Legendre transform and its local conservation

We define the canonical momentum density and Hamiltonian density for the string and show that energy is conserved locally — not just globally — obeying a continuity equation with an identifiable energy flux. The strategy is the field version of H=pq˙−LH=p\dot q-L: Legendre-transform the density, then differentiate along solutions and use the equation of motion to reorganize the result into a total spatial derivative. Watch the sign flip that turns T−VT-V into T+VT+V.

Step 1. Canonical momentum density from the string Lagrangian (4):

π=∂L∂ϕ˙=μϕ˙\pi=\frac{\partial\mathcal{L}}{\partial\dot\phi}=\mu\dot\phi

Why: only the kinetic term contains ϕ˙\dot\phi; the field momentum density is mass density times transverse velocity, exactly the discrete pi=mq˙ip_i=m\dot q_i per unit length.

Step 2. Legendre transform:

H=πϕ˙−L=μϕ˙2−(12μϕ˙2−12Tϕ′2)=12μϕ˙2+12Tϕ′2\mathcal{H}=\pi\dot\phi-\mathcal{L}=\mu\dot\phi^2-\Big(\tfrac12\mu\dot\phi^2-\tfrac12 T\phi'^2\Big)=\tfrac12\mu\dot\phi^2+\tfrac12 T\phi'^2

Why: the transform flips the sign of the potential piece — the Hamiltonian density is the physical energy density, kinetic plus potential.

Step 3. Differentiate along a solution and eliminate ϕ¨\ddot\phi with the wave equation μϕ¨=Tϕ′′\mu\ddot\phi=T\phi'':

∂tH=μϕ˙ϕ¨+Tϕ′ϕ˙′=Tϕ˙ϕ′′+Tϕ′ϕ˙′\partial_t\mathcal{H}=\mu\dot\phi\ddot\phi+T\phi'\dot\phi'=T\dot\phi\phi''+T\phi'\dot\phi'

Why: the equation of motion is the only dynamical input; energy conservation is a consequence of the dynamics, not an independent postulate.

Step 4. Recognize a total spatial derivative:

∂tH=∂x(Tϕ′ϕ˙)  ≡  −∂xSE,SE=−T ϕ′ ϕ˙\partial_t\mathcal{H}=\partial_x\big(T\phi'\dot\phi\big)\;\equiv\;-\partial_x S_E,\qquad S_E=-T\,\phi'\,\dot\phi

Why: Tϕ˙ϕ′′+Tϕ′ϕ˙′T\dot\phi\phi''+T\phi'\dot\phi' is exactly ∂x(Tϕ′ϕ˙)\partial_x(T\phi'\dot\phi) by the product rule; the combination SES_E is the power transmitted along the string — the transverse component of tension, −Tϕ′-T\phi', times the transverse velocity ϕ˙\dot\phi.

Step 5. The continuity equation ∂tH+∂xSE=0\partial_t\mathcal{H}+\partial_x S_E=0 integrates over a closed or clamped string to dE/dt=0\mathrm{d}E/\mathrm{d}t=0: total energy is constant, and locally energy moves at a computable flux. Two checks are worth noting: H\mathcal{H} is positive-definite (a sum of squares), as a physical energy density must be; and the flux SE=−Tϕ′ϕ˙S_E = -T\phi'\dot\phi has units (N)(dimensionless)(m/s) = W, a genuine power. The local conservation law ∂tH+∂xSE=0\partial_t\mathcal{H}+\partial_x S_E=0 is the Noether consequence of time-translation invariance of L\mathcal{L}.

Limiting cases

The continuum density reduces to or connects with familiar structures in several limits:

CaseResultMeaning
Discrete limitL a→Li=12mq˙i2−12k(qi+1−qi)2\mathcal{L}\,a \to L_i=\tfrac12 m\dot q_i^2-\tfrac12 k(q_{i+1}-q_i)^2Reversing the continuum limit (spacing aa, mass m=μam=\mu a, spring k=T/ak=T/a) recovers the loaded-string Lagrangian — the discrete origin.
No gradient couplingL=12μϕ˙2−V(ϕ)\mathcal{L}=\tfrac12\mu\dot\phi^2-V(\phi)If ∂xϕ\partial_x\phi is absent, each point oscillates independently — a continuum of uncoupled oscillators; the EL equation μϕ¨=−V′(ϕ)\mu\ddot\phi=-V'(\phi) has no spatial propagation.
Relativistic scalarL=12 ∂μϕ ∂μϕ−12m2ϕ2\mathcal{L}=\tfrac12\,\partial_\mu\phi\,\partial^\mu\phi-\tfrac12 m^2\phi^2A manifestly Lorentz-scalar density gives the Klein–Gordon equation; the string is its m=0m=0, 1+11{+}1-dimensional cousin.
Static fieldδ ⁣∫L d3x=0,ϕ˙=0\delta\!\int \mathcal{L}\,\mathrm{d}^3x=0,\quad \dot\phi=0For time-independent configurations Hamilton's principle becomes an energy-minimization problem (elastostatics, electrostatics).
Stiff term addedL→L−12κϕ′′2\mathcal{L}\to\mathcal{L}-\tfrac12\kappa\phi''^2Higher spatial derivatives (beam bending) are allowed in L\mathcal{L}; the EL equation then acquires fourth-order terms — see the FAQ.

Worked examples

Example 1 — energy stored in a plucked guitar string (confidence builder). A steel high-E guitar string has length L=0.648 mL=0.648\ \mathrm{m}, linear density μ=5.6×10−4 kg/m\mu=5.6\times10^{-4}\ \mathrm{kg/m}, and is tuned to its fundamental f1=329.6 Hzf_1=329.6\ \mathrm{Hz}. Find the tension, then the total energy when the string vibrates in its fundamental standing mode ϕ(x,t)=Asin⁡(πx/L)cos⁡(ωt)\phi(x,t)=A\sin(\pi x/L)\cos(\omega t) with amplitude A=1.0 mmA=1.0\ \mathrm{mm}.

Step 1. The fundamental of a clamped string satisfies f1=c/2Lf_1=c/2L, so the wave speed is c=2Lf1=2(0.648)(329.6)=427 m/sc=2Lf_1=2(0.648)(329.6)=427\ \mathrm{m/s}.

Step 2. From c=T/μc=\sqrt{T/\mu}, the tension is T=μc2=(5.6×10−4)(427)2=102 NT=\mu c^2=(5.6\times10^{-4})(427)^2=102\ \mathrm{N} — about 10 kg-force, which is why guitar necks need truss rods.

Step 3. The energy density is H=12μϕ˙2+12Tϕ′2\mathcal{H}=\tfrac12\mu\dot\phi^2+\tfrac12 T\phi'^2. Integrate over the string. With ∫0Lsin⁡2(πx/L) dx=∫0Lcos⁡2(πx/L) dx=L/2\int_0^L\sin^2(\pi x/L)\,\mathrm{d}x=\int_0^L\cos^2(\pi x/L)\,\mathrm{d}x=L/2 and T(π/L)2=μω2T(\pi/L)^2=\mu\omega^2 (the dispersion relation), both terms combine to a time-independent total

E=14 μ ω2A2LE=\tfrac14\,\mu\,\omega^2 A^2 L

Step 4. With ω=2πf1=2071 rad/s\omega=2\pi f_1=2071\ \mathrm{rad/s}: E=14(5.6×10−4)(2071)2(10−3)2(0.648)E=\tfrac14(5.6\times10^{-4})(2071)^2(10^{-3})^2(0.648). Compute inside out: (2071)2=4.29×106(2071)^2=4.29\times10^{6}; times μ\mu gives 2.40×1032.40\times10^{3}; times A2=10−6A^2=10^{-6} gives 2.40×10−32.40\times10^{-3}; times LL gives 1.56×10−31.56\times10^{-3}; divided by 4:

E≈3.9×10−4 JE\approx3.9\times10^{-4}\ \mathrm{J} — under half a millijoule, which is why a guitar needs a resonant body to move audible amounts of air.

Example 2 — dispersion from a modified density (exam level). A string with μ=0.010 kg/m\mu=0.010\ \mathrm{kg/m} and T=100 NT=100\ \mathrm{N} rests on an elastic (Winkler) foundation that pushes back locally, adding a potential density 12σϕ2\tfrac12\sigma\phi^2 with σ=1.0×103 N/m2\sigma=1.0\times10^{3}\ \mathrm{N/m^2}. Find the field equation, the dispersion relation, and the phase and group velocities at k=10 rad/mk=10\ \mathrm{rad/m}.

Step 1. The density is L=12μϕ˙2−12Tϕ′2−12σϕ2\mathcal{L}=\tfrac12\mu\dot\phi^2-\tfrac12 T\phi'^2-\tfrac12\sigma\phi^2. Now ∂L/∂ϕ=−σϕ\partial\mathcal{L}/\partial\phi=-\sigma\phi no longer vanishes, and the EL equation (3) gives

μϕ¨=Tϕ′′−σϕ\mu\ddot\phi=T\phi''-\sigma\phi

Step 2. Insert a plane wave ϕ=Acos⁡(kx−ωt)\phi=A\cos(kx-\omega t): each derivative pulls down a factor, giving −μω2=−Tk2−σ-\mu\omega^2=-Tk^2-\sigma, i.e. the dispersion relation

ω2=c2k2+ω02,c2=T/μ=104 m2/s2,ω02=σ/μ=1.0×105 s−2\omega^2=c^2k^2+\omega_0^2,\qquad c^2=T/\mu=10^4\ \mathrm{m^2/s^2},\quad \omega_0^2=\sigma/\mu=1.0\times10^{5}\ \mathrm{s^{-2}}

This is formally the Klein–Gordon dispersion: the foundation gives the string wave a "mass" and a cutoff frequency ω0=316 rad/s\omega_0=316\ \mathrm{rad/s} below which no travelling wave exists.

Step 3. At k=10 rad/mk=10\ \mathrm{rad/m}: ω2=(104)(100)+105=1.1×106\omega^2=(10^4)(100)+10^5=1.1\times10^{6}, so ω=1049 rad/s\omega=1049\ \mathrm{rad/s}. The phase velocity is vp=ω/k=104.9 m/sv_p=\omega/k=104.9\ \mathrm{m/s} — FASTER than cc.

Step 4. The group velocity is vg=dω/dk=c2k/ω=(104)(10)/1049=95.3 m/sv_g=\mathrm{d}\omega/\mathrm{d}k=c^2k/\omega=(10^4)(10)/1049=95.3\ \mathrm{m/s} — slower than cc.

Check: vp vg=(104.9)(95.3)=1.00×104=c2v_p\,v_g=(104.9)(95.3)=1.00\times10^{4}=c^2 exactly, the signature identity of Klein–Gordon-type dispersion. The medium is dispersive: energy travels at 95 m/s95\ \mathrm{m/s} while crests travel at 105 m/s105\ \mathrm{m/s}.

Origins · 1 minJoseph-Louis Lagrange and how this was discovered
JL
Joseph-Louis Lagrange
1736–1813 · Turin, Berlin and Paris

Lagrange met the continuum through the discrete: his 1759 analysis of a weighted string solved the NN-body chain exactly and watched the solution survive the passage N→∞N\to\infty — the template this article still follows. Three decades later the Mécanique analytique rebuilt all of mechanics on the variational principle without a single diagram, boasting "no figures will be found in this work." That austerity was the point: once dynamics is an integral to be made stationary, the same machinery serves a bead, a chain, or a continuous medium — one only swaps the sum for an integral. The Lagrangian density that now underwrites everything from elasticity to the Standard Model carries his name because he built the mould into which every later field theory was poured.

History
1759
— Lagrange solves the discrete weighted string and passes to the continuum, defusing the d'Alembert–Euler–Bernoulli dispute over vibrating strings
1788
— Mécanique analytique founds mechanics on the variational principle, the framework that scales to infinitely many degrees of freedom
1867
— Thomson and Tait's Treatise on Natural Philosophy systematizes continuum energy methods for elastic media
1873
— Maxwell's Treatise casts electromagnetism in energy-and-potential form, the raw material for its later Lagrangian formulation
1915
— Hilbert derives Einstein's field equations from an action, confirming the Lagrangian density as the universal language of fundamental physics

Going further

References. Goldstein, Poole & Safko, Classical Mechanics 3rd ed., Ch. 13 (The Classical Field Theory) · Landau & Lifshitz, Mechanics Vol. 1, 3rd ed., §23 (oscillations of systems with more than one degree of freedom — the discrete precursor to the continuum limit; L&L treat field Lagrangians in later volumes) · Morin, Introduction to Classical Mechanics, Ch. on coupled oscillators and the continuum string · Taylor, Classical Mechanics, Ch. 16 (Continuum Mechanics) Three internal consistency checks underpin this article: (1) each term in L\mathcal{L} is energy per unit length — μϕ˙2\mu\dot\phi^2 and Tϕ′2T\phi'^2 both carry units J/m; (2) the Legendre transform yields H=12μϕ˙2+12Tϕ′2\mathcal{H}=\tfrac12\mu\dot\phi^2+\tfrac12 T\phi'^2 together with the local energy continuity equation; (3) the relativistic density 12∂μϕ ∂μϕ−12m2ϕ2\tfrac12\partial_\mu\phi\,\partial^\mu\phi-\tfrac12 m^2\phi^2 produces the Klein–Gordon equation when fed through the field Euler–Lagrange equation (3). No empirical constants are quoted; all relations are standard.

Builds on: Discrete Loaded String and the Continuum Limit · Euler–Lagrange Equations for Fields · Normal Modes and Standing Waves on a String Leads to: The One-Dimensional Wave Equation · Hamiltonian Density and Canonical Field Momentum · Elastic Waves in Solids · Four-Vectors and Minkowski Spacetime

Why am I allowed to treat the field, its time derivative, and its gradient as independent arguments of the density when they are obviously related?

For the same reason qq and q˙\dot q are treated as independent slots of L(q,q˙)L(q,\dot q): the density is a function whose arguments only get filled with a specific ϕ(x,t)\phi(x,t) and its derivatives after the variation is done. When you vary the action, you deform the whole configuration ϕ→ϕ+δϕ\phi\to\phi+\delta\phi, and the variations of the slots are then not independent — they are linked by δ(∂ϕ)=∂(δϕ)\delta(\partial\phi)=\partial(\delta\phi), which is exactly what Steps 2–3 of Derivation A use. Independence of slots is a statement about the function L\mathcal{L}, not about the physics of any particular solution.

Is the canonical momentum density actually a momentum? Its units look wrong.

It is not the mechanical momentum of anything, and for the transverse string it is not even directed along the string. π=∂L/∂ϕ˙=μϕ˙\pi=\partial\mathcal{L}/\partial\dot\phi=\mu\dot\phi has units of momentum per unit length (kg/s in 1D, since ϕ\phi carries metres), and it is conjugate to the field value, not to a particle position. The mechanical momentum carried by a wave along the propagation direction is a different object, built from the stress tensor. Confusing the two is a classic exam trap; the Hamiltonian-density article draws the distinction carefully.

Where exactly did the boundary terms go in the derivation, and what happens on an infinite domain?

Two boundary terms appear: a temporal one, [π δϕ]t1t2[\pi\,\delta\phi]_{t_1}^{t_2}, killed by the standard variational convention that the configuration is pinned at the initial and final instants, and a spatial one — the flux of δϕ ∂L/∂(∇ϕ)\delta\phi\,\partial\mathcal{L}/\partial(\nabla\phi) through the region's edge — killed either by clamped ends (δϕ=0\delta\phi=0 there) or, on an infinite domain, by requiring fields to decay fast enough at infinity. On domains with free ends, that spatial term does not vanish automatically; demanding it vanish for arbitrary boundary δϕ\delta\phi yields the natural boundary condition ϕ′=0\phi'=0 — the free-end condition of the standing-waves article. Boundary terms are physics, not debris.

Is the Lagrangian density unique for a given physical system?

No. Adding a total derivative ∂tF+∂xG\partial_t F+\partial_x G (a four-divergence in covariant language) to L\mathcal{L} changes the action only by boundary contributions, which the variation never sees, so the field equations are unchanged. Densities related this way are physically equivalent even though π\pi and H\mathcal{H} can look different at intermediate stages. This freedom is used constantly — to make symmetries manifest, to move derivatives around, and in gauge theories where no single "natural" L\mathcal{L} exists.

Do I need relativity for any of this? My course introduced Lagrangian densities together with four-vectors.

No — the string density is Galilean, and elasticity, acoustics, and shallow-water theory all run on non-relativistic Lagrangian densities. Relativity enters only when you choose L\mathcal{L} to be a Lorentz scalar, as in equation (7); the formalism itself is indifferent. The reason courses couple the two is strategic: the field EL equation is the one classical structure that survives verbatim into relativistic QFT, so it is taught as the on-ramp. That on-ramp is the action-principle-to-QFT article.

What if the density depends on second derivatives, like the curvature of a beam?

Then the Euler–Lagrange machinery extends: varying ∫L(ϕ,ϕ˙,ϕ′,ϕ′′)\int\mathcal{L}(\phi,\dot\phi,\phi',\phi'') requires integrating by parts twice on the ϕ′′\phi'' slot, producing a term +∂x2[∂L/∂ϕ′′]+\partial_x^2[\partial\mathcal{L}/\partial\phi''] in the field equation and a fourth-order PDE. The Euler–Bernoulli beam, with bending energy 12κϕ′′2\tfrac12\kappa\phi''^2, yields μϕ¨=−κϕ′′′′\mu\ddot\phi=-\kappa\phi'''' — dispersive, unlike the string. In fundamental physics, higher time derivatives are avoided (they generically produce Ostrogradsky instabilities), but higher spatial derivatives in effective descriptions are routine.

How does the functional derivative notation relate to the Euler-Lagrange combination?

The functional derivative δL/δϕ(x)\delta L/\delta\phi(x) measures the change of L=∫L dxL=\int\mathcal{L}\,\mathrm{d}x per unit change of the field at the single point xx. Carrying out the same integration by parts as Derivation A shows δL/δϕ=∂L/∂ϕ−∂x[∂L/∂(∂xϕ)]\delta L/\delta\phi=\partial\mathcal{L}/\partial\phi-\partial_x[\partial\mathcal{L}/\partial(\partial_x\phi)], so the field equation is compactly ∂t(δL/δϕ˙)=δL/δϕ\partial_t(\delta L/\delta\dot\phi)=\delta L/\delta\phi — Lagrange's equation with straight ∂\partial replaced by curly δ\delta. The continuum formalism is the finite-dimensional one with a better index set.

Why is the potential energy of the string quadratic in the slope rather than proportional to the actual stretching?

The exact stretching of an element is dℓ−dx=(1+ϕ′2−1) dx≈12ϕ′2 dx\mathrm{d}\ell-\mathrm{d}x=(\sqrt{1+\phi'^2}-1)\,\mathrm{d}x\approx\tfrac12\phi'^2\,\mathrm{d}x for small slopes, and tension times stretch gives 12Tϕ′2\tfrac12 T\phi'^2 per unit length. The quadratic form is thus the leading term of an expansion, valid when ∣ϕ′∣≪1|\phi'|\ll1. Keeping the full square root gives a nonlinear field theory whose small-amplitude limit returns the wave equation — one reason the Lagrangian route is preferred: approximating one scalar function L\mathcal{L} once is cleaner than approximating forces in three places.

Before this

Where this leads