2.1.12Analytical Mechanics

Hamilton's equations of motion

1,744 words8 min readdifficulty · medium4 backlinks

1. WHAT is the Hamiltonian? (derivation from scratch)

We start from the Lagrangian L(qi,q˙i,t)L(q_i,\dot q_i,t). The Euler–Lagrange equations are ddtLq˙iLqi=0.\frac{d}{dt}\frac{\partial L}{\partial \dot q_i}-\frac{\partial L}{\partial q_i}=0.

HOW do we switch variables cleanly? We use a Legendre transform. The trick: if a function depends on a variable q˙\dot q, but we'd rather it depend on its slope p=L/q˙p=\partial L/\partial\dot q, we form a new function whose differential no longer contains dq˙d\dot q.


2. DERIVING Hamilton's equations (the heart)

Take the total differential of H=ipiq˙iLH=\sum_i p_i\dot q_i - L: dH=i(q˙idpi+pidq˙i)i(Lqidqi+Lq˙idq˙i)Ltdt.dH=\sum_i\big(\dot q_i\,dp_i+p_i\,d\dot q_i\big)-\sum_i\Big(\frac{\partial L}{\partial q_i}dq_i+\frac{\partial L}{\partial \dot q_i}d\dot q_i\Big)-\frac{\partial L}{\partial t}dt.

After cancellation, and using L/qi=p˙i\partial L/\partial q_i=\dot p_i (from Euler–Lagrange, since p˙i=ddtLq˙i=Lqi\dot p_i=\frac{d}{dt}\frac{\partial L}{\partial \dot q_i}=\frac{\partial L}{\partial q_i}): dH=iq˙idpiip˙idqiLtdt.dH=\sum_i\dot q_i\,dp_i-\sum_i\dot p_i\,dq_i-\frac{\partial L}{\partial t}dt.

But by definition of a differential of H(q,p,t)H(q,p,t): dH=iHqidqi+iHpidpi+Htdt.dH=\sum_i\frac{\partial H}{\partial q_i}dq_i+\sum_i\frac{\partial H}{\partial p_i}dp_i+\frac{\partial H}{\partial t}dt.

Matching coefficients of the independent differentials dqi,dpi,dtdq_i,\,dp_i,\,dt:

WHY the minus sign? It comes purely from matching p˙idqi-\dot p_i\,dq_i with +Hqidqi+\frac{\partial H}{\partial q_i}dq_i. The asymmetric sign is what makes phase-space flow area-preserving (Liouville) — it is a feature, not a typo.

Figure — Hamilton's equations of motion

3. Conservation of HH (Forecast-then-Verify)


4. Worked Example A — 1D particle in a potential

System: L=12mx˙2V(x)L=\tfrac12 m\dot x^2 - V(x).

  1. Momentum. p=Lx˙=mx˙p=\dfrac{\partial L}{\partial\dot x}=m\dot x. Why this step? It defines the variable replacing x˙\dot x, and lets us invert x˙=p/m\dot x=p/m.
  2. Hamiltonian. H=px˙L=ppm(12m(pm)2V)=p22m+V(x)H=p\dot x-L = p\cdot\frac{p}{m}-\big(\tfrac12 m(\frac{p}{m})^2-V\big)=\dfrac{p^2}{2m}+V(x). Why this step? Substituting x˙=p/m\dot x=p/m everywhere expresses HH in (x,p)(x,p) only — here it equals total energy T+VT+V.
  3. Equations. x˙=Hp=pm,p˙=Hx=dVdx.\dot x=\frac{\partial H}{\partial p}=\frac{p}{m},\qquad \dot p=-\frac{\partial H}{\partial x}=-\frac{dV}{dx}. Why this step? The second is just mx¨=V(x)m\ddot x=-V'(x)Newton's second law re-emerges, confirming consistency.

5. Worked Example B — Simple Harmonic Oscillator

V=12mω2x2V=\tfrac12 m\omega^2 x^2, so H=p22m+12mω2x2H=\dfrac{p^2}{2m}+\dfrac12 m\omega^2 x^2. x˙=pm,p˙=mω2x.\dot x=\frac{p}{m},\qquad \dot p=-m\omega^2 x. Why interesting? Eliminating pp: x¨=ω2x\ddot x=-\omega^2 x. In phase space (x,p)(x,p) the trajectory is an ellipse of constant energy — the orbit encloses constant area pdx=2πE/ω\oint p\,dx = 2\pi E/\omega, a hint of action quantization.


6. Worked Example C — Mass on a frictionless wire bead / generic check

