The book / chapter 13
CHAPTER 13

Variations and stationary action

Ordinary derivatives compare nearby numbers. Variations compare nearby functions.

1 worked example in this chapter
Before you begin
THE QUESTION

How do we differentiate an action with respect to a path or a field?

BRING WITH YOU

By the end: Derive Euler–Lagrange equations and vary inverse metrics and determinants.

An equation of motion tells you how a system evolves. An action assigns a number to an entire candidate history. The physical history makes that number stationary under appropriate small changes.

Chapter 5 varied a particle’s path in a fixed metric. We now extend that procedure to matter fields and then to the metric itself. The position of a particle, the value of a field, and the geometry can each be varied independently when deriving their equations.

13.1 From an ordinary derivative to a variation#

For an ordinary function f(x)f(x), a stationary point satisfies df/dx=0df/dx=0. Change xx by a small amount, and the first-order change in ff vanishes.

For mechanics, consider a candidate trajectory q(t)q(t) and its action

S[q]=t1t2L(q,q˙,t)dt.S[q]=\int_{t_1}^{t_2}L(q,\dot q,t)\,dt.

The input of the functional S[q]S[q] is the whole path q(t)q(t); its output is one number. To differentiate it, introduce a one-parameter family of nearby histories,

qλ(t)=q(t)+λη(t),η(t1)=η(t2)=0.q_\lambda(t)=q(t)+\lambda\eta(t), \qquad \eta(t_1)=\eta(t_2)=0.

The function η(t)\eta(t) specifies a proposed displacement at each time, and the dimensionless parameter λ\lambda controls its size. The displacement has the same units as qq. Define

δS=ddλS[qλ]λ=0.\delta S=\left.\frac{d}{d\lambda}S[q_\lambda]\right|_{\lambda=0}.

The endpoints are held fixed because we are comparing histories connecting the same endpoint data. Other physical questions can require other boundary conditions; they must be specified rather than guessed.

Differentiate inside the integral using the chain rule:

δS=t1t2(Lqη+Lq˙η˙)dt.\delta S=\int_{t_1}^{t_2} \left(\frac{\partial L}{\partial q}\eta +\frac{\partial L}{\partial\dot q}\dot\eta\right)dt.

To extract an equation for q(t)q(t), collect terms proportional to the allowed displacement η\eta. Integration by parts transfers the derivative from η˙\dot\eta to its coefficient:

δS=[Lq˙η]t1t2+t1t2[LqddtLq˙]ηdt.\delta S= \left[\frac{\partial L}{\partial\dot q}\eta\right]_{t_1}^{t_2} +\int_{t_1}^{t_2} \left[ \frac{\partial L}{\partial q} -\frac{d}{dt}\frac{\partial L}{\partial\dot q} \right]\eta\,dt.

The boundary term vanishes by the endpoint condition. Since η\eta can be chosen to have support in any small interior interval, the coefficient must vanish pointwise:

ddtLq˙Lq=0.\boxed{ \frac{d}{dt}\frac{\partial L}{\partial\dot q} -\frac{\partial L}{\partial q}=0. }

That last inference is the fundamental lemma of the calculus of variations. If a continuous coefficient were positive somewhere, we could choose a smooth positive displacement that vanishes outside that small region. The integral would then be positive. A negative coefficient can be excluded in the same way. Stationarity for every allowed displacement therefore requires the coefficient to vanish at each interior time.

For L=12mq˙2V(q)L=\frac12m\dot q^2-V(q), the result is

mq¨=V(q).m\ddot q=-V'(q).

Newton’s equation has emerged from a statement about a complete history.

A derivative of whole pathsThree curves share fixed initial and final positions; a smooth variation changes their interiors. A variation is a mathematical comparison with nearby candidate histories. The physical stationary path is found by requiring the first action change to vanish for every allowed variation.20 / A DERIVATIVE OF WHOLE PATHStimepositionVary the route, not its endpointsThe varied paths need not obey the motion law.
20 /
A derivative of whole paths. A variation is a mathematical comparison with nearby candidate histories. The physical stationary path is found by requiring the first action change to vanish for every allowed variation.
WORKED EXAMPLE

Say what is allowed to move

Why is a boundary condition part of a variational problem, rather than a footnote?

See the idea

