Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Hamiltonian Mechanics

Introduction

Recall that we can write the Euler-Lagrange equations as

dpIdt=FI(qI,q˙I)\frac{d p_I}{dt} = {\cal F}_I(q^I, \dot{q}^I)

where

pI(qI,q˙I)=LqI˙p_I(q_I, \dot{q}^I) = \frac{\del L}{\del \dot{q^I}}

and

FI(qI,q˙I)=LqI{\cal F}_I(q^I, \dot{q}^I) = \frac{\del L}{\del q^I}

and L(qI,q˙I,t)L(q^I, \dot{q}^I,t) is the Lagrangian.

We can, in general, solve for (2) to get q˙I(qI,pI)\dot{q}^I(q^I,p_I). Now the state of the system can be described by specifying (qI,pI)(q^I, p_I); these are coordinates in phase space. We will demonstrate below that if we start with

H(qI,pI)=pIq˙I(qI,pI)L(qI,q˙(qI,pI))H(q^I,p_I) = p_I \dot{q}^I(q^I,p_I) - L(q^I,\dot{q}(q^I,p_I))

then we can rewrite the equations of motion as

q˙I=HpIp˙I=HqI\begin{align} \dot{q}^I & = \frac{\del H}{\del p_I}\\ \dot{p}_I & = - \frac{\del H}{\del q^I} \end{align}

Note that when the Lagrangian is time-independent, the quantity (4) is exactly the quantity which we showed, via Noether’s theorem, is conserved. HH, called the Hamiltonian is the energy of this system. The equations (5) are known as Hamilton’s Equations and they are completely equivalent to the Euler-Lagrange equations.

Why would we daopt this formalism?

  1. If I(1,,D)I \in (1,\ldots, D), Hamilton’s equations are 2D2D first order differential equations. If we specify the data (qI,pI)(q^I,p_I) at any initial time t0t_0, these equations have a unique solution for all future times. Thus the state of the system at any time is completely described by (qI,pI)(q^I, p_I). The set of all states so specified is known as phase space. Thus, the space of states is given by 2D2D independent variables, and we can formulate mechanics as an initial value problem.

  2. Because Hamilton’s equations are first order in time derivatives, they are particularly amenable to numerical integration.

  3. Phase space has a geometric structure (it is a symplectic manifold) that gives powerful insights into the dynamics; Hamilton’s equations are formulated nicely using this structure.

  4. The description and consequence of symmetries emerges very naturally.

  5. This structure emerges naturally from quantum mechanics.

Derivation from Lagrangian dynamics

We start with the definition of generalized momentum in Lagrangian mechanics:

pI=Lq˙I(qI,q˙I)p_I = \frac{\del L}{\del \dot{q}^I}(q^I, \dot{q}^I)

Assume this can be uniquely solved for q˙I=q˙I(qI,pI)\dot{q}^I = \dot{q}^I(q^I,p_I). We can then performa a Legendre transformation to define the Hamiltonian H(p,q)H(p,q):

H(qI,pI)=pIq˙I(qI,pI)L(qI,q˙I(qI,pI))H(q^I,p_I) = p_I \dot{q}^I(q^I,p_I) - L(q^I,\dot{q}^I(q^I,p_I))

The Legendre transform appears in both classical mechanics and, in various ways, in statistical mechanics. I will have to put aside the beautiful geometric interpretation of the transform, but I highly recommend Zia et al., 2009, whih you can find on the arXiv.org website.

Given this we can compute

HpIpJI,qJ fixed=q˙I+pJq˙JpIq˙JpILq˙J\frac{\del H}{\del p_I}\Big|_{p_{J\neq I}, q^J\ fixed} = \dot{q}^I + p_J \frac{\del \dot{q}^J}{\del p^I} - \frac{\del \dot{q}^J}{\del p^I}\frac{\del L}{\del \dot{q}^J}

where the final term comes from using the chain rule to compute L/pI\del L/\del p_I. Using (6), this last term becomes equivalent to the second term on the right hand side, and we have one set of Hamilton’s equations:

