You are on page 1of 14

The Hamiltonian Formalism

Somasuntharam Arunasalam
SID:312107684
Contents
1 Introduction 2
2 Hamiltons Equations 2
2.1 The Legendre Transformation . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Derivation of Hamiltons equations . . . . . . . . . . . . . . . . . . . . . . 2
2.2.1 The application of the Legendre Transformation . . . . . . . . . . 2
2.2.2 The Legendre Transform is an involution . . . . . . . . . . . . . . 3
2.3 The Legendre transformation of the Euler Lagrange Equation . . . . . . . 4
3 Example: The Simple Harmonic Oscillator 5
3.1 The Lagrangian formalism . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 The Hamiltonian formalism . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2.1 Hamiltons equations . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 The time dependence of the Hamiltonian 8
4.1 The simple harmonic oscillator revisited . . . . . . . . . . . . . . . . . . . 8
4.2 Phase portrait analysis of simple harmonic motion . . . . . . . . . . . . . 9
5 The simple pendulum 10
5.1 The Lagrangian formalism . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.2 The Hamiltonian formalism . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6 The generalisation of the Hamiltonian formulation to quantum mechanics 13
7 Conclusion 13
References 14
1
1 Introduction
The Hamiltonian formalism is an elegant reformulation of the Euler-Lagrange equation
that provides an alternative method to obtain the extremals of a functional. In this
report, a function known as the Hamiltonian will be obtained through a Legendre trans-
form of the Lagrangian and then this function will be used to derive the system of
equations known as Hamiltons equations. These equations will then be used to inves-
tigate the physcial systems of the simple harmonic oscillator and the simple pendulum.
Here, the power of the Hamiltonian formalism will be illustrated by its ability to utilise
certain properties of the system to facilitate the analysis. Finally, a generalisation of the
Hamiltonian formalism will be investigated in the form of quantum mechanics, in order
to show its wide applicability.
In this report, the functional that will be optimised is of the form:
J =
_
t
1
t
0
L(q, q, t)dt
where q, q R
N
and t R
Here, t is the independent variable, q is the dependent variable and q is the time-
derivative of q. L is known as the Lagrangian function. This notation is due to historical
reasons as the Hamiltonian formalism was originally used in the study of dynamical
physical systems, where the independent variable is time and the dependent variable is
position which is often denoted as q.
2 Hamiltons Equations
2.1 The Legendre Transformation
The Legendre transformation is a mapping of a variable and a function that depends
on this variable to a new conjugate variable and a new function that depends on this
variable. Suppose we have the variable x and a function f that depends on this variable.
We can dene the Legendre transformation of this variable to be:
y =
f
x
(1)
g(y) = xy f(x) (2)
Here y, dened by Equation 1, is the conjugate variable of x and g is the new function
that depends on y.
2.2 Derivation of Hamiltons equations
2.2.1 The application of the Legendre Transformation
In order to derive Hamiltons equations, a Legendre transformation is applied to the
Lagrangian, L(q, q, t), with respect to the variable q. As q is a vector in R
N
, the
2
Legendre transformation is applied to each component of this vector separately. The
conjugate variable to q is denoted by p and the new function is denoted by H(q, p, t).
Equations 1 and 2 as applied to the Lagrangian is:
p
k
=
L
q
k
(3)
H(q, p, t) =
N

k=1
p
k
q
k
L(q, q, t) (4)
This new function, H, is known as the Hamiltonian function. It can be seen that the
scalar product is used in Equation 4 as opposed to normal multiplication as these vari-
ables are vector in R
N
. The conjugate variable is denoted by p due to historical con-
vention as often, when the Hamiltonian formalism is applied to dynamical systems, the
conjugate variable to position is momentum which has the symbol p [Calkin, 1996].
Currently, Equation 4 suggests that the hamiltonian is dependent on q as well as q, p
and t. However, the idea of the Legendre transformation is to eliminate the dependence
on q. To achieve this, Equation 3 must be inverted by means of the Implicit function
theorem. According to this theorem, Equation 3 can be solved for components of q in
terms of p if the Jacobian matrix, J
p
( q) is non-singular [Edwards, 1973], i.e.
det
_
_
_
_
_
_
_
_
p
1
q
1
p
1
q
2
. . .
p
1
q
N
p
2
q
1
p
2
q
2
. . .
p
2
q
N
.
.
.
.
.
.
.
.
.
.
.
.
p
N
q
1
p
n
q
N
. . .
p
N
q
N
_
_
_
_
_
_
_
_
= 0 (5)
Now, by using the denition of p
k
in Equation 3, Equation 5 can be written as:
det
_
_
_
_
_
_
_
_

