# Writing 2D sytem as Hamiltonian sytem using $\nabla$

Suppose we have the system $$\begin{cases} \partial_t f = g\\ \partial_t g = \partial_x^2 f + u(g) \end{cases}$$ where $f = f(x,t)$ and $g=g(x,t)$, and $u: \mathbb{R}\to \mathbb{R}$ are all sufficiently smooth. Let $U$ be an antiderivative of $u$, so $U' = u$. Define $$K := \left(\begin{matrix} 0 & 1 \\ -1 & 0 \end{matrix}\right)$$ and $$H(f, g) := \int_{-\infty}^\infty \frac{1}{2} g^2 + \frac{1}{2}(\partial_x f)^2 - U(f) dx.$$ Then we apparently can write this as a Hamiltonian system $$\partial_t (f,g)^T = K \nabla_{(f,g)^T} H(f,g).$$ The following step now confuses me: \begin{align*} \nabla_{(f,g)^T} H(f,g) &= \nabla_{(f,g)^T} \int_{-\infty}^\infty \frac{1}{2} g^2 + \frac{1}{2}(\partial_x f)^2 - U(f) dx\\ &= \begin{pmatrix} - \partial_x^2 f - u(g)\\ g \end{pmatrix}. \end{align*} I don't understand how this $\nabla_{(f,g)^T}$ acts on this integral; if it is just taking partial derivatives with respect to $f$ and $g$, then why does the integral suddenly disappear? And where does the minus sign in front of $\partial_x^2 f$ come from?

• The minus sign in front of the $\partial_{x}^{2} f$ term is so that multiplying $\nabla_{(f, g)^{T}}H$ by $K$ returns the original system i.e \begin{align} K \nabla_{(f, g)^{T}}H &= \begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix} \begin{pmatrix} - \partial_x^2 f - u(g) \\ g \end{pmatrix} \\ &= \begin{pmatrix} g \\ \partial_x^2 f + u(g) \end{pmatrix} \\ &= \begin{pmatrix} \partial_{t} f \\ \partial_{t} g \end{pmatrix} \end{align} – mattos Jun 1 '17 at 1:21
• I know that it works, but I don't know why it works. My question is how $\nabla_{(f,g)^T}$ acts; why do we have $\nabla_{f} \int_{\mathbb{R}} \frac{1}{2}(\partial_x f)^2 dx = -\partial_x^2 f$ for example? – Brazilian Cérebro Jun 1 '17 at 6:26
• Because Hamiltons equations applied to your system gives \begin{align} \dot{f} &= g \\ &= \partial_{g} H \\ \dot{g} &= \partial_{x}^{2} f + u(g) \\ &= - \partial_{f} H \\ \end{align} Notice the negative in front of $\partial_{f} H$. Hence $$\nabla_{(f, g)^{T}} H(f, g) = (\partial_{f} H, \partial_{g} H)^{T} = (-\partial_{x}^{2} f - u(g), g)^{T}$$ Also, the integral is required to integrate out $x$ so that your Hamiltonian conforms to the ODEs $(\dot{f}, \dot{g})$. – mattos Jun 1 '17 at 6:43