q˙I=HpI\dot{q}^I = \frac{\del H}{\del p_I}

Similarly,

HqIqJI,pJ fixed=pJq˙JqILqIq˙I fixedq˙JqILq˙J\frac{\del H}{\del q^I}\Big|_{q^{J \neq I}, p_J\ fixed} = p_J \frac{\del \dot{q}^J}{\del q^I} - \frac{\del L}{\del q^I} \Big|_{\dot{q}^I\ fixed} - \frac{\del \dot{q}^J}{\del q^I} \frac{\del L}{\del \dot{q}^J}

where in the first term on the right hand side, we have used the fact that we are keeping all PJP_J fixed in the partial derivative; the second two terms are the derivative of L(q,q˙(q,p))L(q,\dot{q}(q,p)) using the chain rule. Using (6), the first and last terms on the right hand side cancel. Finally, we can use the Euler-Lagrange equation for the middle term to set

LqI=ddtLq˙I=p˙I\frac{\del L}{\del q^I} = \frac{d}{dt} \frac{\del L}{\del\dot{q}^I} = \dot{p}_I

so we have the remaining set of Hamilton’s equations,

p˙I=HqI\dot{p}_I = - \frac{\del H}{\del q^I}

Examples

  1. Particle in a conservative force field.

Start with the Lagrangian

L(x,x˙)=12mx˙2V(x)L(\vec{x},\dot{\vec{x}}) = \half m \dot{\vec{x}}^2 - V({\vec x})

The generalized momentum is

p=mx˙\vec{p} = m \dot{\vec{x}}

so that x˙=pm\dot{\vec{x}} = \frac{\vec p}{m}.

The Hamiltonian is thus

H=px˙12mx˙2+V(x)=p2m12p22m+V=p22m+V(x)\begin{align} H & = \vec{p} \cdot \dot{\vec{x}} - \half m \dot{\vec{x}}^2 + V({\vec x}) \\ & = \frac{\vec{p}^2}{m} - \half \frac{\vec{p}^2}{2m} + V\\ & = \frac{\vec{p}^2}{2m} + V({\vec x}) \end{align}

which is indeed the total energy (kinetic plus potential). We can write Hamilton’s equations as

x˙i=Hpi=pimp˙i=Hxi=Vxi\begin{align} \dot{x}^i & = \frac{\del H}{\del p_i} = \frac{p_i}{m}\\ \dot{p}_i & = - \frac{\del H}{\del x^i} = - \frac{\del V}{\del x^i} \end{align}

The first is the known relation between momentum and velocity; the second is then Newton’s laws written in terms of the momentum. If we take the time derivative of the first equation, multiply by mm, and use the second to solve for p˙i\dot{p}_i we have the classic second law:

mx¨i=Vxim\ddot{x}^i = - \frac{\del V}{\del x^i}

Note that this gives three second order differential equation; Hamilton’s equations give a natural unpacking of this equation into six first-order differential equations which are often easier to integrate (analytically or numerically).

  1. Free particle in polar coordinates

Here we start with

L=12m(r˙2+r2ϕ˙2)L = \half m (\dot{r}^2 + r^2 \dot{\phi}^2)

The generalized momenta are:

pr=mr˙r˙=prmpϕ=mr2ϕ˙ϕ˙=pϕmr2\begin{align} p_r & = m \dot{r} \Rightarrow \dot{r} = \frac{p_r}{m}\\ p_{\phi} & = m r^2 \dot{\phi} \Rightarrow \dot{\phi} = \frac{p_{\phi}}{m r^2} \end{align}

Thus the Hamiltonian is:

H=prr˙+pϕϕ˙12m(r˙2+r2ϕ˙2)=pr22m+pϕ22mr2\begin{align} H & = p_r \dot{r} + p_{\phi} \dot{\phi} - \half m (\dot{r}^2 + r^2 \dot{\phi}^2)\\ & = \frac{p_r^2}{2m} + \frac{p_{\phi}^2}{2 m r^2} \end{align}

Hamilton’s equations become:

r˙=Hpr=prmp˙r=Hr=pϕ2mr3ϕ˙=Hpϕ=pϕmr2pϕ˙=Hϕ=0\begin{align} \dot{r} & = \frac{\del H}{\del p_r} = \frac{p_r}{m}\\ \dot{p}_r & = - \frac{\del H}{\del r} = \frac{p_{\phi}^2}{m r^3}\\ \dot{\phi} & = \frac{\del H}{\del p_{\phi}} = \frac{p_{\phi}}{m r^2}\\ \dot{p_{\phi}} & = - \frac{\del H}{\del \phi} = 0 \end{align}

Note that this last equation is a re-statement of the conservaton of angular momentum, following from ϕ\phi being a cyclic coordinate.

  1. Charged prrticle in a magnetic field.

As we stated before, if B=×A\vec{B} = \vec{\nabla}\times\vec{A} for the vector potential A\vec{A}, the Lagrangian is:

L=12mx˙2+ecx˙AL = \half m \dot{\vec{x}}^2 + \frac{e}{c} \dot{\vec{x}}\cdot \vec{A}

The conjugate momentum is

pi=Lx˙i=mx˙i+ecAix˙i=1m(piecAi)p_i = \frac{\del L}{\del \dot{x}^i} = m \dot{x}^i + \frac{e}{c} A^i \Rightarrow \dot{x}^i = \frac{1}{m} \left(p_i - \frac{e}{c} A^i\right)

With a little work we find:

H=pixi˙12mx˙2ecx˙A=1mpi(piecAi)m2m2(pecA)2emc(pecA)2   emc(pecA)A=12m(pecA)2\begin{align} H & = p_i \dot{x^i} - \half m \dot{\vec{x}}^2 - \frac{e}{c} \dot{\vec{x}}\cdot\vec{A}\\ & = \frac{1}{m} p_i \left(p_i - \frac{e}{c} A_i\right) - \frac{m}{2 m^2}\left({\vec p} - \frac{e}{c} \vec{A}\right)^2 - \frac{e}{mc} \left({\vec p} - \frac{e}{c} \vec{A}\right)^2 \\ & \ \ \ - \frac{e}{mc} \left({\vec p} - \frac{e}{c} \vec{A}\right)\cdot\vec{A}\\ & = \frac{1}{2m}\left(\vec{p} - \frac{e}{c}\vec{A}\right)^2 \end{align}

Poisson brackets

Poisson brackets will seem like a simple rewriting of Hamilton’s equations, but they are an important part of the geometry of classical mechanics; yield Noether’s theorem as a near-tautology; and have an important quantum-mechanical analog.

We can see them emerge as follows, and along the way introduce another important concept. Any observable quantity AA in classical mechanics should be a function of the state of the system, and thus of phase space: A=A(qI,pI)A = A(q^I, p_I). (It could be constant in which case classical mechanics has nothing to say about it.). Two examples are the ithi^{{\rm th}} component of angular momentum Li=12ϵijkxjpkL_i = \half \eps_{ijk} x^j p_k; and the energy, which is the Hamiltonian itself H(q,p)H(q, p).

How does this observable change along classical trajectories?

dAdt=dqIdtAqI+dpIdtApI=HpIAqIHqIApI{A,H}\begin{align} \frac{dA}{dt} & = \frac{d q^I}{dt} \frac{\del A}{\del q^I} + \frac{d p_I}{dt} \frac{\del A}{\del p_I} \\ & = \frac{\del H}{\del p_I} \frac{\del A}{\del q_I} - \frac{\del H}{\del q^I}\frac{\del A}{\del p_I}\\ & \equiv \{A,H\} \end{align}

The first line is just the chain rule; the second uses Hamilton’s equations; the last introduces the Poisson bracket. More generally, for two observables A,BA, B, the Poisson bracket is defined as:

{A,B}AqIBpIApIBqI\{A, B\} \equiv \frac{\del A}{\del q^I}\frac{\del B}{\del p_I} - \frac{\del A}{\del p_I}\frac{\del B}{\del q^I}