2
L
q
1
q
1

2
L
q
1
q
2
. . .

2
L
q
1
q
N

2
L
q
2
q
1

2
L
q
2
q
2
. . .

2
L
q
2
q
N
.
.
.
.
.
.
.
.
.
.
.
.

2
L
q
N
q
1

2
L
q
N
q
2
. . .

2
L
q
N
q
N
_
_
_
_
_
_
_
_
= 0 (6)
However, this is the Hessian matrix, H
L
( q), of the Lagrangian with respect to q. Thus,
a necessary condition for the Hamiltonian formalism to be applied is that the Hessian
matrix of the Lagrangian with respect to q must be non-singular.
2.2.2 The Legendre Transform is an involution
A remarkable property of the Legendre transformation is that it is an involution. This
means that it is its own inverse. To show this property, the Legendre transformation is
3
applied to the variable p and the Hamiltonian.
H
p
j
=

p
j
_
N

k=1
p
k
q
k
L
_
(7)
=
N

k=1
_
q
k
p
k
p
j
+ p
k
q
k
p
j

L
q
k
q
k
p
j
_
(Using product and chain rules) (8)
=
N

k=1
_
q
k
p
k
p
j
+ p
k
q
k
p
j
p
k
q
k
p
j
_
(Using Equation 3) (9)
=
N

k=1
_
q
k
p
k
p
j
_
(10)
Now, each of the components of p are independent of each other. Thus,
p
k
p
j
=
jk
=
_
0 if j = k
1 if j = k
where
jk
is the Kronecker delta. Now applying this to Equation 10, we see that
H
p
j
=
N

k=1
q
k

jk
(11)
= q
j
(12)
The second part of the Legendre trasformation, Equation 4 is trivially an involution.
This is because:
N

k=1
p
k
q
k
H =
N

k=1
p
k
q
k

_
N

k=1
p
k
q
k
L
_
(13)
= L (14)
Equations 10 and 14 show that the Legendre transformation applied to the variable
p and the Hamiltonian function yields q and the Lagrangian. Thus, the Legendre
transformation is its own inverse.
2.3 The Legendre transformation of the Euler Lagrange Equation
The Euler-Lagrange equation that is usually used to optimise functionals is:
d
dt
L
q
j
=
L
q
j
(15)
4
We can substitute Equation 3 into the Euler-Lagrange equation:
dp
j
dt
=
L
q
j
(16)
=

q
j
_
N

k=0
p
k
q
k
H
_
(17)
=
N

k=0

q
j
(p
k
q
k
)
H
q
j
(18)
Now, in the Hamiltonian, p is indpendent of q and in the Lagrangian, q is indpendent
of q.
p
k
q
j
=
q
k
q
j
= 0
Thus, Equation 18 becomes:
dp
j
dt
=
H
q
j
(19)
Equations 12 and 19 are collectively known as Hamiltons equations. These can be more
elegantly written as:
q
j
=
H
p
j
p
j
=
H
q
j
(20)
3 Example: The Simple Harmonic Oscillator
In many physical situations, a principle known as the principle of least action holds
[Pauling and Wilson, 1935]. Action is dened as:
S =
_
t
1
t
0
T V dt (21)
where T is the kinetic energy and V is potential energy. According to this principle,
the trajectory that a particle will follow is one that minimises the action. For a particle
undergoing simple harmonic motion, the kinetic energy has the form:
T =
1
2
m q
2
(22)
and the particle is conned in a quadratic potential:
V =
1
2
m
2
q
2
(23)
5
where q is the position of the particle with q = 0 being the mean position, q is the
velocity of the particle, m is the mass of the particle and is the angular frequency
of the particle in motion. As before, the Lagrangian is dened as the integrand of the
quantity being minimised. Thus, the Lagrangian is dened as:
L(q, q, t) = T V =
1
2
m q
2