To ask whether a quantity is stationary, first say which changes are allowed. The lowest point in a room and the lowest point on a particular staircase answer different questions. A variation of a path is a small change of the whole function, with specified restrictions at its endpoints.

Work it out
  1. Perturb an entire path

    For S[x]=t0t1(mx˙2/2U(x))dtS[x]=\int_{t_0}^{t_1}(m\dot x^2/2-U(x))dt, consider xϵ=x+ϵηx_\epsilon=x+\epsilon\eta. Here η(t)\eta(t) is any smooth allowed displacement and δS\delta S means dS[xϵ]/dϵdS[x_\epsilon]/d\epsilon at zero. Differentiate the integrand and integrate the kinetic term by parts.

    δS=[mx˙η]t0t1t0t1(mx¨+U(x))ηdt.\delta S=[m\dot x\eta]_{t_0}^{t_1}-\int_{t_0}^{t_1}(m\ddot x+U'(x))\eta\,dt.

    Why this step works Integration by parts separates a bulk equation from the endpoint contribution.

  2. Impose the fixed endpoint values

    If both endpoint positions are fixed, η(t0)=η(t1)=0\eta(t_0)=\eta(t_1)=0. Arbitrary interior variations then require mx¨+U=0m\ddot x+U'=0. If an endpoint position is free, its variation need not vanish: the boundary term gives a separate condition.

    η(t0)=η(t1)=0⇏η˙(t0)=η˙(t1)=0.\eta(t_0)=\eta(t_1)=0\quad\not\Rightarrow\quad\dot\eta(t_0)=\dot\eta(t_1)=0.

    Why this step works A function can vanish at an endpoint while its derivative there is nonzero.

  3. Constrain a variation geometrically

    To make f(x,y)=x+yf(x,y)=x+y stationary on the unit circle, allowed displacements satisfy xδx+yδy=0x\delta x+y\delta y=0. Thus f\nabla f must be parallel to the normal (x,y)(x,y). Introduce a multiplier λ\lambda and solve [fλ(x2+y21)]=0\nabla[f-\lambda(x^2+y^2-1)]=0 together with the constraint.

    1=2λx,1=2λy,x2+y2=1.1=2\lambda x,\qquad1=2\lambda y,\qquad x^2+y^2=1.

    Why this step works The multiplier enforces stationarity only along the permitted tangent directions.

Go deeper

The constrained example gives x=y=±1/2x=y=\pm1/\sqrt2, with maximum and minimum values ±2\pm\sqrt2. Stationary does not select the minimum automatically. A boundary term added to an action can change the admissible boundary problem without changing its bulk Euler–Lagrange equation. This becomes essential for the Einstein–Hilbert action, whose variation contains derivatives of the metric variation. Fixing the metric at the boundary alone does not set those derivatives to zero. Chapter 14 develops the required geometric boundary term.

Test the idea

FIRST, PREDICT

A variation satisfies η(0)=η(1)=0\eta(0)=\eta(1)=0. Must η(0)\eta'(0) vanish?

Compare the reasoning

Yes, because the endpoint is fixed.

Fixing a function value does not also fix its slope.

Only if the action is gravitational.

This is already a statement about ordinary differentiable functions.

No: η=t(1t)\eta=t(1-t) is a counterexample.

This function vanishes at both endpoints and has derivative 1 at zero.

A hint

Try the simplest polynomial with zeros at both endpoints.

NOW CHANGE THE EXAMPLE

For L=mx˙2/2kx2/2L=m\dot x^2/2-kx^2/2, take m=2kgm=2\,\mathrm{kg}, k=8N/mk=8\,\mathrm{N/m} and x=3mx=3\,\mathrm m. Find x¨\ddot x.

A hint

The Euler–Lagrange equation is mx¨+kx=0m\ddot x+kx=0.

Work through the solution

x¨=(8/2)3=12m/s2\ddot x=-(8/2)3=-12\,\mathrm{m/s^2}.

Stationarity means no first-order change along the allowed variations; the allowed variations are part of the problem.

13.2 Stationary does not mean minimal#

An action principle is often called a principle of “least action,” but its defining condition is stationarity. A stationary value can be a minimum, a maximum, or a saddle. The variation above only tests the first-order change.

For a harmonic oscillator, L=12mq˙212mω2q2L=\frac12m\dot q^2-\frac12m\omega^2q^2. About a solution, the quadratic change in action is

ΔS=mλ22t1t2(η˙2ω2η2)dt.\Delta S=\frac{m\lambda^2}{2} \int_{t_1}^{t_2}(\dot\eta^2-\omega^2\eta^2)\,dt.

Let T=t2t1T=t_2-t_1 and choose η=Asin[π(tt1)/T]\eta=A\sin[\pi(t-t_1)/T], where AA has the same units as qq. This displacement vanishes at both endpoints. The integrals of sine squared and cosine squared are each T/2T/2, so

ΔS=mλ2A2T4(π2T2ω2).\Delta S=\frac{m\lambda^2A^2T}{4} \left(\frac{\pi^2}{T^2}-\omega^2\right).

For a sufficiently long interval, this variation decreases the action. Choosing η=Asin[kπ(tt1)/T]\eta=A\sin[k\pi(t-t_1)/T] with a sufficiently large positive integer kk replaces π2/T2\pi^2/T^2 by k2π2/T2k^2\pi^2/T^2 and increases the action. The physical path is then a saddle, not a minimum.

The comparison is a calculation we perform on candidate paths. Under the stated endpoint conditions, requiring stationarity gives the same local differential equation as Newton’s force law. It also provides a systematic way to derive the equations of coupled fields.

13.3 Fields: a degree of freedom at every point#

For a scalar field in curved spacetime, use an SI Lagrangian energy density L\mathcal L and write

Sϕ=1cd4xgL(ϕ,μϕ,gμν).S_\phi=\frac1c\int d^4x\,\sqrt{-g}\, \mathcal L(\phi,\nabla_\mu\phi,g^{\mu\nu}).

The 1/c1/c compensates for dx0=cdtdx^0=c\,dt, so the action has units of energy times time. While varying ϕ\phi, hold the metric fixed. Define

Pμ=L(μϕ).P^\mu=\frac{\partial\mathcal L}{\partial(\nabla_\mu\phi)}.

Since ϕ\phi is a scalar, μϕ=μϕ\nabla_\mu\phi=\partial_\mu\phi, and

δSϕ=1cg[Lϕδϕ+Pμμδϕ]d4x.\delta S_\phi=\frac1c\int\sqrt{-g} \left[\frac{\partial\mathcal L}{\partial\phi}\delta\phi +P^\mu\nabla_\mu\delta\phi\right]d^4x.

The covariant product rule gives

Pμμδϕ=μ(Pμδϕ)(μPμ)δϕ.P^\mu\nabla_\mu\delta\phi =\nabla_\mu(P^\mu\delta\phi)-(\nabla_\mu P^\mu)\delta\phi.

The divergence becomes a boundary integral, using gμJμ=μ(gJμ)\sqrt{-g}\nabla_\mu J^\mu=\partial_\mu(\sqrt{-g}J^\mu) from Chapter 6. It vanishes if the variation is identically zero near the boundary, as for a compactly supported interior variation. Suitable fixed boundary values can also remove this first-derivative boundary term. The field equation is

LϕμPμ=0.\boxed{ \frac{\partial\mathcal L}{\partial\phi}-\nabla_\mu P^\mu=0. }

In the natural-unit scalar example of Chapter 11, Pμ=μϕP^\mu=-\nabla^\mu\phi and L/ϕ=V(ϕ)\partial\mathcal L/\partial\phi=-V'(\phi), giving

ϕV(ϕ)=0,=μμ.\Box\phi-V'(\phi)=0, \qquad \Box=\nabla_\mu\nabla^\mu.

A quadratic potential gives a useful extension of the massless wave equation in Chapter 6. Write V=12μ2ϕ2V=\tfrac12\mu^2\phi^2, where μ\mu is a constant with inverse-length units. The result is the Klein–Gordon equation, ϕμ2ϕ=0\Box\phi-\mu^2\phi=0.

In flat spacetime with c=1c=1, try a wave ϕ=Acos(kxωt)\phi=A\cos(\mathbf k\cdot\mathbf x-\omega t). Here k\mathbf k specifies how rapidly its phase changes with position and ω\omega specifies how rapidly it changes with time. Substitution gives

ω2=k2+μ2.\omega^2=|\mathbf k|^2+\mu^2.

If the field is interpreted quantum mechanically as particles of rest mass mm, the quantum relations E=ωE=\hbar\omega and p=k\mathbf p=\hbar\mathbf k, together with E2=p2c2+m2c4E^2=p^2c^2+m^2c^4, identify μ=mc/\mu=mc/\hbar. Here =h/(2π)\hbar=h/(2\pi) is the reduced Planck constant, with units of action. This is the additional conversion behind writing μ=m\mu=m in units c==1c=\hbar=1. The classical field variation itself does not require that quantum interpretation.

Varying the comparison rule. The variation δ\delta commutes with coordinate partial derivatives when comparing fields at the same coordinates. When the metric varies, the covariant derivative varies through its connection as well. For a vector,

δ(μVν)=μδVν+δΓνμρVρ.\delta(\nabla_\mu V^\nu) =\nabla_\mu\delta V^\nu +\delta\Gamma^\nu{}_{\mu\rho}V^\rho.

The second term accounts for the changed rule for comparing vector directions. It remains even if the coordinate components of the vector are held fixed.

13.4 Varying a metric and its inverse#

The covariant and inverse metrics are not independent fields. They obey

gμαgαν=δμν.g^{\mu\alpha}g_{\alpha\nu}=\delta^\mu{}_{\nu}.

Vary this product:

(δgμα)gαν+gμαδgαν=0.(\delta g^{\mu\alpha})g_{\alpha\nu} +g^{\mu\alpha}\delta g_{\alpha\nu}=0.

Multiply by gνβg^{\nu\beta} to isolate the inverse-metric variation:

δgμβ=gμαgβνδgαν.\boxed{ \delta g^{\mu\beta} =-g^{\mu\alpha}g^{\beta\nu}\delta g_{\alpha\nu}. }

Equivalently,

δgμν=gμαgνβδgαβ.\boxed{ \delta g_{\mu\nu} =-g_{\mu\alpha}g_{\nu\beta}\delta g^{\alpha\beta}. }

The matrix identity underneath is δ(M1)=M1(δM)M1\delta(M^{-1})=-M^{-1}(\delta M)M^{-1}. Enlarging a positive eigenvalue of a matrix shrinks the corresponding inverse eigenvalue, which makes the minus sign intuitive. The identity itself holds for every invertible matrix, including Lorentzian metrics.

A common notation hazard is to define kμν=δgμνk_{\mu\nu}=\delta g_{\mu\nu} and then raise its indices. The raised tensor kμν=gμαgνβkαβk^{\mu\nu}=g^{\mu\alpha}g^{\nu\beta}k_{\alpha\beta} satisfies

kμν=δgμν.k^{\mu\nu}=-\delta g^{\mu\nu}.

“Raise the metric perturbation” and “vary the inverse metric” differ by a minus sign. Keeping these operations separate fixes the sign of the later volume and curvature variations.

13.5 Why the volume element varies#

A spacetime region’s invariant volume is not simply its coordinate volume. It is

dV4=gd4x,g=det(gμν).dV_4=\sqrt{-g}\,d^4x, \qquad g=\det(g_{\mu\nu}).

For signature (,+,+,+)(-,+,+,+) the determinant is negative in any real nonsingular coordinate chart, hence the real positive square root of g-g.

To vary it, first recall Jacobi’s determinant identity:

δdetM=(detM)tr(M1δM).\delta\det M=(\det M)\operatorname{tr}(M^{-1}\delta M).

Here is a short derivation. Factor

det(M+λδM)=detMdet(I+λM1δM).\det(M+\lambda\delta M)=\det M\, \det(I+\lambda M^{-1}\delta M).

To first order, the determinant of I+λAI+\lambda A is 1+λtrA1+\lambda\operatorname{tr}A. In the determinant expansion, a term with exactly one perturbation contributes only when it occupies a diagonal position; off-diagonal contributions need at least two perturbations. Differentiating at λ=0\lambda=0 gives the identity.

Apply it to the metric:

δg=ggμνδgμν.\delta g=g\,g^{\mu\nu}\delta g_{\mu\nu}.

The square-root chain rule then gives

δg=12ggμνδgμν=12ggμνδgμν.\boxed{ \delta\sqrt{-g} =\frac12\sqrt{-g}\,g^{\mu\nu}\delta g_{\mu\nu} =-\frac12\sqrt{-g}\,g_{\mu\nu}\delta g^{\mu\nu}. }

The final minus sign comes from inverse-metric variation. It does not mean the Lorentzian volume element is imaginary or negative.

Geometrically, the trace measures the infinitesimal fractional change of a volume. A trace-free metric deformation can change a little region’s shape without changing its volume to first order. In gravity, both curvature and the volume used to integrate that curvature change under variation. Ignoring the second effect would lose the 12Rgμν-\frac12Rg_{\mu\nu} term in Einstein’s equation.

13.6 The stress tensor as the response to changing geometry#

A precise definition of the matter stress tensor, with our SI action convention, is

δSm=12cd4xgTμνδgμν,\boxed{ \delta S_m=-\frac1{2c}\int d^4x\,\sqrt{-g}\, T_{\mu\nu}\,\delta g^{\mu\nu}, }

when the matter fields themselves are held fixed and appropriate integrations by parts have been performed. Equivalently,

Tμν=2cgδSmδgμν.T_{\mu\nu}=-\frac{2c}{\sqrt{-g}} \frac{\delta S_m}{\delta g^{\mu\nu}}.

A functional derivative is defined by its role in the integral giving the first variation. It is the continuum analogue of the coefficients f/xi\partial f/\partial x_i in δf=i(f/xi)δxi\delta f=\sum_i(\partial f/\partial x_i)\delta x_i.

Metric variations are symmetric. In particular,

gαβgμν=δα(μδβν)=12(δαμδβν+δανδβμ).\frac{\partial g^{\alpha\beta}}{\partial g^{\mu\nu}} =\delta^\alpha{}_{(\mu}\delta^\beta{}_{\nu)} =\frac12\left( \delta^\alpha{}_{\mu}\delta^\beta{}_{\nu} +\delta^\alpha{}_{\nu}\delta^\beta{}_{\mu} \right).

There are ten independent variations, and the resulting metric stress tensor is symmetric. If one instead varies gμνg_{\mu\nu}, the definition becomes

δSm=+12cgTμνδgμνd4x.\delta S_m=+\frac1{2c}\int\sqrt{-g}\, T^{\mu\nu}\delta g_{\mu\nu}\,d^4x.

Changing metric variables changes the sign convention in the variation formula, not the physical stress tensor.

For a matter Lagrangian with no derivatives of the metric, the determinant identity immediately yields

Tμν=2Lmgμν+gμνLm.\boxed{ T_{\mu\nu}=-2\frac{\partial\mathcal L_m}{\partial g^{\mu\nu}} +g_{\mu\nu}\mathcal L_m. }

Apply this in natural units to the scalar Lagrangian. Its explicit metric derivative is 12μϕνϕ-\frac12\partial_\mu\phi\partial_\nu\phi. The first term in TμνT_{\mu\nu} becomes μϕνϕ\partial_\mu\phi\partial_\nu\phi, and the volume variation supplies gμνLϕg_{\mu\nu}\mathcal L_\phi, reproducing Chapter 11’s tensor.

For electromagnetism, return to SI units. A convenient field variable is the electromagnetic potential, a covector field AμA_\mu. It determines the field tensor locally by

Fμν=μAννAμ.F_{\mu\nu}=\partial_\mu A_\nu-\partial_\nu A_\mu.

Its antisymmetry is explicit. Changing AμA_\mu to Aμ+μχA_\mu+\partial_\mu\chi, for any smooth scalar χ\chi, leaves FF unchanged because the two mixed derivatives of χ\chi cancel. This is electromagnetic gauge freedom: more than one potential describes the same electric and magnetic fields.

Hold the functions AμA_\mu fixed while varying the metric. Then the displayed FμνF_{\mu\nu} remains fixed, but raising its indices uses the changing metric. Write its contraction as

FαβFαβ=gαρgβσFαβFρσ.F_{\alpha\beta}F^{\alpha\beta} =g^{\alpha\rho}g^{\beta\sigma}F_{\alpha\beta}F_{\rho\sigma}.

The two inverse metrics each contribute a variation. Antisymmetry of FF and renaming dummy indices show that the two contributions are equal:

δ(FαβFαβ)=2FμαFναδgμν.\delta(F_{\alpha\beta}F^{\alpha\beta}) =2F_{\mu\alpha}F_\nu{}^\alpha\delta g^{\mu\nu}.

Thus the explicit metric derivative of LEM\mathcal L_{\rm EM} gives the FμαFνα/μ0F_{\mu\alpha}F_\nu{}^\alpha/\mu_0 term in its stress tensor, and the volume variation gives the gμνF2/(4μ0)-g_{\mu\nu}F^2/(4\mu_0) term. Even when the field components held fixed do not change, the metric changes how they are contracted into a physical energy density.

The resulting physical interpretation is: stress–energy measures how the matter action responds when its spacetime measuring apparatus is changed. Spatial deformations reveal stress; temporal deformations reveal energy; mixed deformations reveal momentum and energy flow. The familiar idea of stress as a response to strain has become a spacetime statement.

For matter actions containing curvature or metric derivatives, use the full functional definition rather than the short partial-derivative formula. Likewise, a fluid’s energy density depends on proper volume and other constrained variables. Treating it as a metric-independent number during a naive variation will generally produce the wrong fluid stress tensor.

13.7 From a history to a state: Hamilton’s equations#

At the same position, a cart can be moving right, moving left, or standing still. Position alone cannot predict what it does next. Chapter 0 supplied both position and velocity as starting measurements. For the spring cart, momentum supplies the same missing information because p=mq˙p=m\dot q.

Make a new plot: position on the horizontal axis, momentum on the vertical axis. The pair (q,p)(q,p) is one point, called a state. The space of such pairs is phase space. As time passes, the point traces a curve. This curve is not the cart’s path on the track: its vertical coordinate is momentum, not a second spatial direction.

Watch the cart pass the unstretched position twice. Both passages have q=0q=0, but one has positive momentum and the other negative momentum. They are distinct points on the phase-space plot. At a turning point, the phase-space curve crosses p=0p=0; it does not stop there, because the force is changing momentum.

MECHANICS LAB / 02

One cart. Two ways to see its motion.

The cart moves along a track. The dot moves through position and momentum. Pause either view: they describe the same state.

The cart on its track
m p = 0.00 F = -1.00 N q = 1.00 m 0
Momentarily at restMomentum 0.00 kg m/s
Total energy0.50 J
Motion · kinetic energy0.00 J
Spring · potential energy0.50 J
Position and momentum together
-22 -22 0Position q [m]Momentum p [kg m/s]

Each dot position is one state (q,p)(q,p). The highlighted ellipse has the cart’s total energy. Small arrows show the direction of the next change.

At a turning point the cart is momentarily at rest. The spring force is still acting, so the motion reverses.

What is being calculated?

The default cart has mass 1 kg and spring stiffness 1 N/m. It starts 1 m to the right of the unstretched position, at rest. The track has no friction; the spring has negligible mass. Motion is shown at one simulated second per second.

Force and momentum carry a direction. Energy is a number. For this experiment, p=mdqdt,F=kqp=m\frac{dq}{dt},\quad F=-kq, while K=p22m,U=12kq2K=\frac{p^2}{2m},\quad U=\frac12kq^2. The bar is divided in the ratio of these two energies. Its total is E=K+UE=K+U.

The motion obeys md2qdt2=kqm\frac{d^2q}{dt^2}=-kq. Write ω=k/m\omega=\sqrt{k/m}; its units are inverse seconds. With starting displacement q0q_0 and momentum p0p_0, the solution is

q(t)=q0cos(ωt)+p0mωsin(ωt)q(t)=q_0\cos(\omega t)+\frac{p_0}{m\omega}\sin(\omega t)

Differentiating twice gives the required acceleration. At time zero it reproduces the starting position and momentum. One complete cycle takes T=2πm/kT=2\pi\sqrt{m/k}. The model has no damping, impacts, external driving, or relativistic corrections.

For the spring, the total energy expressed in these coordinates is

H(q,p)=p22m+12kq2.H(q,p)=\frac{p^2}{2m}+\frac12kq^2.

Holding HH fixed gives the ellipses in the plot. The actual motion follows one of them. Its direction can be found from two derivatives:

Hp=pm=q˙,Hq=kq=p˙.\frac{\partial H}{\partial p}=\frac pm=\dot q, \qquad -\frac{\partial H}{\partial q}=-kq=\dot p.

The first tells us how position changes; the second tells us how momentum changes. These are Hamilton’s equations for this example. The function that generates them is the Hamiltonian. Here it is total mechanical energy. We next derive the general construction, including when that energy interpretation needs qualification.

Replacing velocity by momentum#

Start with a Lagrangian L(q,v,t)L(q,v,t), writing vv as a separate variable while taking partial derivatives. Define the conjugate momentum

p=Lv.p=\frac{\partial L}{\partial v}.

For L=mv2/2U(q)L=mv^2/2-U(q) this gives p=mvp=mv, so we can replace vv by p/mp/m. More generally, suppose the momentum equation can be solved locally for v=v(q,p,t)v=v(q,p,t). Define

H(q,p,t)=pv(q,p,t)L(q,v(q,p,t),t).H(q,p,t)=p\,v(q,p,t)-L\bigl(q,v(q,p,t),t\bigr).

This replacement is called a Legendre transform. It changes the independent variable from velocity to momentum. The cancellation that makes it useful is an ordinary product rule:

dH=vdp+pdv(Lqdq+Lvdv+Ltdt)=vdpLqdqLtdt,\begin{aligned} dH&=v\,dp+p\,dv- \left(L_q\,dq+L_v\,dv+L_t\,dt\right)\\ &=v\,dp-L_q\,dq-L_t\,dt, \end{aligned}

because Lv=pL_v=p. Subscripts here mean partial derivatives, with the other independent inputs held fixed. Compare this result with dH=Hqdq+Hpdp+HtdtdH=H_q\,dq+H_p\,dp+H_t\,dt. The Euler–Lagrange equation already gives p˙=Lq\dot p=L_q. Therefore

q˙=Hp,p˙=Hq,Ht=Lt.\boxed{\dot q=H_p,\qquad\dot p=-H_q}, \qquad H_t=-L_t.

One second-order equation for qq has become two first-order equations for (q,p)(q,p). They need the same amount of initial information. For several coordinates, use one conjugate momentum pi=L/q˙ip_i=\partial L/\partial\dot q^i for each coordinate and replace pvpv by ipiq˙i\sum_i p_i\dot q^i.

The local inversion is a real condition, not an automatic step. In one degree of freedom, 2L/v20\partial^2L/\partial v^2\ne0 ensures it locally. With several velocities, the matrix of second velocity derivatives must be invertible. When it is singular, relations among positions and momenta can become constraints. That possibility is central to relativity.

Energy conservation and the direction of flow#

Along a solution,

dHdt=Hqq˙+Hpp˙+Ht=HqHpHpHq+Ht=Ht.\frac{dH}{dt}=H_q\dot q+H_p\dot p+H_t =H_qH_p-H_pH_q+H_t=H_t.

Thus a Hamiltonian with no explicit time dependence is conserved. For a particle with ordinary quadratic kinetic energy and a time-independent potential, the construction gives H=K+UH=K+U. A time-dependent drive can change HH, and an arbitrary coordinate choice or Lagrangian does not let us identify it with a chosen observer’s energy without further argument.

The oscillator’s phase-space arrows follow (q˙,p˙)=(p/m,kq)(\dot q,\dot p)=(p/m,-kq). At the rightmost point they point down, so the motion runs clockwise. That orientation is information beyond the shape of an energy ellipse. If the equations have no explicit time dependence, the system is called autonomous. When its smooth equations have unique solutions, distinct phase-space trajectories cannot cross at the same state: the same position and momentum cannot have two different next steps. A time-dependent system requires specifying the time as well.

For any observable f(q,p,t)f(q,p,t), meaning a quantity calculated from the state, the chain rule gives

dfdt=fqHpfpHq+ft.\frac{df}{dt}=f_qH_p-f_pH_q+f_t.

Define the Poisson bracket by {f,g}=fqgpfpgq\{f,g\}=f_qg_p-f_pg_q. Then df/dt={f,H}+ftdf/dt=\{f,H\}+f_t. For several canonical pairs, sum that expression over ii. For example, {q,p}=1\{q,p\}=1, {q,H}=p/m\{q,H\}=p/m, and {p,H}=kq\{p,H\}=-kq for the spring. The bracket records how a quantity changes under a specified Hamiltonian flow; it is not ordinary multiplication with different brackets.

Try a state before revealing its next motion

Take m=2kgm=2\,\mathrm{kg}, k=2N/mk=2\,\mathrm{N/m}, q=1mq=1\,\mathrm m, and p=1kgm/sp=-1\,\mathrm{kg\,m/s}. Find the velocity, force, kinetic energy, potential energy, and total energy. Is the cart’s speed increasing at this instant?

Compare the calculation

The velocity is p/m=0.5m/sp/m=-0.5\,\mathrm{m/s} and the force is kq=2N-kq=-2\,\mathrm N. They both point left, so the speed is increasing. The energies are K=p2/(2m)=0.25JK=p^2/(2m)=0.25\,\mathrm J and U=kq2/2=1JU=kq^2/2=1\,\mathrm J, giving H=1.25JH=1.25\,\mathrm J. The instantaneous exchange rates are dK/dt=Fv=+1J/sdK/dt=Fv=+1\,\mathrm{J/s} and dU/dt=kqv=1J/sdU/dt=kqv=-1\,\mathrm{J/s}.

Why conjugate momentum can differ from mass times velocity

Add a total derivative to the spring Lagrangian:

L~=12mq˙212kq2+ddt(12αq2)=L+αqq˙.\widetilde L=\frac12m\dot q^2-\frac12kq^2+ \frac{d}{dt}\left(\frac12\alpha q^2\right) =L+\alpha q\dot q.

Here α\alpha is a constant with units kg/s\mathrm{kg/s}. The action changes only by an endpoint term. With fixed endpoint positions, its variation is unchanged, so the physical equation of motion is unchanged. But the conjugate momentum becomes p~=mq˙+αq\widetilde p=m\dot q+\alpha q. Solving for velocity gives

H~(q,p~)=(p~αq)22m+12kq2.\widetilde H(q,\widetilde p) =\frac{(\widetilde p-\alpha q)^2}{2m}+\frac12kq^2.

The mechanical momentum remains mq˙=p~αqm\dot q=\widetilde p-\alpha q. The example explains why the derivative definition of conjugate momentum matters even when the physical motion is familiar.

How the relativistic particle prepares us for constraints

For a timelike worldline parametrized by λ\lambda, Chapter 5 used the action with Lagrangian

L=mcgμνx˙μx˙ν,x˙μ=dxμdλ.L=-mc\sqrt{-g_{\mu\nu}\dot x^\mu\dot x^\nu}, \qquad \dot x^\mu=\frac{dx^\mu}{d\lambda}.

The conjugate momentum is

pμ=mcgμνx˙νgαβx˙αx˙β,gμνpμpν=m2c2.p_\mu=\frac{mc\,g_{\mu\nu}\dot x^\nu} {\sqrt{-g_{\alpha\beta}\dot x^\alpha\dot x^\beta}}, \qquad g^{\mu\nu}p_\mu p_\nu=-m^2c^2.

Multiplying every velocity by the same positive factor leaves these momenta unchanged. Therefore the momenta cannot determine the arbitrary rate at which the parameter labels the worldline. The velocity-to-momentum map is not invertible. Direct contraction also gives pμx˙μ=Lp_\mu\dot x^\mu=L, so the naive canonical Hamiltonian pμx˙μLp_\mu\dot x^\mu-L vanishes. The particle still moves; its parametrization is redundant.

The mass-shell relation C=gμνpμpν+m2c2=0C=g^{\mu\nu}p_\mu p_\nu+m^2c^2=0 is a constraint. Introduce an auxiliary function N(λ)N(\lambda) that multiplies this constraint, and use the phase-space action

S=[pμx˙μN2C]dλ.S=\int\left[p_\mu\dot x^\mu-\frac N2 C\right]d\lambda.

Varying NN enforces C=0C=0. Varying pμp_\mu gives x˙μ=Ngμνpν\dot x^\mu=Ng^{\mu\nu}p_\nu. Changing the positive multiplier changes how quickly the parameter runs along the same future-directed worldline. Chapter 20 returns to this freedom in labeling time when it introduces the lapse and constraints for spacetime geometry.

The idea to keep

Vary the configuration, collect the arbitrary change, and integrate derivatives off that change. Stationarity makes its coefficient vanish.

Why does fixing endpoint values remove the ordinary mechanics boundary term?

The boundary term is momentum times the endpoint variation. Fixed endpoints set that variation to zero. Higher-derivative actions require more care.

Figure detail

Scroll to explore at full resolution. Colors follow your reading theme.