6. Hamilton’s Equations

Michael Fowler

A Dynamical System’s Path in Configuration Space, State Space and Phase Space

Configuration Space and State Space

The story so far:  For a mechanical system with n  degrees of freedom, the spatial configuration at some instant of time is completely specified by a set of n  variables we'll call the q i  ’s.    The n -dimensional q i  space is (naturally) called configuration space.  It’s like a freeze frame, a snapshot of the system at a given instant.  Subsequent time evolution from that state is uniquely determined if we're also given the initial velocities q ˙ i

The set of q i 's  and q ˙ i 's  together define the state of the system, meaning both its configuration and how fast it’s changing, therefore fully determining its future (and past) as well as its present. The 2n -dimensional space spanned by q i , q ˙ i  is the state space

The system’s time evolution is along a path in configuration space parameterized by the time t.  That, of course, fixes the corresponding path in state space, since differentiating the functions q i t  along that  path determines the q ˙ i t .

Trivial one-dimensional examples of these spaces are provided by the one-dimensional simple harmonic oscillator, where configuration space is just the x  axis, say, the state space is the x, x ˙  plane, the system’s time path in the state space is an ellipse.

For a stone falling vertically down, the configuration space is again a line, the path in the x, x ˙  state space is parabolic, x ˙ x .

Exercise: Sketch the paths in state space for motions of a pendulum, meaning a mass at the end of a light rod, the other end fixed, but free to rotate in one vertical plane.  Sketch the paths in θ, θ ˙  coordinates.

In principle, the system’s path through configuration space can always be computed using Newton’s laws of motion, but in practice the math may be intractable.  As we’ve shown above, the elegant alternative created by Lagrange and Hamilton is to integrate the Lagrangian

L q i , q ˙ i ,t =T q i , q ˙ i V q i ,t

along different paths in configuration space from a given initial state to a given final state in a given time:  as Hamilton proved, the actual path followed by the physical system between the two states in the given time is the one for which this integral, called the action, is minimized.  This minimization, using the standard calculus of variations method, generates the Lagrange equations of motion in q i , q ˙ i , and so determines the path.

Notice that specifying both the initial q i  ’s and the final q i  ’s fixes 2n  variables.  That’s all the degrees of freedom there are, so the motion is completely determined, just as it would be if we’d specified instead the initial q i  ’s and q ˙ i  ’s. 

Phase Space

More Natural Variables...

Newton wrote his equation of motion not as force equals mass times acceleration, but as force equals rate of change of momentum.  Momentum, mass times velocity, is the natural "quantity of motion" associated with a time-varying dynamical parameter. It is some measure of how important that coordinate's motion is to the future dynamical development of the system.

Hamilton recast Lagrange's equations of motion in these more appropriate variables q i , p i , positions and momenta, instead of q i , q ˙ i .  The q  's and p  's  are called phase space coordinates.

So phase space is the same identical underlying space as state space, just with a different set of coordinates.  Any particular state of the system can be completely specified either by giving all the variables q i , q ˙ i  or by giving the values of all the q i , p i .  

By the way, the q i , p i are the sets of variables used in quantum mechanics, and their noncommutativity yields a quantum measure in phase space, from which follows an absolute number for entropy..

Going From State Space to Phase Space

Now, the momenta are the derivatives of the Lagrangian with respect to the velocities, p i =L q i , q ˙ i / q ˙ i .  So, how do we get from a function L q i , q ˙ i  of positions and velocities to a function of positions and the derivatives of that function L  with respect to the velocities?

How It's Done in Thermodynamics

To see how, we'll briefly review a very similar situation in thermodynamics: recall the expression that naturally arises for incremental energy, say for the gas in a heat engine, is

dE S,V =TdSPdV,

where S  is the entropy and T=E/S  is the temperature.  But S  is not a handy variable in real life -- temperature T  is a lot easier to measure!  We need an energy-like function whose incremental change is some function of dT,dV  rather than dS,dV.  The early thermodynamicists solved this problem by introducing the concept of the free energy,


so that  dF=SdTPdV.   This change of function (and variable) was important: the free energy turns out to be more practically relevant than the total energy, it's what's available to do work.

So we've transformed from a function E S  to a function F T =F E/S  (ignoring P,V , which are passive observers here).