and satisfies two important properties:

  1. Antisymmetry: {A,B}={B,A}\{A,B\} = - \{B,A\}.

  2. Jacobi identity: {A,{B,C}}+{C,{A,B}}+{B,{C,A}}=0\{A,\{B,C\}\} + \{C,\{A,B\}\} + \{B, \{C,A\}\} = 0.

These can be verified by brute force computation. Finally, the phase space variables we have written so far satisfy simple, “canonical” Poisson bracket relations:

{qI,qJ}=0{pI,pJ}=0{qI,pJ}=δJI\begin{align} \{q^I, q^J\} & = 0 \\ \{p_I, p_J\} & = 0\\ \{q^I, p_J\} & = \delta^I_J \end{align}

Note that given what we derived at the top, dAdt={A,H}\frac{dA}{dt} = \{A, H\}, the Hamiltonian generates flows in phase space of all observable quantities. These include the positions and momenta themselves; Hamilton’s equations can be compactly written as

dqIdt={qI,H}dpIdt={pI,H}\begin{align} \frac{d q^I}{dt} & = \{q^I , H\}\\ \frac{d p_I}{dt} & = \{p_I, H\} \end{align}

The minus sign in the second part of Hamilton’s equations is taken care of by the sign in the definition of the bracket, needed for the antisymmetry property.

The Poisson bracket is a central object in classical mechanics in defining the geometry of phase space and deriving consequences of teh dynamics. One consequence we will not derive here is Liouville’s theorem, which states that if we take a small volume of phase space and evolve each point forward using Hamilton’s equations, the volume does not change.

Canonical transformations

As we discussed, one advantage of the Lagrangian formulation is that you can perform point cordinate transformations q=q(q,t)q' = q'(q,t) at the level of the Lagrangian; that is, we apply the Euler-Lagrange equations for qq' to the transformed Lagrangian L~(q,q˙,t)=L(q(q),ddtq(q,t),t){\tilde L}(q',\dot{q}',t) = L(q(q'), \frac{d}{dt}q(q',t), t).

In Hamiltonian mechanics we can work with more general canonical transformations, which are a class of coordinate transformations on phase space that preserve the structure of the Poisson brackets and of Hamilton’s equations. That is, we consider QA=QA(pI,qI)Q^A = Q^A(p_I, q^I), PA=Pa(qI,pI)P_A = P_a(q^I, p_I) (with A=1,,D)A = 1,\ldots,D)) such that Hamilton’s equations retain their form

dQAdt=KPAdPAdt=KQA\begin{align} \frac{d Q^A}{dt} & = \frac{\del K}{\del P_A}\\ \frac{d P_A}{dt} & = - \frac{\del K}{\del Q^A} \end{align}

for some K(Q,P,t)K(Q,P,t). One can show that canonical transformations also preserve the Poisson bracket structure, that is, that

{QA,QB}=0 ;  {PA,PB}=0 ;  {QA,PB}=δBA\{Q^A, Q^B\} = 0\ ; \ \ \{P_A, P_B\} = 0\ ; \ \ \{Q^A,P_B\} = \delta^A_B

The subject of canonical transformations is of deep importance in Hamiltonian mechanics. We will have to give it short shrift, but I recommend consulting one or more textbooks which cover this, such as Goldstein et al., 2002, Landau & Lifshitz, 1982.

We will focus here on infinitesimal canonical transformations. I will state without justification that these can be described by a single generating function g(qI,pJ,t)g(q^I,p_J,t), with the transformations being

qI=qI+δqI=qI+ϵ{qI,f}=qI+ϵfpIpI=pI+δpi=pI+ϵ{pI,f}=pIϵfqI\begin{align} q'^I & = q^I + \delta q^I = q^I + \eps \{q^I, f\} & = q^I + \eps \frac{\del f}{\del p_I}\\ p'_I & = p_I + \delta p_i = p_I + \eps \{p_I, f\}\\ & = p_I - \eps \frac{\del f}{\del q^I} \end{align}

for ϵ1\eps \ll 1, where we only consider effects of these transformations to O(ϵ){\cal O}(\eps).

