# Lagrangians and Hamiltonians

We discussed the Lagrangian and Hamiltonian formulations of physics in My Favorite Equation in Physics, in our discussion of the historical development of classical physics right before the dawn of the revolutionary ideas of relativity and quantum mechanics at the turn of the 20th century. In this post we discuss them further, and more importantly, we provide some examples.

In order to discuss Lagrangians and Hamiltonians we first need to discuss the concept of energy. Energy is a rather abstract concept, but it can perhaps best be described as a certain conserved quantity – historically, this was how energy was thought of, and the motivation for its development under Rene Descartes and Gottfried Wilhelm Liebniz.

Consider for example, a stone at some height $h$ above the ground. From this we can compute a quantity called the potential energy (which we will symbolize by $V$), which is going to be, in our case, given by

$\displaystyle V=mgh$

where $m$ is the mass of the stone and $g$ is the acceleration due to gravity, which close to the surface of the earth can be considered a constant roughly equal to $9.81$ meters per second per second.

As the stone is dropped from that height, it starts to pick up speed. As it height decreases, its potential energy will also decrease. However, it will gain an increase in a certain quantity called the kinetic energy, which we will write as $T$ and define as

$\displaystyle T=\frac{1}{2}mv^{2}$

where $v$ is the magnitude of the velocity. In our case, since we are considering only motion in one dimension, this is simply given by the speed of the stone. At any point in the motion of the stone, however, the sum of the potential energy and the kinetic energy, called the total mechanical energy, stays at the same value. This is because as the amount by which the potential energy decreases is the same as the amount by which the kinetic energy decreases.

The expression for kinetic energy remains the same for any nonrelativistic system. The expression for the potential energy depends on the system, however, and is related to the force as follows:

$\displaystyle F=-\frac{dV}{dx}$.

We now give the definition of the quantity called the Lagrangian (denoted by $L$). It is simply given by

$\displaystyle L=T-V$.

There is a related quantity to the Lagrangian, called the action (denoted by $S$). It is defined as

$\displaystyle S=\int_{t_{1}}^{t_{2}}L dt$.

For a single particle, the Lagrangian depends on the position and the velocity of the particle. More generally, it will depend on the so-called “configuration” of the system, as well as the “rate of change” of this configuration. We will represent these variables by $q$ and $\dot{q}$ respectively (the “dot” notation is the one developed by Isaac Newton to represent the derivative with respect to time; in the notation of Liebniz, which we have used up to now, this is also written as $\frac{dq}{dt}$).

To explicitly show this dependence, we write the Lagrangian as $L(q,\dot{q})$. Therefore we shall write the action as follows:

$\displaystyle S=\int_{t_{1}}^{t_{2}}L(q,\dot{q}) dt$.

The Lagrangian formulation is important because it allows us to make a connection with Fermat’s principle in optics, which is the following statement:

Light always moves in such a way that it minimizes its time of travel.

Essentially, the Lagrangian formulation allows us to restate the good old Newton’s second law of motion as follows:

An object always moves in such a way that it minimizes its action.

In order to make calculations out of this “principle”, we have to make use of the branch of mathematics called the calculus of variations, which was specifically developed to deal with problems such as these. The calculations are fairly involved, but we will end up with the so-called Euler-Lagrange equations:

$\displaystyle \frac{\partial L}{\partial q}-\frac{d}{dt}\frac{\partial L}{\partial\dot{q}}=0$

We are using the notation $\frac{d}{dt}\frac{\partial L}{\partial\dot{q}}$ instead of the otherwise cumbersome notation $\frac{d\frac{\partial L}{\partial\dot{q}}}{dt}$. It is very common notation in physics to write $\frac{d}{dt}$ to refer to the derivative “operator” (see also More Quantum Mechanics: Wavefunctions and Operators).

For a nonrelativistic system, Euler-Lagrange equations are merely a restatement of Newton’s second law; in fact we can plug in the expressions for the Lagrangian, the kinetic energy, and the potential energy we wrote down earlier and end up exactly with $F=ma$.

Why then, go to all the trouble of formulating this new language, just to express something that we are already familiar with? Well, aside from the “aesthetically pleasing” connection with the very elegant Fermat’s principle, there are also numerous advantages to using the Lagrangian formulation. For instance, it exposes the symmetries of the system, as well as its conserved quantities (both of which are very important in modern physics). Also, the configuration is not always simply just the position, which means that it can be used to describe systems more complicated than just a single particle. Using the concept of a Lagrangian density, it can also describe fields like the electromagnetic field.

