To step a system forward in time using position x and conjugate momentum p=∂v∂L on equal footing, we need to trade the Lagrangian L(x,v,t) for a function of x,p, and t. Simply solving p=∂v∂L for v and plugging it straight into L fails whenever position and velocity are multiplied together in the kinetic energy.
Why You Cannot Just Plug Velocity of Momentum into the Lagrangian
For a planet of mass m orbiting in polar coordinates (r,θ), the angular kinetic energy is Tθ=21mr2θ˙2 and the angular momentum is pθ=∂θ˙∂L=mr2θ˙. Differentiating Tθ with respect to r while holding θ˙ fixed gives the outward centrifugal term:
(∂r∂Tθ)θ˙=∂r∂(21mr2θ˙2)=+mrθ˙2
If we instead substitute θ˙=mr2pθ directly into Tθ and differentiate with respect to r while holding pθ fixed, r2 moves into the denominator and the derivative flips sign:
As r increases, holding θ˙ fixed makes Tθ climb with slope +mrθ˙2. Holding pθ=mr2θ˙ fixed instead forces θ˙ to drop as r21, so Tθ falls with the opposite slope, −mrθ˙2.
Holding angular velocity fixed makes angular kinetic energy grow with radius, while holding angular momentum fixed slows the spin down so fast that angular kinetic energy falls at the exact opposite slope.
1
Building the Hamiltonian and Hamilton's Equations
We want a function H(x,p,t) whose small change dH depends only on dx,dp, and dt, with any accompanying change dv canceling out automatically.
Building the Hamiltonian and Hamilton's Equations
L(x,v,t)⟶H(x,p,t)x˙p˙=?=?=?
Using p=∂v∂L and the Euler-Lagrange equation p˙=∂x∂L, a small nudge to L(x,v,t) is dL=p˙dx+pdv+∂t∂Ldt. Because the product rule gives d(pv)=vdp+pdv with the exact same +pdv term, subtracting L from pv cancels out dv:
For a particle with L=T−V=21mv2−V(x) and p=mv, the product pv=mv2=2T turns H into the total mechanical energy written in terms of x and p:
H=pv−L=2T−(T−V)=T+V=2mp2+V(x)
On the upward-curving graph of L versus v at fixed x and t, each velocity v has its own tangent slope p=∂v∂L. Tracing that tangent line back to v=0 drops the height by pv from L, crossing the vertical axis at a depth H=pv−L below zero.
At a fixed position and time, every velocity on the curve has its own tangent slope, and extending that tangent back to the vertical axis marks the depth below the origin.
2
The Four-Step Method in Polar Coordinates
For a system with several coordinates qi, every coordinate gets its own piq˙i term in H=∑ipiq˙i−L. Let's build H and write Hamilton's equations for a planet of mass m orbiting a star in 2D polar coordinates (r,θ) under a central potential V(r).
The Four-Step Method in Polar Coordinates
Text solution
Step 1: Write the Lagrangian in terms of the coordinates and velocitiesCombine the radial and angular kinetic energy pieces with the central potential V(r).
L(r,θ,r˙,θ˙)=21m(r˙2+r2θ˙2)−V(r)
Step 2: Differentiate L with respect to each velocity to find the conjugate momentaTake the partial derivative of L with respect to r˙ and θ˙.
pr=∂r˙∂L=mr˙,pθ=∂θ˙∂L=mr2θ˙
Step 3: Invert the momentum equations to solve for the velocitiesIsolate r˙ and θ˙ in terms of pr,pθ, and r.
r˙=mpr,θ˙=mr2pθ
Step 4: Build H=∑ipiq˙i−L and eliminate all velocitiesSubstitute r˙=mpr and θ˙=mr2pθ into prr˙+pθθ˙−L so that H depends only on coordinates and momenta.
Step 5: Differentiate H to write Hamilton's four first-order equationsTake partial derivatives with respect to the momenta for r˙ and θ˙, and negative partial derivatives with respect to the coordinates for p˙θ and p˙r.
Because θ is absent from H, angular momentum pθ is constant, and substituting p˙r=mr¨ and pθ=mr2θ˙ into the p˙r equation recovers the second-order radial equation mr¨=mrθ˙2−∂r∂V with the positive outward centrifugal term.
3
Coupled Coordinates and the Quadratic Kinetic Energy Shortcut
When coordinates are coupled by a velocity cross-term like x˙θ˙, each conjugate momentum is a mix of both velocities, so Step 3 requires inverting a 2×2 linear system.
Coupled Coordinates and the Quadratic Kinetic Energy Shortcut
Step 1: Write the Lagrangian with the velocity cross-termAdding the cart's horizontal velocity x˙ and the pendulum bob's swinging velocity ℓθ˙ produces an x˙θ˙ cross-term in T.
Step 2: Find the conjugate momenta and write the 2×2 matrix systemDifferentiating L with respect to x˙ and θ˙ couples both velocities in each momentum equation.
Step 3: Invert the 2×2 matrix to solve for x˙ and θ˙Swap the diagonal entries, negate the off-diagonal entries, and divide by the determinant D=(M+m)mℓ2−m2ℓ2cos2θ=mℓ2(M+msin2θ).
Step 4: Use the quadratic kinetic energy shortcut H=21(pxx˙+pθθ˙)+V(θ)Because T contains only quadratic velocity terms (x˙2,x˙θ˙, and θ˙2), pxx˙+pθθ˙=2T, so we multiply the velocity fractions by 21px and 21pθ and add them over their common denominator without squaring them.
Because the cart's position x does not appear in H,p˙x=−∂x∂H=0, so the horizontal conjugate momentum px is conserved.
4
Moving Coordinates, Total Energy, and Conservation of the Hamiltonian
The relation H=T+V fails whenever a moving constraint puts linear velocity terms (T1) or velocity-independent terms (T0) into the kinetic energy. Let's find the Hamiltonian for a mass m on a spring of stiffness k attached to a cart pulled to the right at constant speed u by a motor, using the extension x measured relative to the cart.
Moving Coordinates, Total Energy, and Conservation of the Hamiltonian
THdtdH=21m(x˙+u)2=?T+V=?
Text solution
Step 1: Expand the Lagrangian in the moving coordinate x into T2,T1, and T0 piecesSince the mass has room position X=x+ut and room velocity X˙=x˙+u, expanding T=21m(x˙+u)2 produces a quadratic term T2, a linear term T1, and a velocity-independent term T0.
Step 2: Find the conjugate momentum p and solve for x˙Differentiating L with respect to x˙ picks up the constant shift mu from the linear term T1.
p=∂x˙∂L=mx˙+mu⟹x˙=mp−mu
Step 3: Compute H=px˙−L and substitute x˙=mp−muIn px˙−L, the quadratic piece becomes +T2, the linear piece mux˙ cancels out completely, and the velocity-independent piece flips sign to −T0.
Step 4: Compare H(x,p) with the room-coordinate Hamiltonian H(X,P,t)In the room coordinate X, the kinetic energy is purely quadratic (T=21mX˙2) and the spring potential is 21k(X−ut)2, so H(X,P,t) equals the total room energy T+V but contains t explicitly.
In the moving coordinate x,H(x,p) does not equal the total room energy E=T+V=2mp2+21kx2 because T has the T1 and T0 pieces, and E is not conserved because the motor does work on the spring, yet H(x,p) is strictly conserved (∂t∂H=0) because u is constant and t does not appear explicitly in H.
5
Phase Space and Flow Along Constant-H Contours
On a 1D position line x, a single dot does not tell us the particle's velocity, so paths moving at different velocities cross over each other. Plotting position x and momentum p as the axes of a 2D plane called phase space gives every state (x,p) a unique velocity vector (x˙,p˙).
Phase Space and Flow Along Constant-H Contours
Comparing the uphill gradient vector ∇H on the H(x,p) surface with the phase-space velocity vector (x˙,p˙) from Hamilton's equations shows that their components are swapped with one sign flipped:
∇H(x˙,p˙)=(∂x∂H,∂p∂H),=(∂p∂H,−∂x∂H)
At every point (x,p), this makes the phase-space velocity (x˙,p˙) a 90∘ rotation of the uphill gradient ∇H. When H(x,p) does not depend on time, the trajectory stays tangent to a single constant-H contour, and two phase-space paths never cross.
Turning the uphill direction by 90 degrees keeps the velocity tangent to the contour at every point, so the motion never climbs or drops across contours and two paths never cross.
Key concepts
To go from a Lagrangian L(q,q˙,t) to Hamilton's equations, find each conjugate momentum pi=∂q˙i∂L, invert to get the velocities q˙i(q,p,t), and eliminate all velocities inside the Hamiltonian:
Never plug q˙i(q,p) directly into L without forming ∑ipiq˙i−L first, because differentiating with pi held fixed flips the sign of coordinate-dependent kinetic terms like 21mr2θ˙2→2mr2pθ2. How you simplify H depends on how the velocities appear in T:
Key concept
When T has uncoupled quadratic velocities (such as T=21mr˙2+21mr2θ˙2), each momentum isolates a single velocity (pθ=mr2θ˙), so you don't need a matrix inversion and can write H=T+V=2mpr2+2mr2pθ2+V(r) directly.
Key concept
When T has coupled quadratic velocities (such as a cross-term mℓcosθx˙θ˙), invert the 2×2 momentum matrix for x˙ and θ˙ and use the quadratic shortcut H=21(pxx˙+pθθ˙)+V so you don't have to square the velocity fractions.
Key concept
When moving or rotating constraints introduce linear (T1) or velocity-independent (T0) terms in T (such as T=21m(x˙+u)2=21mx˙2+mux˙+21mu2), do not use H=T+V or the 21∑ipiq˙i shortcut; write out H=∑ipiq˙i−L in full, where T1 cancels out and +T0 flips to −T0. Even when H=T+V,H is conserved whenever t is absent from H, and any coordinate qi missing from H gives a conserved momentum pi.
6
Practice
1
A bead of mass m slides without friction along a curved wire with V(q)=0 and kinetic energy T=21m(1+αq2)q˙2, where α is a positive constant. (a) Find the conjugate momentum p, solve for q˙ in terms of q and p, and compute both (∂q∂T)q˙ (holding q˙ fixed) and (∂q∂T)p (after eliminating q˙ in favor of p and holding p fixed). Explain physically why the two partial derivatives have opposite signs. (b) Construct H(q,p)=pq˙−L and show how Hamilton's equation p˙=−∂q∂H restores the correct sign to match the Euler-Lagrange equation p˙=(∂q∂L)q˙.
In part (a), when you plug q˙=m(1+αq2)p into T=21m(1+αq2)q˙2, notice how many powers of (1+αq2) cancel and where the remaining factor sits.
(a) Since V(q)=0,L=T=21m(1+αq2)q˙2. Differentiating with respect to q while holding q˙ fixed gives:
(∂q∂T)q˙=∂q∂[21m(1+αq2)q˙2]=+mαqq˙2
The conjugate momentum is:
p=∂q˙∂L=m(1+αq2)q˙⟹q˙=m(1+αq2)p
Substituting q˙(q,p) into T puts one factor of (1+αq2) into the denominator:
T(q,p)=21m(1+αq2)[m(1+αq2)p]2=2m(1+αq2)p2
(Warning: Do not forget to square (1+αq2) when squaring q˙, which would cancel (1+αq2) completely and give 2mp2 with a derivative of 0; and when differentiating (1+αq2)−1, remember the negative power rule factor −1, or you will get +mαqq˙2 here and the wrong sign in part (b).)
Differentiating T(q,p) with respect to q while holding p fixed gives:
The two partial derivatives have opposite signs because increasing q at fixed velocity q˙ increases the effective inertia factor m(1+αq2) and raises T, whereas increasing q at fixed momentum p forces q˙=m(1+αq2)p to decrease so rapidly that T drops.
(b) Building H(q,p)=pq˙−L gives:
H(q,p)=p[m(1+αq2)p]−2m(1+αq2)p2=2m(1+αq2)p2
Applying Hamilton's equation p˙=−∂q∂H introduces a minus sign that flips −m(1+αq2)2αqp2 back to positive, matching p˙=(∂q∂L)q˙:
At a fixed position x0 and time t0, a particle's Lagrangian L(x0,v,t0) is plotted as a function of velocity v. At v=4.0 m/s, the height of the curve is L=10 J and the tangent line to the curve has slope 12 kg⋅m/s. (a) What are the conjugate momentum p and the Hamiltonian H at this state, and where does the tangent line intersect the vertical axis at v=0? (b) If a small nudge changes the momentum by dp=0.50 kg⋅m/s while x0 and t0 are held fixed, by how much does H change, and why does the accompanying change dv not contribute to dH?
For part (a), how much does a line of slope p drop as you trace it back from v=4.0 m/s to v=0? For part (b), use Hamilton's equation for ∂p∂H.
(a) The conjugate momentum is the velocity slope of L, so:
p=∂v∂L=12 kg⋅m/s
The Hamiltonian is:
H=pv−L=(12 kg⋅m/s)(4.0 m/s)−10 J=48 J−10 J=38 J
(Warning: Do not swap the subtraction to L−pv=10 J−48 J=−38 J when finding H;−38 J is the signed coordinate of the vertical intercept on the L-axis, whereas H=pv−L=+38 J is the depth below zero.)
Tracing the tangent line back from v=4.0 m/s to v=0 drops its height by pv=48 J from L=10 J, so it intersects the vertical axis at 10 J−48 J=−38 J (a depth of H=38 J below zero).
(b) With dx=0 and dt=0, Hamilton's equation ∂p∂H=x˙=v gives:
dH=∂p∂Hdp=vdp=(4.0 m/s)(0.50 kg⋅m/s)=2.0 J
(Warning: Do not multiply pdp=(12)(0.50)=6.0 kg2⋅m2/s2; the slope of H with respect to p is v=4.0 m/s, not p.)
The accompanying velocity change dv does not contribute to dH because d(pv)=vdp+pdv and dL=pdv (at fixed x0 and t0) contain the exact same +pdv term, which cancels out in dH=d(pv)−dL=vdp.
3
A spherical pendulum consists of a bob of mass m on a rigid massless rod of length ℓ swinging in uniform gravity g. Using the polar angle θ from the downward vertical and the azimuthal angle ϕ around the vertical axis, its Lagrangian is L(θ,ϕ,θ˙,ϕ˙)=21mℓ2(θ˙2+sin2θϕ˙2)+mgℓcosθ. (a) Find the conjugate momenta pθ and pϕ and construct the Hamiltonian H(θ,ϕ,pθ,pϕ). (b) Write all four of Hamilton's equations, identify the conserved momentum, and combine the first-order equations to recover the second-order differential equation for θ¨.
In L=T−V, check the sign of V(θ)=−mgℓcosθ when building H. In part (b), write sin2θ1 as (sinθ)−2 before differentiating with respect to θ.
(a) Step 1: The Lagrangian is L=21mℓ2(θ˙2+sin2θϕ˙2)+mgℓcosθ.Step 2: Differentiating L with respect to θ˙ and ϕ˙ gives the conjugate momenta:
pθ=∂θ˙∂L=mℓ2θ˙,pϕ=∂ϕ˙∂L=mℓ2sin2θϕ˙
Step 3Inverting for the angular velocities gives:
θ˙=mℓ2pθ,ϕ˙=mℓ2sin2θpϕ
Step 4Substituting θ˙ and ϕ˙ into H=pθθ˙+pϕϕ˙−L gives:
H(θ,ϕ,pθ,pϕ)=2mℓ2pθ2+2mℓ2sin2θpϕ2−mgℓcosθ
(Warning: Do not keep +mgℓcosθ with a plus sign in H; since L=T−V has V(θ)=−mgℓcosθ, subtracting L flips the potential term to −mgℓcosθ in H=T+V.)
(b) Differentiating H gives Hamilton's four equations:
(Warning: When computing p˙θ=−∂θ∂H, remember that ∂θ∂(sin−2θ)=−2sin−3θcosθ already carries a minus sign, which combines with the minus sign in −∂θ∂H to make the centrifugal term +mℓ2sin3θpϕ2cosθ, not negative.)
Because ϕ is absent from H,pϕ is conserved. Differentiating pθ=mℓ2θ˙ gives p˙θ=mℓ2θ¨, and substituting pϕ=mℓ2sin2θϕ˙ into the p˙θ equation yields:
A wedge of mass M and incline angle α slides without friction along a horizontal table at position x, while a block of mass m slides a distance s down the wedge's incline relative to the wedge. The Lagrangian is L(x,s,x˙,s˙)=21(M+m)x˙2+mcosαx˙s˙+21ms˙2+mgssinα. (a) Find the conjugate momenta px and ps, write them as a 2×2 matrix equation, and invert the matrix to solve for x˙ and s˙ in terms of px and ps. (b) Use the quadratic kinetic energy shortcut H=21(pxx˙+pss˙)+V(s) to write H(x,s,px,ps), and identify which conjugate momentum is conserved.
In part (a), use 1−cos2α=sin2α to simplify the determinant D of the 2×2 matrix before writing x˙ and s˙.
(a) Differentiating L with respect to x˙ and s˙ gives the conjugate momenta:
(Warning: When inverting the 2×2 matrix, be sure to swap the diagonal entries M+m and m as well as negating the off-diagonal mcosα entries; leaving M+m in the top-left position gives the wrong numerator (M+m)px−mcosαps for x˙ and swaps the coefficients of px2 and ps2 in H.)
Swapping the diagonal entries, negating the off-diagonal entries, and dividing by D gives:
Because x does not appear in H,p˙x=−∂x∂H=0, so px is conserved.
5
A bead of mass m slides without friction on a vertical circular hoop of radius R that a motor spins about its vertical diameter at a constant angular speed ω. Using the bead's angle θ from the bottom of the hoop, the kinetic energy is T=21mR2θ˙2+21mR2ω2sin2θ and the gravitational potential energy is V(θ)=−mgRcosθ. (a) Find H(θ,pθ) and compare it to the total mechanical energy E=T+V. Explain why H=T+V and why H is conserved even though E is not. (b) If the motor instead ramps up the spin rate so that ω(t)=αt (with α constant), find dtdH and state whether H is conserved.
Separate T into its quadratic piece T2=21mR2θ˙2 and its velocity-independent piece T0=21mR2ω2sin2θ, and watch what happens to T0 in H=pθθ˙−L.
(a) Step 1: The Lagrangian is L(θ,θ˙)=T−V=21mR2θ˙2+21mR2ω2sin2θ+mgRcosθ.Step 2: The conjugate momentum is pθ=∂θ˙∂L=mR2θ˙.Step 3: Solving for θ˙ gives θ˙=mR2pθ.Step 4: Computing H=pθθ˙−L gives:
H(θ,pθ)=2mR2pθ2−21mR2ω2sin2θ−mgRcosθ
(Warning: Do not use the shortcut H=T+V here, which would give +21mR2ω2sin2θ; the rotating hoop constraint puts a velocity-independent piece T0=21mR2ω2sin2θ into T, and subtracting L flips +T0 to −T0.)
In contrast, the total mechanical energy is:
E=T+V=2mR2pθ2+21mR2ω2sin2θ−mgRcosθ
First check (H=T+V?): H=T+V because the moving constraint of the spinning hoop introduces the velocity-independent term T0=21mR2ω2sin2θ into T, which becomes −T0 in H=pθθ˙−L. Second check (Is H conserved?): Since ω is constant, time t does not appear explicitly in H(∂t∂H=0), so H is conserved; E=T+V is not conserved because the motor must do work on the hoop to keep ω constant as the bead slides.
(b) When ω(t)=αt, the Hamiltonian becomes explicitly time-dependent:
H(θ,pθ,t)=2mR2pθ2−21mR2α2t2sin2θ−mgRcosθ
Its rate of change along the motion is:
dtdH=∂t∂H=−mR2α2tsin2θ=0
Because ∂t∂H=0,H is no longer conserved.
6
A 1D harmonic oscillator of mass m and spring stiffness k has Hamiltonian H(x,p)=2mp2+21kx2. (a) Find the uphill gradient vector ∇H=(∂x∂H,∂p∂H) and the phase-space velocity vector (x˙,p˙) at any point (x,p), verify that their dot product is zero, and explain what this means for how the oscillator moves on the contour map of H(x,p). (b) At a given instant, two identical oscillators both pass through x=0 with the same energy E, one with momentum +p0 and the other with momentum −p0. Explain why their paths cross on the 1D position line x but never cross in the 2D (x,p) phase space.
In part (a), check which derivative goes in each slot of ∇H=(∂x∂H,∂p∂H) versus (x˙,p˙)=(∂p∂H,−∂x∂H).
(a) Differentiating H(x,p)=2mp2+21kx2 gives the uphill gradient vector and the phase-space velocity vector:
(Warning: Do not forget the minus sign in p˙=−∂x∂H=−kx; writing +kx gives (x˙,p˙)=(mp,kx) and a nonzero dot product m2kxp, which would make the oscillator climb across energy contours instead of conserving energy.)
Taking their dot product gives:
∇H⋅(x˙,p˙)=(kx)(mp)+(mp)(−kx)=0
Because (x˙,p˙) is everywhere perpendicular to the uphill gradient ∇H, the oscillator has zero velocity component uphill or downhill on the H(x,p) surface and flows tangent to the elliptical contour of constant H.
(b) On the 1D position line x, both oscillators pass through the exact same coordinate x=0 while moving in opposite directions because position alone does not record momentum. In the 2D (x,p) phase space, (0,+p0) and (0,−p0) are two distinct points on the same constant-H ellipse, and because Hamilton's equations assign one unique velocity vector (x˙,p˙)=(mp,−kx) to every point (x,p), phase-space trajectories never cross: both states go clockwise around that ellipse half a period apart, always at opposite points (x,p) and (−x,−p), so they are never at the same phase-space point at the same time.