Skip to content

Hamiltonian Mechanics | Physics

The generalised momentum conjugate to qjq_j is

pj=Lq˙jp_j = \frac{\partial L}{\partial \dot{q}_j}

The Hamiltonian is defined by the Legendre transform:

H(q1,,qn,p1,,pn,t)=j=1npjq˙jLH(q_1, \ldots, q_n, p_1, \ldots, p_n, t) = \sum_{j=1}^n p_j \dot{q}_j - L

When the transformation is regular (i.e., the Hessian 2L/q˙jq˙k\partial^2 L / \partial \dot{q}_j \partial \dot{q}_k Is non-singular), this is well-defined.

If LL does not depend explicitly on time and VV is velocity-independent, then H=T+VH = T + V (total Energy).

4.3 Worked Example: Legendre Transform for the Harmonic Oscillator

Section titled “4.3 Worked Example: Legendre Transform for the Harmonic Oscillator”

Problem. A one-dimensional harmonic oscillator has L=12mx˙212kx2L = \frac{1}{2}m\dot{x}^2 - \frac{1}{2}kx^2. Find the Hamiltonian.

Solution

The conjugate momentum:

p=Lx˙=mx˙    x˙=pmp = \frac{\partial L}{\partial \dot{x}} = m\dot{x} \implies \dot{x} = \frac{p}{m}

The Hamiltonian:

H=px˙L=ppm12mp2m2+12kx2=p22m+12kx2H = p\dot{x} - L = p\frac{p}{m} - \frac{1}{2}m\frac{p^2}{m^2} + \frac{1}{2}kx^2 = \frac{p^2}{2m} + \frac{1}{2}kx^2

This is T+VT + V as expected for a natural system. Hamilton”s equations give:

x˙=Hp=pm,p˙=Hx=kx\dot{x} = \frac{\partial H}{\partial p} = \frac{p}{m}, \quad \dot{p} = -\frac{\partial H}{\partial x} = -kx

Combining: x¨=p˙/m=kx/m\ddot{x} = \dot{p}/m = -kx/mI.e., x¨+(k/m)x=0\ddot{x} + (k/m)x = 0. \blacksquare

4.4 Worked Example: Legendre Transform for the Simple Pendulum

Section titled “4.4 Worked Example: Legendre Transform for the Simple Pendulum”

Problem. Find the Hamiltonian for a simple pendulum of mass mm and length ll.

Solution

From Section 3.4, L=12ml2θ˙2+mglcosθL = \frac{1}{2}ml^2\dot{\theta}^2 + mgl\cos\theta.

Conjugate momentum:

pθ=Lθ˙=ml2θ˙    θ˙=pθml2p_\theta = \frac{\partial L}{\partial \dot{\theta}} = ml^2\dot{\theta} \implies \dot{\theta} = \frac{p_\theta}{ml^2}

Hamiltonian:

H=pθθ˙L=pθ2ml2pθ22ml2mglcosθ=pθ22ml2mglcosθH = p_\theta\dot{\theta} - L = \frac{p_\theta^2}{ml^2} - \frac{p_\theta^2}{2ml^2} - mgl\cos\theta = \frac{p_\theta^2}{2ml^2} - mgl\cos\theta

Hamilton’s equations:

θ˙=Hpθ=pθml2,p˙θ=Hθ=mglsinθ\dot{\theta} = \frac{\partial H}{\partial p_\theta} = \frac{p_\theta}{ml^2}, \quad \dot{p}_\theta = -\frac{\partial H}{\partial \theta} = -mgl\sin\theta

\blacksquare

Theorem 4.1 (Hamilton’s Equations). The equations of motion in Hamiltonian form are

q˙j=Hpj,p˙j=Hqj\dot{q}_j = \frac{\partial H}{\partial p_j}, \quad \dot{p}_j = -\frac{\partial H}{\partial q_j}

These are 2n2n first-order ODEs (compared to nn second-order ODEs in the Lagrangian formulation).

Proof. From H=pjq˙jLH = \sum p_j \dot{q}_j - L:

dH=q˙jdpj+pjdq˙jLqjdqjLq˙jdq˙jLtdtdH = \sum \dot{q}_j\, dp_j + \sum p_j\, d\dot{q}_j - \sum \frac{\partial L}{\partial q_j}\, dq_j - \sum \frac{\partial L}{\partial \dot{q}_j}\, d\dot{q}_j - \frac{\partial L}{\partial t}\, dt

Since pj=L/q˙jp_j = \partial L / \partial \dot{q}_jThe dq˙jd\dot{q}_j terms cancel:

dH=q˙jdpjp˙jdqjLtdtdH = \sum \dot{q}_j\, dp_j - \sum \dot{p}_j\, dq_j - \frac{\partial L}{\partial t}\, dt

Comparing with dH=Hpjdpj+Hqjdqj+HtdtdH = \sum \frac{\partial H}{\partial p_j} dp_j + \sum \frac{\partial H}{\partial q_j} dq_j + \frac{\partial H}{\partial t} dt:

q˙j=Hpj,p˙j=Hqj,Ht=Lt\dot{q}_j = \frac{\partial H}{\partial p_j}, \quad \dot{p}_j = -\frac{\partial H}{\partial q_j}, \quad \frac{\partial H}{\partial t} = -\frac{\partial L}{\partial t}

\blacksquare

Hamiltonian mechanics lives in phase space: the 2n2n-dimensional space with coordinates (q1,,qn,p1,,pn)(q_1, \ldots, q_n, p_1, \ldots, p_n). Each point in phase space represents a complete state of the System (positions and momenta).

A phase portrait is the collection of trajectories in phase space. For a 1D harmonic oscillator, the trajectories are ellipses in the (x,p)(x, p) plane.

Theorem 4.2 (Liouville’s Theorem). The flow in phase space is incompressible: the phase space volume is conserved along trajectories. Equivalently, the phase space density ρ(q,p,t)\rho(q, p, t) satisfies:

dρdt=ρt+j(ρqjq˙j+ρpjp˙j)=0\frac{d\rho}{dt} = \frac{\partial \rho}{\partial t} + \sum_j \left(\frac{\partial \rho}{\partial q_j}\dot{q}_j + \frac{\partial \rho}{\partial p_j}\dot{p}_j\right) = 0

Proof. Consider a volume Ω\Omega in phase space. The rate of change of the volume is:

ddtΩρdqdp=Ωρtdqdp\frac{d}{dt}\int_\Omega \rho\, dq\, dp = \int_\Omega \frac{\partial \rho}{\partial t}\, dq\, dp

By the continuity equation in 2n2n dimensions:

ρt+(ρv)=0\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \mathbf{v}) = 0

Where v=(q˙1,,q˙n,p˙1,,p˙n)\mathbf{v} = (\dot{q}_1, \ldots, \dot{q}_n, \dot{p}_1, \ldots, \dot{p}_n) is the phase space velocity. Using Hamilton’s equations:

v=jq˙jqj+jp˙jpj=j2Hqjpjj2Hpjqj=0\nabla \cdot \mathbf{v} = \sum_j \frac{\partial \dot{q}_j}{\partial q_j} + \sum_j \frac{\partial \dot{p}_j}{\partial p_j} = \sum_j \frac{\partial^2 H}{\partial q_j \partial p_j} - \sum_j \frac{\partial^2 H}{\partial p_j \partial q_j} = 0

By equality of mixed partial derivatives. Therefore:

ρt+ρ(v)+vρ=ρt+vρ=dρdt=0\frac{\partial \rho}{\partial t} + \rho\,(\nabla \cdot \mathbf{v}) + \mathbf{v} \cdot \nabla\rho = \frac{\partial \rho}{\partial t} + \mathbf{v} \cdot \nabla\rho = \frac{d\rho}{dt} = 0

\blacksquare

Intuition. Liouville’s theorem is the classical analogue of unitarity in quantum mechanics. It tells us that phase space volume is conserved --- like an incompressible fluid flowing through phase space. This underlies the ergodic hypothesis of statistical mechanics.

Definition. The Poisson bracket of two functions f(q,p,t)f(q, p, t) and g(q,p,t)g(q, p, t) is:

{f,g}=j=1n(fqjgpjfpjgqj)\{f, g\} = \sum_{j=1}^n \left(\frac{\partial f}{\partial q_j}\frac{\partial g}{\partial p_j} - \frac{\partial f}{\partial p_j}\frac{\partial g}{\partial q_j}\right)

Theorem 4.3 (Equations of Motion via Poisson Brackets). For any function f(q,p,t)f(q, p, t):

dfdt=ft+{f,H}\frac{df}{dt} = \frac{\partial f}{\partial t} + \{f, H\}

In particular, Hamilton’s equations become:

q˙j={qj,H},p˙j={pj,H}\dot{q}_j = \{q_j, H\}, \quad \dot{p}_j = \{p_j, H\}

Proof. Using the chain rule:

dfdt=ft+j(fqjq˙j+fpjp˙j)\frac{df}{dt} = \frac{\partial f}{\partial t} + \sum_j \left(\frac{\partial f}{\partial q_j}\dot{q}_j + \frac{\partial f}{\partial p_j}\dot{p}_j\right)

