7.10: Hamiltonian Invariance
( \newcommand{\kernel}{\mathrm{null}\,}\)
Chapters 7.8,7.9 addressed two important and independent features of the Hamiltonian regarding: a) when H is conserved, and b) when H equals the total mechanical energy. These important results are summarized below with a discussion of the assumptions made in deriving the Hamiltonian, as well as the implications.
a) Conservation of generalized energy
The generalized energy theorem (7.8.1) was given as
dH(q,p,t)dt=dh(q,˙q,t)dt=∑j˙qj[QEXCj+m∑k=1λk∂gk∂qj(q,t)]−∂L(q,˙q,t)∂t
Note that when
∑j˙qj[QEXCj+m∑k=1λk∂gk∂qj(q,t)]=0,
then Equation ??? reduces to
dHdt=−∂L∂t
Also, when
∑j˙qj[QEXCj+m∑k=1λk∂gk∂qj(q,t)]=0,
and if the Lagrangian is not an explicit function of time, then the Hamiltonian is a constant of motion. That is, H is conserved if, and only if, the Lagrangian, and consequently the Hamiltonian, are not explicit functions of time, and if the external forces are zero.
b) The generalized energy and total energy
If the following two requirements are satisfied
- The kinetic energy has a homogeneous quadratic dependence on the generalized velocities, that is, the transformation to generalized coordinates is independent of time, ∂xα,i∂t=0.
- The potential energy is not velocity dependent, thus the terms ∂U∂˙qi=0.
Then equation (7.9.5) implies that the Hamiltonian equals the total mechanical energy, that is, H=T+U=E
Expressed in words, the generalized energy (Hamiltonian) equals the total energy if the constraints are time independent and the potential energy is velocity independent. This is equivalent to stating that, if the constraints, or generalized coordinates, for the system are time independent, then H=E.
The four combinations of the above two independent conditions, assuming that the external forces term in Equation ??? is zero, are summarized in table 7.10.1.
Hamiltonian | Constraints and coordinate transformation | Constraints and coordinate transformation |
---|---|---|
Time behavior | Time independent | Time dependent |
dHdt=−∂L∂t=0 | H conserved, H=E | H conserved, H≠E |
dHdt=−∂L∂t≠0 | H not conserved, H=E | H not conserved, H≠E |
Note the following general facts regarding the Lagrangian and the Hamiltonian.
- the Lagrangian is indefinite with respect to addition of a constant to the scalar potential,
- the Lagrangian is indefinite with respect to addition of a constant velocity,
- there is no unique choice of generalized coordinates.
- the Hamiltonian is a scalar function that is derived from the Lagrangian scalar function.
- the generalized momentum is derived from the Lagrangian.
These facts, plus the ability to recognize the conditions under which H is conserved, and when H=E, can greatly facilitate solving problems as shown by the following two examples.
Example 7.10.1: Linear harmonix oscillator on a cart moving at constant velocity
Consider a linear harmonic oscillator located on a cart that is moving with constant velocity v0 in the x direction (Figure 7.10.1). Let the laboratory frame be the unprimed frame, and the cart frame be designated the primed frame. Assume that x=x′ at t=0. Then