1
2
m
2
q
2
(24)
3.1 The Lagrangian formalism
Let us rstly see the solution of this optimisation problem in the Lagrangian formalism.
The Euler-Lagrange Equation for this dynamic situation can be written as:
d
dt
_
L
q
_
=
L
q
(25)
d
dt
_

q
_
1
2
m q
2

1
2
m
2
q
2
__
=

q
_
1
2
m q
2

1
2
m
2
q
2
_
(26)
d
dt
(m q) = m
2
q (27)
m q = m
2
q (28)
This equation is a homogeneous second-order dierential equation, the solutions for
which can be written as:
q = Acos(t) + Bsin(t) (29)
This solution is uniquely determined in terms of the constants A and B by the initial
position and velocity of the particle. This shows that under the Lagrangian formalism,
it is quite simple to solve for the trajectory of a particle undergoing simple harmoic
motion.
3.2 The Hamiltonian formalism
Now, let us examine this dynamical problem in terms of the Hamiltonian formalism by
applying the Legendre transformation.
p =
L
q
(30)
=

q
_
1
2
m q
2

1
2
m
2
q
2
_
(31)
= m q (32)
In fact this is the linear momentum of this particle. This gives an example of how this
conjugate variable, p, is often momentum when q denotes position.
H = p q L (33)
= p q
1
2
m q
2

1
2
m
2
q
2
(34)
6
Now, as
p
q
= 0, we can solve Equation 32 for q to obtain:
q =
p
m
(35)
Thus, we can substitute Equation 35 into 34 and to obtain a Hamiltonian that is only
dependent on q and p.
H = p
_
p
m
_

_
1
2
m
_
p
m
_
2

1
2
m
2
q
2
_
(36)
=
p
2
2m
+
1
2
m
2
q
2
(37)
3.2.1 Hamiltons equations
Let us now see what Hamiltons equations are for simple harmonic motion.
q =
H
p
(38)
=
p
m
(39)
p =
H
q
(40)
= m
2
q (41)
Thus, Hamiltons equations for simple harmonic motion
q =
p
m
p =
1
2
m
2
q
Now, dierentiating the expression for p in Equation 32 and substituting this into Hamil-
tons second equation, we see that
m q = m
2
q (42)
As seen before, Equation 42 can be solved easily. However, this seems to imply that using
the Hamiltonian formalism is at least as dicult as using the Lagrangian formalism. In
fact, solving Hamiltons equations without eliminating p is often a quite dicult task. To
facilitate this, a variable transformation is applied to the system. However, to obtain this
transformation, a dierent partial dierential equation known as the Hamilton-Jacobi
Equation must be solved [van Brunt, 2004] [Gupta, 1997].
7
4 The time dependence of the Hamiltonian
One of the major advantages of the Hamiltonian formalism is its ability to utilise certain
symmetries found in the system. One particularly useful example of this is seen in the
very simple identity:
dH
dt
=
H
t
(43)
This identity can be proved quite easily as follows:
dH
dt
=
H
p
dp
dt
+
H
q
dq
dt
+
H
t
(44)
= q
dp
dt
p
dq
dt
+
H
t
(by Hamiltons equations) (45)
= q p p q +
H
t
(46)
=
H
t
(47)
The reason why this identity is important is that if the Hamiltonian does not depend on
time explicitly, then the parial derivative of the Hamiltonian with respect to time is 0.
However, by this identity, the total derivative of the Hamiltonian with respect to time
is 0. This implies that the Hamiltonian is a constant of the motion.
4.1 The simple harmonic oscillator revisited
As seen above, the Hamiltonian for a particle undergoing simple harmonic motion is:
H =
p
2
2m
+
1
2
m
2
q
2
(48)
It is clear from this expression that the Hamiltonian is not explicitly time dependent.
Therefore, it must be a constant. This constant will be denoted by E. This is because
this constant is often the energy of a particle. Thus, Equation 48 can be written as:
p
2
2m
+
1
2
m
2
q
2
= E (49)
As E is a constant, Equation 49 is the equation of an ellipse centred at the origin. Figure
1 plots Equation 49 for dierent values of E. This is known as the phase portrait of the
system. The complete behaviour of this system can be determined by analysing this
portrait.
8
q
p
Figure 1: The phase portrait for simple harmonic motion
4.2 Phase portrait analysis of simple harmonic motion
The maximum value of displacement from the mean position, q, is found when p = 0.
Solving Equation 49 for q, we see that
q
max
=
_
2E
m
2
(50)
Similarly the maximum value of momentum is obtained when q = 0. Thus,
p
max
=