Substituting Hamilton’s equations:

dfdt=ft+j(fqjHpjfpjHqj)=ft+{f,H}\frac{df}{dt} = \frac{\partial f}{\partial t} + \sum_j \left(\frac{\partial f}{\partial q_j}\frac{\partial H}{\partial p_j} - \frac{\partial f}{\partial p_j}\frac{\partial H}{\partial q_j}\right) = \frac{\partial f}{\partial t} + \{f, H\}

\blacksquare

Properties of Poisson Brackets.

Theorem 4.4. The Poisson bracket satisfies:

  1. Antisymmetry: {f,g}={g,f}\{f, g\} = -\{g, f\}
  2. Linearity: {af+bg,h}=a{f,h}+b{g,h}\{af + bg, h\} = a\{f, h\} + b\{g, h\} for constants a,ba, b
  3. Leibniz rule: {fg,h}=f{g,h}+{f,h}g\{fg, h\} = f\{g, h\} + \{f, h\}g
  4. Jacobi identity: {f,{g,h}}+{g,{h,f}}+{h,{f,g}}=0\{f, \{g, h\}\} + \{g, \{h, f\}\} + \{h, \{f, g\}\} = 0

Proof. Properties (1)—(3) follow directly from the definition. For the Jacobi identity, write out the terms explicitly:

{f,{g,h}}=jfqjpjk(gqkhpkgpkhqk)jfpjqjk(gqkhpkgpkhqk)\{f, \{g, h\}\} = \sum_j \frac{\partial f}{\partial q_j}\frac{\partial}{\partial p_j}\sum_k \left(\frac{\partial g}{\partial q_k}\frac{\partial h}{\partial p_k} - \frac{\partial g}{\partial p_k}\frac{\partial h}{\partial q_k}\right) - \sum_j \frac{\partial f}{\partial p_j}\frac{\partial}{\partial q_j}\sum_k \left(\frac{\partial g}{\partial q_k}\frac{\partial h}{\partial p_k} - \frac{\partial g}{\partial p_k}\frac{\partial h}{\partial q_k}\right)

Expanding and collecting terms, the second-order mixed partial derivatives cancel in groups of three (by equality of mixed partials), yielding the Jacobi identity. \blacksquare

Theorem 4.5. A quantity ff is a constant of motion if and only if f/t+{f,H}=0\partial f/\partial t + \{f, H\} = 0. If ff does not depend explicitly on time, ff is conserved if and only if {f,H}=0\{f, H\} = 0.

Proof. Immediate from Theorem 4.3 with df/dt=0df/dt = 0. \blacksquare

Fundamental Poisson Brackets:

{qj,qk}=0,{pj,pk}=0,{qj,pk}=δjk\{q_j, q_k\} = 0, \quad \{p_j, p_k\} = 0, \quad \{q_j, p_k\} = \delta_{jk}

Definition. Hamilton’s principal function S(q,t)S(q, t) is the action evaluated along the classical path from (q0,t0)(q_0, t_0) to (q,t)(q, t).

Theorem 4.6 (Hamilton-Jacobi Equation). The function SS satisfies:

H(q1,,qn,Sq1,,Sqn,t)+St=0H\left(q_1, \ldots, q_n, \frac{\partial S}{\partial q_1}, \ldots, \frac{\partial S}{\partial q_n}, t\right) + \frac{\partial S}{\partial t} = 0

This is a first-order nonlinear PDE in n+1n + 1 variables.

Proof. The action from t0t_0 to tt is S=t0tLdtS = \int_{t_0}^{t} L\, dt'. The total time derivative is:

dSdt=L\frac{dS}{dt} = L

But S=S(q1(t),,qn(t),t)S = S(q_1(t), \ldots, q_n(t), t) So by the chain rule:

dSdt=jSqjq˙j+St=L\frac{dS}{dt} = \sum_j \frac{\partial S}{\partial q_j}\dot{q}_j + \frac{\partial S}{\partial t} = L

From the definition of the conjugate momentum, pj=L/q˙j=S/qjp_j = \partial L/\partial \dot{q}_j = \partial S/\partial q_j (this can be shown rigorously by varying the endpoint). Therefore:

L=jpjq˙j+St=H+StL = \sum_j p_j \dot{q}_j + \frac{\partial S}{\partial t} = H + \frac{\partial S}{\partial t}

Since dS/dt=LdS/dt = L:

H+St=L=jpjq˙j+StH + \frac{\partial S}{\partial t} = L = \sum_j p_j\dot{q}_j + \frac{\partial S}{\partial t}

