Ph · Physics

Why Does Adding a Total Derivative Preserve Hamilton’s Equations?

Published By the 9to5Science editorial team

At a glance

  1. 1. Shift the momentum

    Adding dF/dt changes the canonical momentum by the gradient of F with respect to the coordinates.

  2. 2. Transform the Hamiltonian

    Write the new Hamiltonian using the shifted momentum; it also includes a term from the time dependence of F.

  3. 3. Apply Hamilton’s equations

    The transformed variables obey Hamilton’s equations, and the coordinate trajectories remain unchanged.

  4. 4. Check an example

    For a free particle, a coordinate-dependent boundary term shifts momentum but leaves the particle’s motion unchanged.

Adding a total time derivative to a Lagrangian does not change the equations of motion for the coordinates. It does, however, change the canonical momentum and the Hamiltonian written in canonical variables. The key distinction is that the equations retain their Hamiltonian form in the new variables; the canonical momentum and Hamiltonian are not generally unchanged.

Let the modified Lagrangian be

L′(q,q˙,t)=L(q,q˙,t)+dF(q,t)dt,L'(q,\dot q,t)=L(q,\dot q,t)+\frac{dF(q,t)}{dt},

where FF is a twice continuously differentiable function of the coordinates and time. The result assumes the Legendre transform is regular, so velocities can be expressed in terms of canonical momenta.

Why the motion is unchanged

Since FF depends on qq and tt,

dFdt=∑i∂F∂qiq˙i+∂F∂t.\frac{dF}{dt}=\sum_i \frac{\partial F}{\partial q_i}\dot q_i+\frac{\partial F}{\partial t}.

The new canonical momentum is therefore

pi′=∂L′∂q˙i=pi+∂F∂qi.p_i' = \frac{\partial L'}{\partial \dot q_i} = p_i+\frac{\partial F}{\partial q_i}.

The Euler–Lagrange equations are unchanged: the added term contributes d(∂F/∂qi)/dtd(\partial F/\partial q_i)/dt to the time derivative of the momentum and contributes exactly the same quantity to ∂L′/∂qi\partial L'/\partial q_i. These contributions cancel.

Equivalently, the action changes only by an endpoint term:

S′=∫t1t2L′ dt=S+F(q(t2),t2)−F(q(t1),t1).S' = \int_{t_1}^{t_2} L'\,dt = S+F(q(t_2),t_2)-F(q(t_1),t_1).

With fixed endpoint coordinates and times, this does not alter the paths that make the action stationary.

How the Hamiltonian changes

Use the new momentum p′p' to define the modified Hamiltonian. Since pi=pi′−∂F/∂qip_i=p_i'-\partial F/\partial q_i, the Legendre transform gives

H′(q,p′,t)=∑ipi′q˙i−L′=∑i(pi+∂F∂qi)q˙i−L−∑i∂F∂qiq˙i−∂F∂t=H(q,p,t)−∂F∂t=H(q,p′−∂F∂q,t)−∂F∂t.\begin{aligned} H'(q,p',t) &=\sum_i p_i'\dot q_i-L'\\ &=\sum_i \left(p_i+\frac{\partial F}{\partial q_i}\right)\dot q_i -L-\sum_i \frac{\partial F}{\partial q_i}\dot q_i-\frac{\partial F}{\partial t}\\ &=H(q,p,t)-\frac{\partial F}{\partial t}\\ &=H\left(q,p'-\frac{\partial F}{\partial q},t\right)-\frac{\partial F}{\partial t}. \end{aligned}

Thus the Hamiltonian is not generally identical before and after the change. Rather, the momentum has been redefined, and the Hamiltonian must be expressed in terms of that redefined momentum.

Why Hamilton’s equations keep their form

The change from (q,p)(q,p) to (q,p′)(q,p') is a time-dependent canonical transformation. It leaves the coordinates unchanged and shifts the momenta by a coordinate gradient. In the new variables, Hamilton’s equations are

q˙i=∂H′∂pi′,p˙i′=−∂H′∂qi.\dot q_i=\frac{\partial H'}{\partial p_i'},\qquad \dot p_i'=-\frac{\partial H'}{\partial q_i}.

They reproduce the same coordinate paths qi(t)q_i(t) as the original equations. The momenta themselves differ by ∂F/∂qi\partial F/\partial q_i, so they should not be compared as though they were the same variables.

One way to see the canonical transformation is to use the generating function

G2(q,p′,t)=∑iqipi′−F(q,t).G_2(q,p',t)=\sum_i q_i p_i'-F(q,t).

It gives pi=∂G2/∂qi=pi′−∂F/∂qip_i=\partial G_2/\partial q_i=p_i'-\partial F/\partial q_i, while the new coordinate is qi′=∂G2/∂pi′=qiq_i'=\partial G_2/\partial p_i'=q_i. The transformed Hamiltonian is H′=H+∂G2/∂t=H−∂F/∂tH'=H+\partial G_2/\partial t=H-\partial F/\partial t, with the old momentum replaced by its expression in terms of p′p'.

Worked example: a free particle

Take a one-dimensional free particle with mass mm:

L=12mq˙2.L=\frac12 m\dot q^2.

Choose F(q)=12kq2F(q)=\frac12 kq^2, where kk is constant. Then dF/dt=kqq˙dF/dt=kq\dot q, so

L′=12mq˙2+kqq˙.L'=\frac12 m\dot q^2+kq\dot q.

The original momentum is p=mq˙p=m\dot q, while the new one is p′=mq˙+kqp'=m\dot q+kq. Since FF has no explicit time dependence, the new Hamiltonian is

H′(q,p′)=(p′−kq)22m.H'(q,p')=\frac{(p'-kq)^2}{2m}.

Hamilton’s equations give

q˙=p′−kqm,p˙′=k(p′−kq)m=kq˙.\dot q=\frac{p'-kq}{m},\qquad \dot p'=\frac{k(p'-kq)}{m}=k\dot q.

Differentiating the first equation in time yields q¨=(p˙′−kq˙)/m=0\ddot q=(\dot p'-k\dot q)/m=0. The free-particle motion is unchanged, even though the canonical momentum has shifted.

Common mistakes

  • Claiming the Hamiltonian is unchanged. It is generally changed both by the momentum shift and, if FF depends explicitly on time, by the term −∂F/∂t-\partial F/\partial t.
  • Comparing old and new momenta directly. They are different canonical variables: pi′=pi+∂F/∂qip_i'=p_i+\partial F/\partial q_i.
  • Ignoring the explicit time dependence. If F=F(q,t)F=F(q,t), the transformed Hamiltonian includes −∂F/∂t-\partial F/\partial t; omitting it gives incorrect Hamilton equations.
  • Assuming the energy value is always unchanged. The motion is unchanged, but the Hamiltonian function and its numerical value need not be. In a time-dependent transformation, even its explicit time dependence can change.

References

  1. Classical Mechanics, Herbert Goldstein, Charles Poole, and John Safko

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.