2mE (51)
The behaviour of the particle can be described by tracing the curve. For example,
suppose the particle starts with no momentum at a certain position q to the right of the
mean position. This is at the positive horizontal intercept of the ellipse. As the particle
moves, it will trace this ellipse in a clockwise direction(if we dene momentum to be
positive when directed to the right). Thus, it will increase in momentum, in terms of
magnitude, till the mean position(q = 0) where it will attain its maximum. Then, it will
decrease again to 0 at q and then will reverse in direction and return to the original
position. This is clearly indicative of oscillatory behaviour. Now, E is the energy of the
particle. Hence, we see that knowing the mass, the angular frequency and the energy of
the particle at a single point of time, the entire behaviour of the particle can be obtained
by analysing a single algebraic equation. Thus, using the Hamiltonian formalism has
eliminated the need to solve a dierential equation.
9
5 The simple pendulum
Let us now examine the physical scenario of the simple pendulum. This is a particle of
mass m that swings on a rigid rod of length l. The position variable q in this case is
the angle from the vertical as seen in Figure 2. The velocity, v can be expressed as the
Figure 2: The Simple Pendulum
time-derivative of the arc length of the circle:
v =
d
dt
lq (52)
= l q (53)
Thus, the kinetic energy, T, can be expressed in terms of q by:
T =
1
2
mv
2
(54)
=
1
2
ml
2
q
2
(55)
Now, suppose the height of the particle is dened in this scenario to be the vertical
displacement from the pivot of the pendulum. Thus, the height of the particle, h, is
equal to lcos(q). Therefore, the gravitational potential energy, V, is
V = mgh (56)
= mglcos(q) (57)
Thus, the Lagrangian for the simple pendulum can be written as:
L = T V (58)
=
1
2
ml
2
q
2
+ mglcos(q) (59)
10
5.1 The Lagrangian formalism
The Euler-Lagrange equation for the simple pendulum is:
d
dt
_
L
q
_
=
L
q
(60)
d
dt
(ml
2
q) = mglsin(q) (61)
ml
2
q = mglsin(q) (62)
Thus, dividing both sides by ml
2
we see that the Euler-Lagrange equation for simple
harmonic motion reduces to:
q =
g
l
sin(q) (63)
Unfortunately, this equation is a second order non-linear equation that is quite dicult
to solve analytically. Often, an approximation is used to investigate this scenario for
small angles and numerical methods are used. However, this is where the power of the
hamiltonian formalism can be seen.
5.2 The Hamiltonian formalism
The conjugate variable p in this system is defned as:
p =
L
q
(64)
= ml
2
q (65)
This, in fact, is the angular momentum of a particle. The hamiltonian of the simple
pendulum is:
H = p q L (66)
= p q
_
1
2
ml
2
q
2
+ mglcos(q)
_
(67)
Re-arranging Equation 65, we obtain that q =
p
ml
2
. Substituting this into Equation 67,
the Hamiltonian can be written as:
H =
p
2
2ml
2
mglcos(q) (68)
Now, we see that the Hamiltonian is independent of time. Thus, as before, H is a
constant. Hence, we can write:
p
2
2ml
2
mglcos(q) = E (69)
11
If q is small, cos(q) 1
q
2
2
. Substituting this approximation into Equation 69:
p
2
2ml
2
mgl
_
1
q
2
2
_
= E (70)
p
2
2ml
2
+
1
2
mglq
2
= E + mgl (71)
We see that this is the equation of an ellipse. As discussed in the case of simple harmonic
oscillation, this describes an oscillation. As this approximation is only valid for small
angles, this implies that at small angles, the pendulum behaves like a simple harmonic
oscillator. Now, to investigate angles around , we expand cos(q) as a Taylor series about
. Here, cos(q) 1+
1
2
(q )
2
. Substituting this approximation into the Hamiltonian,
we obtain the equation:
p
2
2ml
2