x′=x−v0t˙x′=˙x−v0¨x′=¨x
The harmonic oscillator will have a potential energy of U=12kx′2=12k(x−v0t)2
Laboratory frame:
The Lagrangian is
L(x,˙x,t)=m˙x22−12k(x−v0t)2
Lagrange equation ΛxL=0 gives the equation of motion to be
m¨x=−k(x−v0t)
The definition of generalized momentum gives
p=∂L∂˙x=m˙x
The Hamiltonian is
H(x,p,t)=∑i˙qi∂L∂˙qi−L=p22m+12k(x−v0t)2
The Hamiltonian is the sum of the kinetic and potential energies and equals the total energy of the system, but it is not conserved since L and H are both explicit functions of time, that is dHdt=∂H∂t=−∂L∂t≠0. Physically this is understood in that energy must flow into and out of the external constraint keeping the cart moving uniformly at a constant velocity v0 against the reaction to the oscillating mass. That is, assuming a uniform velocity for the moving cart constitutes a time-dependent constraint on the mass, and the force of constraint does work in actual displacement of the complete system. If the constraint did not exist, then the cart momentum would oscillate such that the total momentum of cart plus spring system is conserved.
Cart frame:
Transform the Lagrangian to the primed coordinates in the moving frame of reference, which also is an inertial frame. Then the Lagrangian L, in terms of the moving cart frame coordinates, is
L(x′,˙x′,t)=m2(˙x′2+2˙x′v0+v20)−12kx′2
The Lagrange equation of motion Λx′L=0 gives the equation of motion to be
m¨x′=−kx′
where x′ is the displacement of the mass with respect to the cart. This implies that an observer on the cart will observe simple harmonic motion as is to be expected from the principle of equivalence in Galilean relativity.
The definition of the generalized momentum gives the linear momentum in the primed frame coordinates to be
p′=∂L∂˙x′=m˙x′+mv0
The cart-frame Hamiltonian also can be expressed in terms of the coordinates in the moving frame to be
H(x′,p′,t)=˙x′∂L∂˙x′−L=(p′−mv0)22m+12kx′2−m2v20
Note that the Lagrangian and Hamiltonian expressed in terms of the coordinates in the cart frame of reference are not explicitly time dependent, therefore H is conserved. However, the cart-frame Hamiltonian does not equal the total energy since the coordinate transformation is time dependent. Actually the first two terms in the above Hamiltonian are the energy of the harmonic oscillator in the cart frame. This example shows that the Hamiltonians differ when expressed in terms of either the laboratory or cart frames of reference
Example 7.10.2: Isotropic central force in a rotating frame
Consider a mass subject to a central isotropic radial force U(r) as shown in Figure 7.10.2. Compare the Hamiltonian H in the fixed frame of reference S, with the Hamiltonian H′ in a frame of reference S′ that is rotating about the center of the force with constant angular velocity ω.

Restrict this case to rotation about one axis so that only two polar coordinates r and ϕ need to be considered. The transformations are
r′=rϕ′=ϕ−ωt
Also
U(r)=U(r′)
Fixed frame of reference S:
L=T−U=m2(˙r2+r2˙ϕ2)−U(r) Since the Lagrangian is not explicitly time dependent, then the Hamiltonian is conserved. For this fixed-frame Hamiltonian the generalized momenta are
pϕ=∂L∂˙ϕ=m˙r2˙ϕpr=∂L∂˙r=m˙r
The Hamiltonian equals
H(pr,pϕ,r,ϕ)=∑i˙qi∂L∂˙qi−L=12m(p2r+pϕr22)+U(r)=E
The Hamiltonian in the fixed frame is conserved and equals the total energy, that is H=T+U.
Rotating frame of reference S′
The above inertial fixed-frame Lagrangian can be written in terms of the primed (non-inertial rotating frame) coordinates as
L=T−U=m2(˙r2+r2˙ϕ2)−U(r)=m2(˙r′2+r′2(˙ϕ′+ω)2)−U(r′)
The generalized momenta derived from this Lagrangian are
p′ϕ=∂L∂˙ϕ′=m˙r′2(˙ϕ′+ω)=p′ϕ′+mr′2ωp′r=∂L∂˙r′=m˙r′2=pr
The Hamiltonian expressed in terms of the non-inertial rotating frame coordinates is
H′(p′r,p′ϕ,r′,ϕ′)=∂L∂˙r′˙r′+∂L∂˙ϕ′˙ϕ′−L=12m(p′2r+(p′ϕ′+mr2ω)r2)+U(r′)
Note that H′(p′r,p′ϕ,r′,ϕ′) is time independent and therefore is conserved, but H(p′r,p′ϕ,r′,ϕ′)≠E because the generalized coordinates are time dependent. In addition, p′ϕ′ is conserved since ˙p′ϕ=∂H∂ϕ′=−∂L∂ϕ′=0
Example 7.10.3: The plane pendulum
The simple plane pendulum in a uniform gravitational field g is an example that illustrates Hamiltonian invariance.

