# How can I show that applying Hamiltonian dynamics recovers the original wave equation?

## Problem

Consider the wave equation:

$$\frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2}\tag{1}$$

with $$u = u(t, x)$$ over domain $$x \in [0, l] = \Omega$$. This can be represented as a Hamiltonian system with generalized coordinates $$p = \dot{u}$$ and $$q = u$$.

Then the Hamiltonian is defined as: $$\mathcal{H}(p, q) = \int_{\Omega}\left[ \frac{1}{2} p^2 + \frac{1}{2}c^2 \left(\frac{\partial q}{\partial x}\right)^2\right] \; dx \tag{2}$$

with dynamics $$\dot{q} = \frac{\delta \mathcal{H}}{\delta p }\quad\text{and}\quad\dot{p} = - \frac{\delta \mathcal{H}}{\delta q }.\tag{3}$$ (See 6.1 in https://arxiv.org/abs/1407.6118)

I am trying to recover the original form (1) using the Hamiltonian formulation above.

### Here is what I've tried:

I have a background in mathematics, but less so in physics (other than an intro sequence that did not cover Hamiltonian mechanics). I am currently a graduate student trying to understand this derivation for my research.

I originally started by treating the dynamics for $$\dot{q}$$ and $$\dot{p}$$ as standard partial derivatives, but ran into a couple of issues; at which point I tried using the concept of the total variation, and was starting from this definition $$\delta \mathcal{H} = \frac{\partial \mathcal{H}}{\partial p} \delta p + \frac{\partial \mathcal{H}}{\partial q} \delta q. \tag{4}$$

But I seem to be missing something and am getting stuck:

1. the integral over $$\Omega$$ is still present in my derivation so it seems like the dynamics of $$\dot{q}$$ require integrating over the entire domain $$\Omega$$ - this seems wrong.
2. When taking the derivative with respect to $$q$$, I obtain the term $$\frac{\partial}{\partial q}\left( \left(\frac{\partial q}{\partial x}\right)^2\right)$$ which I think should yield $$2\left(\frac{\partial q}{\partial x}\right) \cdot \frac{\partial}{\partial q}\left(\frac{\partial q}{\partial x}\right)$$. However I don't know exactly how to evaluate $$\frac{\partial}{\partial q}\left(\frac{\partial q}{\partial x}\right)$$ and this doesn't seem to lead to the right result.

Assistance with showing the derivation, or even just recommended readings/references would be greatly appreciated.

• your wave equation is wrong. The wave equation contains two derivative w/r to $x$ and two derivative w/r to $t$. Commented Jun 3, 2022 at 21:26

$$\frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2}\tag{1}$$

with $$u = u(t, x)$$ over domain $$x \in [0, l] = \Omega$$. This can be represented as a Hamiltonian system with generalized coordinates $$p = \dot{u}$$ and $$q = u$$.

the Hamiltonian is defined as: $$\mathcal{H}(p, q) = \int_{\Omega}\left[ \frac{1}{2} p^2 + \frac{1}{2}c^2 \left(\frac{\partial q}{\partial x}\right)^2\right] \; dx \tag{2}$$

with dynamics $$\dot{q} = \frac{\delta \mathcal{H}}{\delta p }\quad\text{and}\quad\dot{p} = - \frac{\delta \mathcal{H}}{\delta q }.\tag{3}$$

I am trying to recover the original form (1) using the Hamiltonian formulation above.

To orient yourself, recall the standard Hamiltonian equations of motion for a system with $$N$$ coordinates labeled by index $$i$$: $$\frac{\partial H}{\partial p_i} = \dot q_i$$ $$\frac{\partial H}{\partial q_i} = -\dot p_i\;.$$

When we start to treat the index $$i$$ as continuous rather than discrete, we switch to a continuous label $$x$$ and we switch from a sum over $$i$$ to an integral over $$x$$. We also switch to saying that $$H$$ is a functional of $$q(x)$$ rather than a function of the $$q_i$$, etc.

The continuum generalization of Hamilton's equations of motion are: $$\frac{\partial H}{\partial p(x)} = \dot q(x)$$ and $$\frac{\partial H}{\partial q(x)} = -\dot p(x)\;,$$ where I am going to keep using the $$\partial$$ notation rather than the $$\delta$$ notation, even for functional derivative, but you can use whatever notation you like.

When we take the "functional derivative" we consider what happens to the functional $$H$$ when the function $$q(x)$$ is changed to $$q(x)+\delta q(x)$$ and we define the functional derivative $$\frac{\partial H}{\partial q(x)}$$ as: $$\delta H \equiv \int \frac{\partial H}{\partial q(x)}\delta q(x) dx + O(\delta q^2) \tag{5}$$

For example, in your Hamiltonian, let $$q \to q+\delta q$$. Then $$H \to H + \int dx c^2\frac{\partial q}{\partial x}\frac{\partial \delta q}{\partial x} + O(\delta q^2) \tag{6}$$ $$= H - \int dx c^2\frac{\partial^2 q}{\partial x^2}\delta q + O(\delta q^2)\;, \tag{7}$$ which shows that the functional derivative wrt q(x) is: $$\frac{\partial H}{\partial q(x)} = -c^2\frac{\partial^2 q}{\partial x^2}$$

Similarly: $$\frac{\partial H}{\partial p(x)} = p(x) \equiv \dot q(x)$$

Then, also using Hamilton's canonical equations, we see that: $$-c^2\frac{\partial^2 q}{\partial x^2} = \frac{\partial H}{\partial q(x)} = -\dot p(x) = -\ddot q(x)$$

Or, cancelling the minus sign and switching back to $$u=q$$: $$c^2 \frac{\partial^2 u}{\partial x^2} = \ddot u$$

• Thank you, this is extremely helpful , well written, and clarifies a lot conceptually. One more clarifying question, how do you go from equation (6) to (7)? I believe I understand approximately what's going on, but not sure I follow the manipulation of the partial derivatives, and particularly the sign flip.
– nhs
Commented Jun 3, 2022 at 21:31
• To go from (6) to (7) you integrate by parts. This moves the derivative to the other term and picks up a minus sign. There is a boundary term, but that is assumed to equal zero because of the boundary conditions.
– hft
Commented Jun 3, 2022 at 22:00
• For example: $\int dx \frac{df}{dx}\frac{dg}{dx} = \int dx \left[ \frac{d}{dx}\left(\frac{df}{dx}g\right) - \frac{d^2f}{dx^2}g\right]$. The first term on the RHS can be integrated trivially to give the boundary terms which in our case vanish due to boundary conditions. So whenever the boundary terms vanish we can just use the equality: $\int dx \frac{df}{dx}\frac{dg}{dx} = -\int dx \frac{d^2f}{dx^2}g$.
– hft
Commented Jun 3, 2022 at 22:03