We make a mention of the role of the Lagrangian formulation  in quantum mechanics. The probability that a system will be found in a certain state (which we write as $|\phi\rangle$) at time $t_{2}$, given that it was in a state $|\psi\rangle$ at time $t_{1}$, is given by (see More Quantum Mechanics: Wavefunctions and Operators)

$\displaystyle |\langle\phi|e^{-iH(t_{2}-t_{1})}|\psi\rangle|^{2}$

where $H$ is the Hamiltonian (more on this later). The quantity

$\displaystyle \langle\phi|e^{-iH(t_{2}-t_{1})}|\psi\rangle$

is called the transition amplitude and can be expressed in terms of the Feynman path integral

$\displaystyle \int e^{iS}Dq$.

This is not an ordinary integral, as may be inferred from the different notation using $Dq$ instead of $dq$. What this means is that we sum the quantity inside the integral, $e^{iS}$, over all “paths” taken by our system. This has the rather mind blowing interpretation that in going from one point to another, a particle takes all paths. One of the best places to learn more about this concept is in the book QED: The Strange Theory of Light and Matter by Richard Feynman. This book is adapted from Feynman’s lectures at the University of Auckland, videos of which are freely and legally available online (see the references below).

We now discuss the Hamiltonian. The Hamiltonian is defined in terms of the Lagrangian $L$ by first defining the conjugate momentum $p$:

$\displaystyle p=\frac{\partial L}{\partial\dot{q}}$.

Then the Hamiltonian $H$ is given by the formula

$\displaystyle H=p\dot{q}-L$.

In contrast to the Lagrangian, which is a function of $q$ and $\dot{q}$, the Hamiltonian is expressed as a function of $q$ and $p$. For many basic examples the Hamiltonian is simply the total mechanical energy, with the kinetic energy $T$ now written in terms of $p$ instead of $\dot{q}$ as follows:

$\displaystyle T=\frac{p^{2}}{2m}$.

The advantage of the Hamiltonian  formulation is that it shows how the state of the system “evolves” over time. This is given by Hamilton’s equations:

$\displaystyle \dot{q}=\frac{\partial H}{\partial p}$

$\displaystyle \dot{p}=-\frac{\partial H}{\partial q}$

These are differential equations which can be solved to know the value of $q$ and $p$ at any instant of time $t$. One can visualize this better by imagining a “phase space” whose coordinates are $q$ and $p$. The state of the system is then given by a point in this phase space, and this point “moves” across the phase space according to Hamilton’s equations.

The Lagrangian and Hamiltonian formulations of classical mechanics may be easily generalized to more than one dimension. We will therefore have several different coordinates $q_{i}$ for the configuration; for the most simple examples, these may refer to the Cartesian coordinates of 3-dimensional space, i.e. $q_{1}=x$$q_{2}=x$$q_{3}=z$. We summarize the important formulas here:

$\displaystyle \frac{\partial L}{\partial q_{i}}-\frac{d}{dt}\frac{\partial L}{\partial\dot{q_{i}}}=0$

$\displaystyle H=\sum_{i}p_{i}\dot{q_{i}}-L$

$\displaystyle \dot{q_{i}}=\frac{\partial H}{\partial p_{i}}$

$\displaystyle \dot{p_{i}}=-\frac{\partial H}{\partial q_{i}}$

In quantum mechanics, the Hamiltonian formulation still plays an important role. As described in More Quantum Mechanics: Wavefunctions and Operators, the Schrodinger equation describes the time evolution of the state of a quantum system in terms of the Hamiltonian. However, in quantum mechanics the Hamiltonian is not just a quantity but an operator, whose eigenvalues usually correspond to the observable values of the energy of the system.

In most modern publications discussing modern physics, the Lagrangian and Hamiltonian formulations are used, in particular for their various advantages. Although we have limited this discussion to nonrelativistic mechanics, in relativity both formulations are still very important. The equations of general relativity, also known as Einstein’s equations, may be obtained by minimizing from the Einstein-Hilbert action. Meanwhile, there also exists a Hamiltonian formulation of general relativity called the Arnowitt-Deser-Misner formalism. Even the proposed candidates for a theory of quantum gravity, string theory and loop quantum gravity, make use of these formulations (the Lagrangian formulation seems to be more dominant in string theory, while the Hamiltonian formulation is more dominant in loop quantum gravity). It is therefore vital that anyone interested in learning about modern physics be at least comfortable in the use of this language.

References:

Lagrangian Mechanics on Wikipedia

Hamiltonian Mechanics on Wikipedia

Path Integral Formulation on Wikipedia

The Douglas Robb Memorial Lectures by Richard Feynman

QED: The Strange Theory of Light and Matter by Richard Feynman

Mechanics by Lev Landau and Evgeny Lifshitz

Classical Mechanics by Herbert Goldstein