--- title: "Hamiltonian mechanics" date: 2021-07-03 categories: - Physics - Classical mechanics layout: "concept" --- **Hamiltonian mechanics** is an alternative formulation of classical mechanics, which equivalent to Newton's laws, but often mathematically advantageous. It is built on the shoulders of [Lagrangian mechanics](/know/concept/lagrangian-mechanics/), which is in turn built on [variational calculus](/know/concept/calculus-of-variations/). ## Definitions In Lagrangian mechanics, use a Lagrangian $L$, which depends on position $q(t)$ and velocity $\dot{q}(t)$, to define the momentum $p(t)$ as a derived quantity. Hamiltonian mechanics switches the roles of $\dot{q}$ and $p$: the **Hamiltonian** $H$ is a function of $q$ and $p$, and the velocity $\dot{q}$ is derived from it: $$\begin{aligned} \pdv{L(q, \dot{q})}{\dot{q}} = p \qquad \quad \pdv{H(q, p)}{p} \equiv \dot{q} \end{aligned}$$ Conveniently, this switch turns out to be [Legendre transformation](/know/concept/legendre-transform/): $H$ is the Legendre transform of $L$, with $p = \partial L / \partial \dot{q}$ taken as the coordinate to replace $\dot{q}$. Therefore: $$\begin{aligned} \boxed{ H(q, p) \equiv \dot{q} \: p - L(q, \dot{q}) } \end{aligned}$$ This almost always works, because $L$ is usually a second-order polynomial of $\dot{q}$, and thus convex as required for Legendre transformation. In the above expression, $\dot{q}$ must be rewritten in terms of $p$ and $q$, which is trivial, since $p$ is proportional to $\dot{q}$ by definition. The Hamiltonian $H$ also has a direct physical meaning: for a mass $m$, and for $L = T - V$, it is straightforward to show that $H$ represents the total energy $T + V$: $$\begin{aligned} H = \dot{q} \: p - L = m \dot{q}^2 - L = 2 T - (T - V) = T + V \end{aligned}$$ Just as Lagrangian mechanics, Hamiltonian mechanics scales well for large systems. Its definition is generalized as follows to $N$ objects, where $p$ is shorthand for $p_1, ..., p_N$: $$\begin{aligned} \boxed{ H(q, p) \equiv \bigg( \sum_{n = 1}^N \dot{q}_n \: p_n \bigg) - L(q, \dot{q}) } \end{aligned}$$ The positions and momenta $(q, p)$ form a phase space, i.e. they fully describe the state. An extremely useful concept in Hamiltonian mechanics is the **Poisson bracket** (PB), which is a binary operation on two quantities $A(q, p)$ and $B(q, p)$, denoted by $\{A, B\}$: $$\begin{aligned} \boxed{ \{ A, B \} \equiv \sum_{n = 1}^N \Big( \pdv{A}{q_n} \pdv{B}{p_n} - \pdv{A}{p_n} \pdv{B}{q_n} \Big) } \end{aligned}$$ ## Canonical equations Lagrangian mechanics has a single Euler-Lagrange equation per object, yielding $N$ second-order equations of motion in total. In contrast, Hamiltonian mechanics has $2 N$ first-order equations of motion, known as **Hamilton's canonical equations**: $$\begin{aligned} \boxed{ - \pdv{H}{q_n} = \dot{p}_n \qquad \pdv{H}{p_n} = \dot{q}_n } \end{aligned}$$
Just like in Lagrangian mechanics, if $H$ does not explicitly contain $q_n$, then $q_n$ is called a **cyclic coordinate**, and leads to the conservation of $p_n$: $$\begin{aligned} \dot{p}_n = - \pdv{H}{q_n} = 0 \quad \implies \quad p_n = \mathrm{conserved} \end{aligned}$$ Of course, there may be other conserved quantities. Generally speaking, the $t$-derivative of an arbitrary quantity $A(q, p, t)$ is as follows, where $\ipdv{}{t}$ is a "soft" derivative (only affects explicit occurrences of $t$), and $\idv{}{t}$ is a "hard" derivative (also affects implicit $t$ inside $q$ and $p$): $$\begin{aligned} \boxed{ \dv{A}{t} = \{ A, H \} + \pdv{A}{t} } \end{aligned}$$
Assuming that $H$ does not explicitly depend on $t$, the above property naturally leads us to an alternative way of writing Hamilton's canonical equations: $$\begin{aligned} \dot{q}_n = \{ q_n, H \} \qquad \quad \dot{p}_n = \{ p_n, H \} \end{aligned}$$ ## Canonical coordinates So far, we have assumed that the phase space coordinates $(q, p)$ are the *positions* and *canonical momenta*, respectively, and that led us to Hamilton's canonical equations. In theory, we could make a transformation of the following general form: $$\begin{aligned} q \to Q(q, p) \qquad \quad p \to P(q, p) \end{aligned}$$ However, most choices of $(Q, P)$ would not preserve Hamilton's equations. Any $(Q, P)$ that do keep this form are known as **canonical coordinates**, and the corresponding transformation is a **canonical transformation**. That is, any $(Q, P)$ that satisfy: $$\begin{aligned} - \pdv{H}{Q_n} = \dot{P}_n \qquad \quad \pdv{H}{P_n} = \dot{Q}_n \end{aligned}$$ Then we might as well write $H(q, p)$ as $H(Q, P)$. So, which $(Q, P)$ fulfill this? It turns out that the following must be satisfied for all $n, j$, where $\delta_{nj}$ is the Kronecker delta: $$\begin{aligned} \boxed{ \{ Q_n, Q_j \} = \{ P_n, P_j \} = 0 \qquad \{ Q_n, P_j \} = \delta_{nj} } \end{aligned}$$
If you have experience with quantum mechanics, the latter equation should look suspiciously similar to the *canonical commutation relation* $[\hat{Q}, \hat{P}] = i \hbar$. ## References 1. R. Shankar, *Principles of quantum mechanics*, 2nd edition, Springer.