Which gives H+S/t=0H + \partial S/\partial t = 0. \blacksquare

Intuition. The Hamilton-Jacobi equation is the bridge between classical and quantum mechanics. Schrodinger’s equation can be obtained from it via the substitution S=ilnψS = -i\hbar \ln\psi (up to constants), making SS the classical limit of the quantum phase.

Separation of Variables. If HH does not depend explicitly on ttWrite S(q,t)=W(q)EtS(q, t) = W(q) - Et. Then the time-independent Hamilton-Jacobi equation is:

H(q1,,qn,Wq1,,Wqn)=EH\left(q_1, \ldots, q_n, \frac{\partial W}{\partial q_1}, \ldots, \frac{\partial W}{\partial q_n}\right) = E

Where WW is Hamilton’s characteristic function and EE is the constant energy.

4.10 Worked Example: Hamilton-Jacobi for the Harmonic Oscillator

Section titled “4.10 Worked Example: Hamilton-Jacobi for the Harmonic Oscillator”

Problem. Solve the Hamilton-Jacobi equation for a 1D harmonic oscillator with H=p2/(2m)+kx2/2H = p^2/(2m) + kx^2/2.

Solution

Since HH is time-independent, write S(x,t)=W(x)EtS(x, t) = W(x) - Et. The HJ equation becomes:

12m(dWdx)2+12kx2=E\frac{1}{2m}\left(\frac{dW}{dx}\right)^2 + \frac{1}{2}kx^2 = E

dWdx=2mEmkx2\frac{dW}{dx} = \sqrt{2mE - mkx^2}

Integrating:

W(x)=2mEmkx2dxW(x) = \int \sqrt{2mE - mkx^2}\, dx

Let x=2E/ksinαx = \sqrt{2E/k}\sin\alpha Then dx=2E/kcosαdαdx = \sqrt{2E/k}\cos\alpha\, d\alpha:

W=2Eω0αcos2αdα=Eω(α+12sin2α)W = \frac{2E}{\omega}\int_0^\alpha \cos^2\alpha'\, d\alpha' = \frac{E}{\omega}\left(\alpha + \frac{1}{2}\sin 2\alpha\right)

Where ω=k/m\omega = \sqrt{k/m}. The solution gives x(t)=2E/ksin(ωt+δ)x(t) = \sqrt{2E/k}\sin(\omega t + \delta) as expected.

\blacksquare

flowchart TD
A[4_Hamiltonian Mechanics] --> B[Key Concepts]
A --> C[Core Principles]
A --> D[Practical Applications]
B --> E[Fundamental definitions]
C --> F[Design patterns]
D --> G[Real-world usage]

Hamiltonian mechanics is like switching from a video recording of motion to a snapshot of all possible states. While the Lagrangian tracks positions and velocities over time, the Hamiltonian lives in phase space where every point represents a complete snapshot of where something is and how fast it is going. Hamilton’s equations are beautifully symmetric: the rate of change of position depends on how energy changes with momentum, and the rate of change of momentum depends on how energy changes with position. Liouville’s theorem tells us that if you paint a region of phase space, its volume stays the same as it flows around like incompressible paint. This is why statistical mechanics works: the phase space volume that encodes all possible states of a system is preserved under time evolution.

Mistake 1: Assuming the Hamiltonian always equals T+VT + V The Hamiltonian equals the total energy H=T+VH = T + V only when the potential is velocity-independent and the coordinate transformation is scleronomic. For systems with velocity-dependent potentials (like charged particles in electromagnetic fields) or rheonomic constraints, HT+VH \neq T + V even though HH is still conserved when L/t=0\partial L/\partial t = 0.

Mistake 2: Confusing canonical momentum with mechanical momentum Canonical momentum pj=L/q˙jp_j = \partial L/\partial \dot{q}_j is not always equal to mechanical momentum mq˙jm\dot{q}_j. For a charged particle in a magnetic field, the canonical momentum includes the vector potential: p=mv+qA\mathbf{p} = m\mathbf{v} + q\mathbf{A}. Always derive canonical momentum from the Lagrangian, not from mvm\mathbf{v}.

Mistake 3: Misapplying Poisson brackets The Poisson bracket {f,g}\{f, g\} is antisymmetric: {f,g}={g,f}\{f, g\} = -\{g, f\}. A common error is forgetting this sign when computing brackets of position and momentum. The fundamental brackets are {qj,pk}=δjk\{q_j, p_k\} = \delta_{jk}, {qj,qk}=0\{q_j, q_k\} = 0, and {pj,pk}=0\{p_j, p_k\} = 0. Mixing up the order changes the sign.