Show the abstract recipe always reduces to Newton when H=T+VH=T+V with p=mq˙p=m\dot q; the structure guarantees it.



Recall Feynman: explain to a 12-year-old

Imagine you describe a swinging ball not by "where it is and how fast," but by "where it is and how much push it carries" (that push is momentum). Hamilton found two beautifully simple rules: how the position changes depends on how the energy changes with push, and how the push changes depends on how the energy changes with position — with a minus sign so nothing runs away. Plot position sideways and push upward, and the ball traces a closed loop forever, like a clock hand. The size of the loop never changes — that's energy staying constant.


Active-Recall Flashcards

What is the generalized momentum conjugate to qiq_i?
pi=L/q˙ip_i=\partial L/\partial\dot q_i
Define the Hamiltonian via a Legendre transform.
H=ipiq˙iLH=\sum_i p_i\dot q_i - L, with q˙i\dot q_i expressed in terms of (q,p)(q,p).
State Hamilton's two canonical equations.
q˙i=H/pi\dot q_i=\partial H/\partial p_i and p˙i=H/qi\dot p_i=-\partial H/\partial q_i.
Why does dq˙id\dot q_i vanish in dHdH?
Because L/q˙i=pi\partial L/\partial\dot q_i=p_i, so pidq˙ip_i d\dot q_i cancels Lq˙idq˙i\frac{\partial L}{\partial\dot q_i}d\dot q_i — the Legendre transform.
What is dH/dtdH/dt along a trajectory?
dH/dt=H/tdH/dt=\partial H/\partial t; hence HH conserved if no explicit tt.
When does HH equal total energy EE?
When KE is quadratic in velocities AND constraints are time-independent (scleronomic).
For H=p2/2m+V(x)H=p^2/2m+V(x), what are the equations of motion?
x˙=p/m\dot x=p/m, p˙=V(x)\dot p=-V'(x), equivalent to mx¨=Vm\ddot x=-V'.
Why the minus sign in p˙=H/q\dot p=-\partial H/\partial q?
It is forced by matching differentials in dHdH; it makes phase-space flow energy-preserving.
What is the relation between H/t\partial H/\partial t and L/t\partial L/\partial t?
H/t=L/t\partial H/\partial t=-\partial L/\partial t.
How many first-order equations replace the nn second-order Lagrange equations?
2n2n first-order equations in phase space.

Connections

Concept Map

E-L equations

dL/dqdot

promoted via

builds

subtracted in

expand

makes cancel

after

gives pdot=dL/dq

match coefficients

live in

doorway to

Lagrangian L q qdot t

Euler-Lagrange equations

Conjugate momentum p

Legendre transform

Hamiltonian H q p t

Total differential dH

Velocity terms cancel

Hamilton canonical equations

Phase space 2n first-order flow

Poisson brackets, Liouville, QM

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, Lagrangian mechanics mein hum position qq aur velocity q˙\dot q use karte hain, aur humein nn second-order equations milti hain. Hamilton ne ek smart chaal chali: velocity ko hatao, uski jagah momentum p=L/q˙p=\partial L/\partial \dot q le aao. Phir ek naya function banao — Hamiltonian H=pq˙LH=\sum p\dot q - L — jo sirf (q,p)(q,p) par depend karta hai. Yeh swap ek Legendre transform se hota hai, aur uska kamaal yeh hai ki dq˙d\dot q wala term apne aap cancel ho jaata hai kyunki L/q˙\partial L/\partial\dot q to pp hi hai.

Iske baad do simple equations nikalti hain: q˙=+H/p\dot q = +\partial H/\partial p aur p˙=H/q\dot p = -\partial H/\partial q. Yeh canonical equations kehlati hain. Note karo minus sign sirf pp wale equation mein aata hai — yeh koi galti nahi, yahi minus energy ko conserve rakhta hai. Yaad rakhne ka tareeka: "q follows p plus, p fights q minus."

Kyun important hai? Kyunki ab system ka pura state ek single point ban jaata hai (q,p)(q,p) phase space mein, aur uska future ek unique line par chalta hai. Simple harmonic oscillator mein yeh line ek ellipse hoti hai jiska area constant rehta hai — yahi aage chal kar Liouville's theorem aur quantum mechanics tak le jaata hai.

Ek warning: HH hamesha total energy EE ke barabar nahi hota. Sirf jab kinetic energy velocity mein quadratic ho aur constraints time pe depend na karein, tab H=EH=E. Aur agar HH mein explicit time nahi hai, to HH conserve hota hai — yeh yaad rakhna exam ke liye gold hai.

Go deeper — visual, from zero

Test yourself — Analytical Mechanics

Connections