Intuition What this page is
The parent note showed you the recipe: find the momentum p = ∂ L / ∂ q ˙ , invert it, and assemble H = ∑ p i q ˙ i − L . This page throws every kind of system at that recipe so you never meet a case you haven't already solved. We march through a matrix of scenarios — clean energy cases, cases where H = E , cases where H isn't even conserved, multi-coordinate systems, a magnetic (velocity-dependent) potential, and an exam twist.
Before we start: recall the two questions we always ask about a Hamiltonian.
Is H conserved? Yes exactly when ∂ L / ∂ t = 0 (no naked t in the Lagrangian).
Is H the energy T + V ? Yes only when T is a pure quadratic in the velocities (explained in the refresher just below) and V has no velocity in it.
These two questions are independent — that is the whole drama of this page.
Recall Two refreshers you'll need (so this page stands alone)
Euler's theorem, in one line. If T is built purely from terms like q ˙ j q ˙ k (each term has exactly two velocity factors), then differentiating and summing gives back 2 T : ∑ i q ˙ i ∂ q ˙ i ∂ T = 2 T . Picture: each of the two velocity factors "gets counted once", so you recover T twice. This is exactly why ∑ p i q ˙ i = 2 T and hence H = 2 T − ( T − V ) = T + V — but only when every term in T has exactly two velocity factors.
Jacobi integral, in one line. When L has no explicit t but T is not a pure velocity-quadratic (e.g. a moving constraint adds a velocity-free piece), the conserved quantity H = ∑ p i q ˙ i − L still exists but is not the energy. That conserved-but-not-energy object has a name: the Jacobi integral . You meet it in cell C4.
Every row below is a distinct "class" of behaviour. The last two columns are the two independent questions above. C8 is the exam twist — its true answers are H conserved: NO, H = E : YES (worked out in full below; try to predict it before you get there).
Cell
Scenario class
Example that hits it
H conserved?
H = E ?
C1
Textbook 1D, H = E = const
(a) free-fall particle
✓
✓
C2
2 coordinates, one cyclic
(b) 2D central motion, polar
✓
✓
C3
Explicit time in L
(c) driven oscillator
✗
✓ (value drifts)
C4
Moving constraint, H = E but conserved
(d) bead on rotating wire
✓
✗
C5
Velocity-dependent potential (magnetic)
(e) charge in magnetic field
✓
✓ (subtle)
C6
Degenerate / zero input
(f) free particle, V = 0 , p = 0 limit
✓
✓ (trivial)
C7
Sign / direction cases
(g) particle thrown up vs down
✓
✓
C8
Exam twist: time-scaled potential
(h) growing stiffness
✗
✓
Every cell is worked below and labelled. Prerequisites we lean on: Lagrangian Mechanics , Legendre Transform , Hamilton's Canonical Equations , Conservation Laws & Noether's Theorem , and Phase Space for the pictures.
Worked example (a) A particle of mass
m falling under gravity, height y .
L = 2 1 m y ˙ 2 − m g y .
Forecast: guess H before reading on. It should be 2 m p 2 + m g y , and it should be both conserved and equal to the energy. Why? Because there's no explicit t , and T = 2 1 m y ˙ 2 is a clean quadratic.
Momentum: p = ∂ y ˙ ∂ L = m y ˙ .
Why this step? The Legendre transform swaps the velocity for its "slope" p = ∂ L / ∂ y ˙ ; we must find that slope first.
Invert: y ˙ = p / m .
Why this step? H must be a function of ( y , p ) only — every y ˙ has to be evicted.
Assemble: H = p y ˙ − L = p ⋅ m p − ( 2 1 m ( p / m ) 2 − m g y ) = m p 2 − 2 m p 2 + m g y .
Why this step? This is the definition H = ∑ p i q ˙ i − L with the inverted velocity plugged in.
H = 2 m p 2 + m g y = T + V = E .
Verify: Hamilton's equations should reproduce free-fall. y ˙ = ∂ H / ∂ p = p / m ✓ (matches step 1). p ˙ = − ∂ H / ∂ y = − m g , i.e. m y ¨ = − m g — Newton's law. ✓ Numerically for m = 2 kg , y ˙ = 3 m/s , y = 5 m , g = 9.8 : p = 6 , H = 36/4 + 2 ⋅ 9.8 ⋅ 5 = 9 + 98 = 107 J .
Worked example (b) A particle of mass
m in a central potential V ( r ) , polar coordinates ( r , θ ) .
L = 2 1 m ( r ˙ 2 + r 2 θ ˙ 2 ) − V ( r ) .
Forecast: two momenta now. θ never appears in L (only θ ˙ does) — so θ is cyclic and its momentum p θ (angular momentum) is conserved. H should be T + V .
Momenta: p r = ∂ r ˙ ∂ L = m r ˙ , p θ = ∂ θ ˙ ∂ L = m r 2 θ ˙ .
Why this step? Each coordinate gets its own conjugate momentum; both slopes are needed.
Invert: r ˙ = p r / m , θ ˙ = p θ / ( m r 2 ) .
Why this step? Two velocities, two evictions.
Assemble: H = p r r ˙ + p θ θ ˙ − L .
H = m p r 2 + m r 2 p θ 2 − ( 2 m p r 2 + 2 m r 2 p θ 2 − V ( r ) ) = 2 m p r 2 + 2 m r 2 p θ 2 + V ( r ) .
Why this step? Same Legendre assembly; the θ ˙ term folds neatly because T is quadratic.
H = 2 m p r 2 + 2 m r 2 p θ 2 + V ( r ) = E .
Verify: Since θ is absent from H , p ˙ θ = − ∂ H / ∂ θ = 0 — angular momentum conserved, as Conservation Laws & Noether's Theorem predicts for rotational symmetry. ✓ Numerically at r = 2 , p r = 1 , p θ = 4 , m = 1 , V = 0 : H = 1/2 + 16/ ( 2 ⋅ 4 ) = 0.5 + 2 = 2.5 .
The extra 2 m r 2 p θ 2 term is the centrifugal barrier . Read the figure below like this: the blue curve is the raw attractive potential V ( r ) = − k / r (a well that pulls inward), the pink curve is the centrifugal term p θ 2 / ( 2 m r 2 ) (a wall that shoots up near r = 0 , since dividing by r 2 blows up), and the yellow curve is their sum V eff . Notice the yellow curve dips to a minimum at a finite radius — that dip is a stable circular orbit , the radius where inward pull and outward barrier balance. The barrier is the whole reason a central-force particle with nonzero p θ never falls into the centre.
Worked example (c) A 1D oscillator pushed by an external force
F ( t ) = F 0 cos ( Ω t ) .
L = 2 1 m x ˙ 2 − 2 1 k x 2 + F 0 cos ( Ω t ) x .
Forecast: the term F 0 cos ( Ω t ) x contains t explicitly , so ∂ L / ∂ t = 0 — expect H not conserved. But T is still a clean quadratic and V has no velocity, so H should still numerically equal T + V at each instant.
Momentum: p = m x ˙ , invert x ˙ = p / m .
Why this step? The driving term has no x ˙ , so it doesn't touch the momentum.
Assemble: H = p x ˙ − L = 2 m p 2 + 2 1 k x 2 − F 0 cos ( Ω t ) x .
Why this step? Standard assembly; note the drive survives with a minus sign (it was + F 0 cos ( Ω t ) x in L , so − L flips it to − F 0 cos ( Ω t ) x ).
H = 2 m p 2 + 2 1 k x 2 − F 0 cos ( Ω t ) x .
Time behaviour: d t d H = ∂ t ∂ H = + F 0 Ω sin ( Ω t ) x = 0 .
Why this step? The total time-derivative of H along motion equals ∂ H / ∂ t (from Hamilton's equations the q , p parts cancel), and here that partial is nonzero.
Verify: Is H = E instant-by-instant? E = T + V = 2 m p 2 + 2 1 k x 2 − F 0 cos ( Ω t ) x — yes, identical, because V now includes the drive term. So H = E but neither is conserved : energy pumps in and out. Numeric snapshot: m = 1 , k = 4 , F 0 = 3 , Ω = 2 , at t = 0 so cos = 1 , sin = 0 , x = 1 , p = 2 : H = 2 + 2 − 3 = 1 ; and d H / d t = 3 ⋅ 2 ⋅ 0 ⋅ 1 = 0 at this instant. ✓
Worked example (d) Bead of mass
m on a wire spun at fixed angular rate ω ; radial coord r .
The constraint ϕ = ω t is time-dependent. T = 2 1 m ( r ˙ 2 + r 2 ω 2 ) , V = 0 :
L = 2 1 m r ˙ 2 + 2 1 m r 2 ω 2 .
Forecast: danger. T has a piece 2 1 m r 2 ω 2 that carries no r ˙ — it's not a pure quadratic in the velocity . So Euler's theorem's "∑ p q ˙ = 2 T " fails and we should get H = E . But L has no explicit t (the ω t was substituted away), so H is still conserved.
Momentum: p r = ∂ L / ∂ r ˙ = m r ˙ , invert r ˙ = p r / m .
Why this step? Only r ˙ appears; the ω term is velocity-free.
Assemble: H = p r r ˙ − L = m p r 2 − ( 2 m p r 2 + 2 1 m r 2 ω 2 ) = 2 m p r 2 − 2 1 m r 2 ω 2 .
Why this step? The velocity-free term is untouched by the Legendre swap, so it survives into H with the sign of − L : minus .
H = 2 m p r 2 − 2 1 m r 2 ω 2 .
Compare to energy: E = T + V = 2 m p r 2 + 2 1 m r 2 ω 2 . So H = E − m r 2 ω 2 = E .
Why this step? The rotating wire feeds energy through the constraint; H is a different conserved bookkeeping quantity — the Jacobi integral from the refresher above.
Verify: conserved? ∂ L / ∂ t = 0 ✓, so d H / d t = 0 . Not the energy? at r = 1 , ω = 2 , m = 1 , p r = 3 : H = 9/2 − 2 = 2.5 , while E = 9/2 + 2 = 6.5 . Different. ✓
Worked example (e) Charge
e , mass m , in a uniform field B = B z ^ , using vector potential A = 2 1 B × r .
The magnetic Lagrangian is L = 2 1 m ∣ r ˙ ∣ 2 + e r ˙ ⋅ A . We keep the full vector throughout — the vectors just carry along for the ride, and to sanity-check numbers at the end we'll drop to one scalar component.
Forecast: here the "potential" term e r ˙ ⋅ A contains velocity , so the naive "H = T + V " argument is void. The surprise: because that term is linear in r ˙ , it cancels out of H and we still get H = kinetic energy.
Momentum: p = ∂ r ˙ ∂ L = m r ˙ + e A . This is the canonical momentum, not m v .
Why this step? The linear-in-velocity term shifts the slope; forgetting the e A is the classic magnetic mistake.
Invert: r ˙ = ( p − e A ) / m .
Why this step? Evict the velocity; note the combination p − e A = m v is the kinetic momentum.
Assemble: H = p ⋅ r ˙ − L . Substituting and simplifying (the linear terms cancel):
H = 2 m ( p − e A ) 2 .
Why this step? p ⋅ r ˙ = m 1 p ⋅ ( p − e A ) and L = 2 m ( p − e A ) 2 + m e A ⋅ ( p − e A ) ; subtracting kills the cross terms.
Verify: H = 2 1 m ∣ v ∣ 2 = T — pure kinetic energy, since a magnetic force does no work. So H = E is true, but only after correctly using canonical momentum. Numeric scalar check (one component, A meaning the relevant component of A ): let m = 1 , e = 1 , A = 2 , p = 5 : kinetic momentum = 5 − 2 = 3 , H = 3 2 /2 = 4.5 ; and T = 2 1 m v 2 with v = 3 gives 4.5 . ✓ Same. L is time-independent, so H is conserved too. ✓
Worked example (f) Free particle,
V = 0 , and the limit p → 0 .
L = 2 1 m x ˙ 2 .
Forecast: with no potential, H = pure kinetic. At the degenerate point p = 0 (particle at rest) H = 0 . Nothing should blow up.
Momentum: p = m x ˙ , invert x ˙ = p / m .
Why this step? Standard; no potential to worry about.
Assemble: H = p x ˙ − L = m p 2 − 2 m p 2 = 2 m p 2 .
Why this step? Plug the inverted velocity into the definition H = p x ˙ − L ; with no potential only the kinetic piece survives.
Degenerate check p = 0 : H = 0 , x ˙ = ∂ H / ∂ p = 0 , p ˙ = − ∂ H / ∂ x = 0 . The particle sits still forever — a fixed point in Phase Space .
Why this step? Zero input must give a sensible (non-singular) answer; it does.
H = 2 m p 2 .
Verify: p ˙ = 0 everywhere (no force), so p is conserved — momentum conservation from translational symmetry. At p = 0 : H = 0 . ✓ At p = 4 , m = 2 : H = 16/4 = 4 . ✓
Worked example (g) The C1 particle again, but examine both signs of velocity: thrown
up (y ˙ > 0 , so p > 0 ) and thrown down (y ˙ < 0 , so p < 0 ).
H = 2 m p 2 + m g y .
Forecast: H depends on p 2 , so both signs give the same energy at the same height — up and down at the same speed are indistinguishable to H . The sign of p only sets the direction of motion in phase space.
Up case: y ˙ = + 3 m/s , m = 2 , so p = + 6 , at y = 5 : H = 36/4 + 2 ⋅ 9.8 ⋅ 5 = 9 + 98 = 107 .
Why this step? Positive p means y ˙ = ∂ H / ∂ p = p / m > 0 , moving up.
Down case: y ˙ = − 3 m/s , so p = − 6 , same y = 5 : H = ( − 6 ) 2 /4 + 98 = 9 + 98 = 107 .
Why this step? Negative p means moving down, but p 2 erases the sign — same energy.
Verify: both give 107 J ; the phase-space trajectory is a parabola symmetric under p → − p . ✓ This mirror symmetry is exactly the up/down flight of a thrown ball.
Read the figure below like this: the horizontal axis is momentum p , the vertical axis is height y , and the yellow curve is the set of all ( p , y ) with the same H = 107 J . The blue dot (right) is "thrown up, p = + 6 " and the pink dot (left) is "thrown down, p = − 6 " — both sit at the same height y = 5 , mirror images across the vertical p = 0 axis. That left–right mirror symmetry is the fact that H only sees p 2 : swapping the direction of travel leaves the energy untouched.
Worked example (h) A particle in a potential whose
strength grows in time : V ( x , t ) = 2 1 k ( t ) x 2 with k ( t ) = k 0 e t / τ .
L = 2 1 m x ˙ 2 − 2 1 k 0 e t / τ x 2 .
Forecast (guess before solving!): (i) Is H = E ? T is a clean quadratic, V has no velocity — so yes, H = T + V . (ii) Is H conserved? L has explicit t (the e t / τ ) — so no . The trap is to assume "H = E " ⟹ "H conserved". They are separate!
Momentum: p = m x ˙ , invert x ˙ = p / m .
Why this step? The time-dependent stiffness sits in V , not touching p .
Assemble: H = p x ˙ − L = 2 m p 2 + 2 1 k 0 e t / τ x 2 = T + V = E . ✓ (so H = E )
Why this step? Legendre on a clean quadratic gives T + V exactly; the whole time-dependence rides along untouched inside V .
H = 2 m p 2 + 2 1 k 0 e t / τ x 2 .
Conservation: d t d H = ∂ t ∂ H = 2 1 k 0 ⋅ τ 1 e t / τ x 2 = 0 .
Why this step? Along the motion, d H / d t = ∂ H / ∂ t ; the explicit t in the stiffness leaks energy in. Not conserved.
Verify: at t = 0 , τ = 1 , k 0 = 4 , m = 1 , x = 1 , p = 2 : H = 2 + 2 = 4 (energy). d H / d t = 2 1 ⋅ 4 ⋅ 1 ⋅ 1 ⋅ 1 = 2 = 0 . So H = E = 4 J right now but rising. ✓ Answer to the twist: H = E YES, H conserved NO.
Recall The two independent switches
Conserved? ::: Yes iff ∂ L / ∂ t = 0 (no naked t in L ).
Equal to energy? ::: Yes iff T is a pure quadratic in velocities AND V is velocity-free.
Cell where conserved but NOT energy ::: C4, bead on rotating wire (the Jacobi integral).
Cell where energy but NOT conserved ::: C3 and C8, explicit time in L .
Cell where BOTH hold ::: C1, C2, C6, C7 (and C5 after using canonical momentum).
Putting it all together: the eight cells are just the four combinations of the two switches, each illustrated by a concrete system. C1/C2/C6/C7 sit in the happy corner (conserved and energy). C3 and C8 show "energy but drifting" — turn on explicit time and the value of H ceases to be constant, even though at each frozen instant H still equals T + V . C4 shows the opposite mismatch — "conserved but not energy" — where a moving constraint gives you the Jacobi integral instead of E . C5 is the trap disguised as the happy corner: it looks like it should fail (velocity in the potential) but the linearity rescues it, provided you use the canonical momentum p = m v + e A rather than m v . Master these four corners and no exam scenario can surprise you.
Mnemonic "Time makes it drift, velocity-in-
V makes it lie."
Explicit time in L ⟹ H drifts (not conserved). Velocity hiding in T 's non-quadratic part or in V ⟹ H lies about being the energy.