Under this canonical transformation any observable A(p,q)A(p,q) transforms to order O(ϵ){\cal O}(\eps) as:

δA=A(qI+δqI,pI+δpI)A(qI,pI)=δqIAqI+δpIApI=ϵfpIAqIϵfqIApI=ϵ{A,f}\begin{align} \delta A & = A(q^I + \delta q^I, p_I + \delta p_I) - A(q^I, p_I) \\ & = \delta q^I \frac{\del A}{\del q^I} + \delta p_I \frac{\del A}{\del p_I}\\ & = \eps \frac{\del f}{\del p_I} \frac{\del A}{\del q^I} - \eps \frac{\del f}{\del q^I} \frac{\del A}{\del p_I}\\ & = \eps \{A,f\} \end{align}

We call ff the generator or generating function of this transformation.

Note that such canonical transformations include time evolution, for which the generator is the Hamiltonian. You can also show that translations qIqI+ϵaIq^I \to q^I + \eps a^I are generated by f=ϵaIpIf = \eps a^I p_I; and in 2 dimensions, rotations about the origin ϕϕ+ϵΔ\phi \to \phi + \eps \Delta are generated by f=ϵΔLzf = \eps \Delta L_z, where LzL_z is the angular momentum.: for the latter, using Lz=xpyypxL_z = x p_y - y p_x, we can show

δx=ϵΔ{x,Lz}=ϵΔyδy=ϵΔ{y,Lz}=ϵΔx\begin{align} \delta x & = \eps \Delta \{x, L_z\} = - \eps \Delta y\\ \delta y & = \eps \Delta \{y, L_z\} = \eps \Delta x \end{align}

which describes the rotation of (x,y)(x,y) as a vector by the infinitesimal angle ϵΔ\eps \Delta. Similarly, we can show that px,pyp_x, p_y rotate as a vector.

Symmetries

In Hamiltonian mechanics, a symmetry is a canonical transformation that preserves the form of the Hamiltonian. Under infitesimal transformations, this means that:

δH=ϵ{H,f}=0\delta H = \eps \{H, f\} = 0

But we also know that if we consider ff as an observable, Hamilton’s equations imply that for trajectories satisfying the equations of motion, if ff is time-independent, then:

dfdt={f,H}=0\frac{d f}{dt} = \{f, H\} = 0

So ff is a conserved quantity. The Hamiltonian version of Noether’s theorem falls out almost automatically (though a lot went into the setup). For example, we have shown that translations by ϵaI\eps a^I are generated by f=aIpIf = a^I p_I. If this translation is an (infinitesimal) symmetry, then δH=ϵ{H,f}=ϵaIHqI\delta H = \eps \{H, f\} = \eps a^I \frac{\del H}{\del q^I}, so HH is independent of the direction pointing along aIa^I, and the conjugate momentum aIpIa^I p_I is conserved.

Note that time evolution itself is a canonical transformation, generated by HH. The conservation of energy itself follows from time translation invariance from the following argument:

dHdt=q˙IHqI+p˙IHpI+Ht={H,H}+Ht=Ht\begin{align} \frac{d H}{dt} & = \dot{q}^I \frac{\del H}{\del q^I} + \dot{p}_I \frac{\del H}{\del p_I} + \frac{\del H}{\del t}\\ & = \{H, H\} + \frac{\del H}{\del t} = \frac{\del H}{\del t} \end{align}

where we have used Hamilton’s equations to get to the second line, and used the antisymmetry of the bracket which implies that {A,A}=0\{A,A\} = 0 for any AA. Thus energy is conserved if the Hamiltonian lacks any explicit time dependence.

References
  1. Zia, R. K. P., Redish, E. F., & McKay, S. R. (2009). Making sense of the Legendre transform. American Journal of Physics, 77(7), 614–622. 10.1119/1.3119512
  2. Goldstein, H., Poole, C. P., & Safko, J. L. (2002). Classical Mechanics. Addison Wesley.
  3. Landau, L. D., & Lifshitz, E. M. (1982). Mechanics: Volume 1. Elsevier Science. https://books.google.com/books?id=bE-9tUH2J2wC