1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
---
title: "Hamiltonian mechanics"
firstLetter: "H"
publishDate: 2021-07-03
categories:
- Physics
- Classical mechanics
date: 2021-07-03T14:39:14+02:00
draft: false
markup: pandoc
---
# Hamiltonian mechanics
**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}$$
<div class="accordion">
<input type="checkbox" id="proof-canoneq"/>
<label for="proof-canoneq">Proof</label>
<div class="hidden">
<label for="proof-canoneq">Proof.</label>
For the first equation,
we differentiate $H$ with respect to $q_n$,
and use the chain rule:
$$\begin{aligned}
\pdv{H}{q_n}
&= \pdv{q_n} \Big( \sum_{j} \dot{q}_j \: p_j - L \Big)
\\
&= \sum_{j} \bigg( \Big( \dot{q}_j \pdv{p_j}{q_n} + p_j \pdv{\dot{q}_j}{q_n} \Big)
- \Big( \pdv{L}{q_n} + \pdv{L}{\dot{q}_j} \pdv{\dot{q}_j}{q_n} \Big) \bigg)
\\
&= \sum_{j} \Big( p_j \pdv{\dot{q}_j}{q_n} - \pdv{L}{q_n} - p_j \pdv{\dot{q}_j}{q_n} \Big)
= - \pdv{L}{q_n}
\end{aligned}$$
We use the Euler-Lagrange equation here,
leading to the desired equation:
$$\begin{aligned}
- \pdv{L}{q_n} = - \dv{t} \Big( \pdv{L}{\dot{q}_n} \Big) = - \dv{p_n}{t} = - \dot{p}_n
\end{aligned}$$
The second equation is somewhat trivial,
since $H$ is defined to satisfy it in the first place.
Nevertheless, we can prove it by brute force,
using the same approach as above:
$$\begin{aligned}
\pdv{H}{p_n}
&= \pdv{p_n} \Big( \sum_{j} \dot{q}_j \: p_j - L \Big)
\\
&= \sum_{j} \bigg( \Big( \dot{q}_j \pdv{p_j}{p_n} + p_j \pdv{\dot{q}_j}{p_n} \Big)
- \Big( \pdv{L}{q_j} \pdv{q_j}{p_n} + \pdv{L}{\dot{q}_j} \pdv{\dot{q}_j}{p_n} \Big) \bigg)
\\
&= \dot{q}_n + \sum_{j} \Big( p_j \pdv{\dot{q}_j}{p_n}
- 0 \pdv{L}{q_j} - p_j \pdv{\dot{q}_j}{p_n} \Big)
= \dot{q}_n
\end{aligned}$$
</div>
</div>
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 $\pdv*{t}$ is a "soft" derivative
(only affects explicit occurrences of $t$),
and $\dv*{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}$$
<div class="accordion">
<input type="checkbox" id="proof-diff-t"/>
<label for="proof-diff-t">Proof</label>
<div class="hidden">
<label for="proof-diff-t">Proof.</label>
We differentiate via the multivariate chain rule,
insert the canonical equations,
and eventually recognize the PB definition:
$$\begin{aligned}
\dv{A}{t}
&= \sum_{n} \Big( \pdv{A}{q_n} \pdv{q_n}{t} + \pdv{A}{p_n} \pdv{p_n}{t} \Big) + \pdv{A}{t}
\\
&= \sum_{n} \Big( \pdv{A}{q_n} \dot{q}_n + \pdv{A}{p_n} \dot{p}_n \Big) + \pdv{A}{t}
\\
&= \sum_{n} \Big( \pdv{A}{q_n} \pdv{H}{p_n} - \pdv{A}{p_n} \pdv{H}{q_n} \Big) + \pdv{A}{t}
\end{aligned}$$
</div>
</div>
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}$$
<div class="accordion">
<input type="checkbox" id="proof-cantrans"/>
<label for="proof-cantrans">Proof</label>
<div class="hidden">
<label for="proof-cantrans">Proof.</label>
Assuming that $Q_n$, $P_n$ and $H$ do not explicitly depend on $t$,
we use our expression for the $t$-derivative of an arbitrary quantity,
and apply the multivariate chain rule to it:
$$\begin{aligned}
\dot{Q}_n
&= \{Q_n, H\}
= \sum_{n} \bigg( \pdv{Q_n}{q_n} \pdv{H}{p_n} - \pdv{Q_n}{p_n} \pdv{H}{q_n} \bigg)
\\
&= \sum_{n, j} \bigg( \pdv{Q_n}{q_n} \Big( \pdv{H}{Q_j} \pdv{Q_j}{p_n} + \pdv{H}{P_j} \pdv{P_j}{p_n} \Big)
- \pdv{Q_n}{p_n} \Big( \pdv{H}{Q_j} \pdv{Q_j}{q_n} + \pdv{H}{P_j} \pdv{P_j}{q_n} \Big) \bigg)
\\
&= \sum_{n, j} \bigg( \pdv{H}{Q_j} \Big( \pdv{Q_n}{q_n} \pdv{Q_j}{p_n} - \pdv{Q_n}{p_n} \pdv{Q_j}{q_n} \Big)
+ \pdv{H}{P_j} \Big( \pdv{Q_n}{q_n} \pdv{P_j}{p_n} - \pdv{Q_n}{p_n} \pdv{P_j}{q_n} \Big) \bigg)
\\
&= \sum_{j} \bigg( \pdv{H}{Q_j} \{Q_n, Q_j\} + \pdv{H}{P_j} \{Q_n, P_j\} \bigg)
\end{aligned}$$
This is equivalent to Hamilton's equation $\dot{Q}_n = \pdv*{H}{P_n}$
if and only if $\{Q_n, Q_j\} = 0$ for all $n$ and $j$,
and if $\{Q_n, P_j\} = \delta_{nj}$.
Next, we do the exact same thing with $P_n$ instead of $Q_n$,
giving an analogous result:
$$\begin{aligned}
\dot{P}_n
&= \{P_n, H\}
= \sum_{n} \bigg( \pdv{P_n}{q_n} \pdv{H}{p_n} - \pdv{P_n}{p_n} \pdv{H}{q_n} \bigg)
\\
&= \sum_{n, j} \bigg( \pdv{P_n}{q_n} \Big( \pdv{H}{Q_j} \pdv{Q_j}{p_n} + \pdv{H}{P_j} \pdv{P_j}{p_n} \Big)
- \pdv{P_n}{p_n} \Big( \pdv{H}{Q_j} \pdv{Q_j}{q_n} + \pdv{H}{P_j} \pdv{P_j}{q_n} \Big) \bigg)
\\
&= \sum_{n, j} \bigg( \pdv{H}{Q_j} \Big( \pdv{P_n}{q_n} \pdv{Q_j}{p_n} - \pdv{P_n}{p_n} \pdv{Q_j}{q_n} \Big)
+ \pdv{H}{P_j} \Big( \pdv{P_n}{q_n} \pdv{P_j}{p_n} - \pdv{P_n}{p_n} \pdv{P_j}{q_n} \Big) \bigg)
\\
&= \sum_{j} \bigg( \pdv{H}{Q_j} \{P_n, Q_j\} + \pdv{H}{P_j} \{P_n, P_j\} \bigg)
\end{aligned}$$
Which is equivalent to Hamilton's equation $\dot{P}_n = -\pdv*{H}{Q_n}$
if and only if $\{P_n, P_j\} = 0$,
and $\{Q_n, P_j\} = - \delta_{nj}$.
The PB is anticommutative,
i.e. $\{A, B\} = - \{B, A\}$.
</div>
</div>
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.
|