Math Note: the Legendre Transform

The change of variables described above is a standard mathematical routine known as the Legendre transform.  Here’s the essence of it, for a function of one variable.

Suppose we have a function f x  that is convex, which is math talk for it always curves upwards, meaning d 2 f x /d x 2  is positive. Therefore its slope, we’ll call it

y=df x /dx ,

 is a monotonically increasing function of x . For some physics (and math) problems, this slope y , rather than the variable x,  is the interesting parameter. To shift the focus to y , Legendre introduced a new function, g y , defined by

g y =xyf x .

The function g y  is called the Legendre transform of the function f x .

To see how they relate, we take increments:

dg y =ydx+xdydf x =ydx+xdyydx=xdy,

(Looking at the diagram, an increment dx  gives a related increment dy,  as the slope increases on moving up the curve.)

From this equation,

x=dg y /dy.

Comparing this with y=df x /dx,  it’s clear that a second application of the Legendre transformation would get you back to the original f x .  So no information is lost in the Legendre transformation— g y  in a sense contains f x ,  and vice versa.

Hamilton's Use of the Legendre Transform

From State Space to Phase Space

We have the Lagrangian L q i , q ˙ i ,  and Hamilton's insight that these are not the best variables, we need to replace the Lagrangian with a closely related function (like going from the energy to the free energy), that is a function of the q i  (that's not going to change) and, instead of the q ˙ i  's,  the p i  's, with p i =L q i , q ˙ i / q ˙ i .  This is exactly a Legendre transform like the one from fg  discussed above.

The new function is

H q i , p i = i=1 n p i q ˙ i L q i , q ˙ i ,

from which

dH p i , q i = i p ˙ i d q i + i q ˙ i d p i ,  

analogous to dF=SdTPdV  This new function is of course the Hamiltonian.

Checking that We Can Eliminate the q ˙ i 's  

We should check that we can in fact write

H p i , q i = i=1 n p i q ˙ i L q i , q ˙ i

as a function of just the variables q i , p i , with all trace of the q ˙ i  ’s eliminated.  Is this always possible?  The answer is yes. 

Recall the q ˙ i  ’s only appear in the Lagrangian in the kinetic energy term, which has the general form

T= i,j a ij q k q ˙ i q ˙ j

where the coefficients a ij  depend in general on some of the q k  ’s, but are independent of the velocities, the q ˙ k  ’s.  Therefore, from the definition of the generalized momenta,

p i = L q ˙ i = j=1 n a ij q k q ˙ j ,

and we can write this as a vector-matrix equation,

p=A q ˙ .

That is, p i  is a linear function of the q ˙ j  ’s.  Hence, the inverse matrix A 1  will give us q ˙ i  as a linear function of the p j 's , and then putting this expression for the q ˙ i  into the Lagrangian gives the Hamiltonian as a function only of the q i 's  and the p i 's , that is, the phase space variables. 

The matrix A  is always invertible because the kinetic energy is positive definite (as is obvious from its Cartesian representation) and a symmetric positive definite matrix has only positive eigenvalues, and therefore is invertible.

Hamilton’s Equations

Having finally established that we can write, for an incremental change along the dynamical path of the system in phase space,

dH q i , p i = i p ˙ i d q i + i q ˙ i d p i

we have immediately the so-called canonical form of Hamilton’s equations of motion:

H p i = q ˙ i , H q i = p ˙ i .

Evidently going from state space to phase space has replaced the second order Euler-Lagrange equations with this equivalent set of pairs of first order equations.

A Simple Example

For a particle moving in a potential in one dimension, L q, q ˙ = 1 2 m q ˙ 2 V q .


p= L q ˙ =m q ˙ , q ˙ = p m .


H=p q ˙ L=p q ˙ 1 2 m q ˙ 2 +V q = p 2 2m +V q .

(Of course, this is just the total energy, as we expect.)

The Hamiltonian equations of motion are

q ˙ = H p = p m p ˙ = H q = V q .

So, as we’ve said, the second order Lagrangian equation of motion is replaced by two first order Hamiltonian equations.  Of course, they amount to the same thing (as they must!): differentiating the first equation and substituting in the second gives immediately V q =m q ¨ ,  that is, F=ma,  the original Newtonian equation (which we derived earlier from the Lagrange equations).