1
2
mgl(q )
2
= E mgl (72)
This is an equation of a hyperbola. The actual nature of this behaviour is seen in FIgure
3. Here, we see trajectories that do not intersect with the q-axis. This implies that the
momentum never changes in direction. This corresponds to rotation of the pendulum.
That is, if the initial angle of the pendulum is large enough and the momentum is large
enough, the pendulum will rotate in the same direction for an innite amount of time.
Now, there is also a trajectory in between the oscillatory modes and the rotation modes.
This is known as the separatrix. This trajectory consists of one point at (, 0) and
continuous paths that approach this point. Physically, the point, (, 0) is an unstable
equilibrium point, which means that if the pendulum is started at rest at the very top of
the pendulum, it will stay there. Furthermore, the separatrix curve itself represents an
ideal, practically impossible trajectory that approaches this point of unstable equilibrium
in an innite amount of time.
-0.75 -0.5 -0.25 0 0.25 0.5 0.75 1.25 1.5 1.75 2 2.25 2.5 2.75
Figure 3: The phase portrait of the Simple Pendulum where the horizontal axis repre-
sents q, the angle from the mean position, and the vertical axis denotes p, the angular
momentum
12
6 The generalisation of the Hamiltonian formulation to quantum me-
chanics
Quantum mechanics is a particularly abstract area of physics investigating the fundamen-
tal particles of nature. The equation that underlies the majority of quantum mechanics
is known as the Schrodinger Equation. One simplication of this equation, known as
the time-independent Schrodinger equation is:

H| = E | (73)
Here, | is a vector in a Hilbert space that represents the state of the particle being
observed,

H is a linear operator known as the Hamiltonian operator and E is a real
number
1
. This equation is in fact an eigenvalue equation. So, in this time-indpendent
schrodinger equation, the action of this operator on this vector is equated to the multi-
plication by a scalar quantity. This is remarkably similar to the analysis performed on
the time-independent hamiltonians seen in this report as a function H(q, p, t) is equated
to a constant E. This illustrates the importance of this formulation due to its general-
isability into quite abstract areas like quantum mechanics. A more complete derivation
of quantum mechanics using variational principles can be seen in [Feynman and Hibbs,
1965] and [Pauling and Wilson, 1935].
7 Conclusion
This report investigated the Hamiltonian formalism as an alternative formulation of
the variational problem of minimising a functional. The Hamiltonian formalism is a
truly powerful tool in analysing problems of a variational nature. While actually solving
Hamiltons equations can be dicult even for simple situations, the eectiveness of the
Hamiltonian formalism is seen when there are certain symmetries in the system. When
this is the case, this formalism can even eliminate the need to solve dierential equations,
replacing them by algebraic equations. This form of simplication can be used to solve
some quite complex problems like the pendulum which cannot be solved analytically in
the Lagrangian formalism. Furthermore, this ability to utilise symmetries allows this
formalism to be generalised to quite abstract areas like quantum mechanics.
1
In general E could be a complex number. However, H is dened to be a hermitian operator which
forces all the eigenvalues to be real.
13
References
[Calkin, 1996] Calkin, M. (1996). Lagrangian and Hamiltonian Mechanics. World Sci-
entic Publishing Co., Singapore.
[Edwards, 1973] Edwards, Jr., C. (1973). Advanced Calculus of Several Variables. Dover
Publications, inc., New York.
[Feynman and Hibbs, 1965] Feynman, R. P. and Hibbs, A. R. (1965). Quantum Me-
chanics and Path Integrals. Dover Publications, inc., New York.
[Gupta, 1997] Gupta, A. (1997). Calculus of Variations with Applications. PHI Learn-
ing, New Delhi.
[Pauling and Wilson, 1935] Pauling, L. and Wilson, Jr., E. (1935). Introduction to
Quantum Mechanics. Dover Publications, inc., New York.
[van Brunt, 2004] van Brunt, B. (2004). The Calculus of Variations. Springer-Verlag,
New York.
14

You might also like