There is only one generalized coordinate, θ and the Lagrangian for this system is
L=12ml2˙θ2+mglcosθ
The momentum conjugate to θ is
pθ=∂L∂˙θ=ml2˙θ which is the angular momentum about the pivot point.
Using the Lagrange-Euler equation this gives that
ddtpθ=˙pθ=∂L∂θ=−mglsinθ Note that the angular momentum pθ is not a constant of motion since it explicitly depends on θ.
The Hamiltonian is H=∑ipi˙qi−L=pθ˙θ−L=12ml2˙θ2−mglcosθ=p2θ2ml2−mglcosθ
Note that the Lagrangian and Hamiltonian are not explicit functions of time, therefore they are conserved. Also the potential is velocity independent and there is no coordinate transformation, thus the Hamiltonian equals the total energy E, which is a constant of motion. H=p2θ2ml2−mglcosθ=E
Example 7.10.4: Oscillating cylinder in a cylindrical bowl
It is important to correctly account for constraint forces when using Noether’s theorem for constrained systems. Noether’s theorem assumes the variables are independent. This is illustrated by considering the example of a solid cylinder rolling in a fixed cylindrical bowl. Assume that a uniform cylinder of radius ρ and mass m is constrained to roll without slipping on the inner surface of the lower half of a hollow cylinder of radius R. The motion is constrained to ensure that the axes of both cylinders remain parallel and ρ<R.

The generalized coordinates are taken to be the angles θ and ϕ which are measured with respect to a fixed vertical axis. Then the kinetic energy and potential energy are
T=12m[(R−ρ)˙θ]2+12I˙ϕ2U=[R−(R−ρ)cosθ]mg
where m is the mass of the small cylinder and where U=0 at the lowest position of the sphere. The moment of inertia of a uniform cylinder is I=12mρ2.
The Lagrangian is
L−T−U=12m[(R−ρ)˙θ]2+14mρ2˙ϕ2−[R−(R−ρ)cosθ]mg
Since the solid cylinder rotates without slipping inside the cylindrical shell, then the equation of constraint is g(θϕ)=Rθ−ρ(ϕ+θ)=0
Using the Lagrangian, plus the one equation of constraint, requires one Lagrange multiplier. Then the Lagrange equations of motion for θ and ϕ are
∂L∂θ−ddt[∂L∂˙θ]+λ∂g∂θ=0∂L∂ϕ−ddt[∂L∂˙ϕ]+λ∂g∂ϕ=0
Substitute the Lagrangian and the equation of constraint gives two equations of motion
−(R−ρ)mgsinθ−m(R−ρ)2¨θ+λ(R−ρ)=0−12mρ2¨ϕ−λρ=0
The lower equation of motion gives that
λ=−12mρ¨ϕ
Substitute this into the equation of constraint gives
λ=−12m(R−ρ)¨θ
Substitute this into the first equation of motion gives the equation of motion for θ to be
¨θ=2g3(R−ρ)sinθ
that is
λ=−mg3sinθ
The torque acting on the small cylinder due to the frictional force is
Fρ=12mρ2¨ϕ=−λρ
Thus the frictional force is F=−λ=mg3sinθ
Noether’s theorem can be used to ascertain if the angular momentum pθ is a constant of motion. The derivative of the Lagrangian
∂L∂θ=(R−ρ)mgsinθ
and thus the Lagrange equations tells us that ˙pθ=(R−ρ)mgsinθ. Therefore pθ is not a constant of motion.
The Lagrangian is not an explicit function of ϕ, which would suggest that pϕ is a constant of motion. But this is incorrect because the constraint equation ϕ=(R−ρ)ρθ couples θ and ϕ, that is, they are not independent variables, and thus pθ and pϕ are coupled by the constraint equation. As a result pϕ is not a constant of motion because it is directly coupled to pθ=(R−ρ)mgsinθ which is not a constant of motion. Thus neither pθ nor pϕ are constants of motion. This illustrates that one must account carefully for equations of constraint, and the concomitant constraint forces, when applying Noether’s theorem which tacitly assumes independent variables.
The Hamiltonian can be derived using the generalized momenta
pθ=∂L∂˙θ=m(R−ρ)2˙θpϕ=∂L∂˙ϕ=12mρ2˙ϕ
Then the Hamiltonian is given by
H=pθ˙θ+pϕ˙ϕ−L=p2θ2m(R−ρ)2+p2ϕmρ2+[R−(R−ρ)cosθ]mg
Note that the transformation to generalized coordinates is time independent and the potential is not velocity dependent, thus the Hamiltonian also equals the total energy. Also the Hamiltonian is conserved since dHdt=0.