How to prove a vector field is hamiltonian? I've been studying Hamiltonian mechanics lately with kind of a more "differential geometry based" approach , but I'm stuck at a point where it is required to understand how you can prove a vector field is Hamiltonian.
For example if we are given the following simple system of equation, representing a one dimentional system on the phase space $T^{*}Q$
$$
 \dot{q}=f(q,p)\\
 \dot{p}=g(q,p)
$$
If the vector field they represent is Hamiltonian then there should be a function such that
$$
f=\frac{\partial H}{\partial q}\\
g=-\frac{\partial H}{\partial p}
$$
So by deriving we obtain
$$
\frac{\partial f}{\partial q}=\frac{\partial^2 H}{\partial q\partial p}=-\frac{\partial g}{\partial p}
$$
And we obtain that the condition is
$$
\frac{\partial f}{\partial q}+\frac{\partial g}{\partial p}=0
$$
Now on the phase space we have the symplectic 2-form $\omega$. We can define the 1-form $\mathit{i}_{X}\omega$ by setting $\mathit{i}_{X}\omega(Y)=\omega(X,Y)$ where X and Y are vector fields.
For an hamiltonian vector field $X_f$ we have $\mathit{i}_{X_{f}}\omega=-df$, so that we obviously have $d(\mathit{i}_{X}\omega)=-d(df)=0$.
Now we can represent a generic vector field $X=X^{\mu} \frac{{\partial }}{{\partial q^{\mu}}}+Y_{\mu}\frac{{\partial }}{{\partial p_{\mu}}}$
How can I prove that the condition that the vector field is Hamiltonian ($d(\mathit{i}_{X}\omega)=0$) writes as
$$
\frac{\partial X^{\mu}}{\partial q^{\lambda}}+\frac{\partial Y_{\lambda}}{\partial p_{\mu}}=0
$$
?
I've tried expressing $\omega=dp_{\mu}\wedge dq^{\mu}$ but then I dont know how to compute neither $\mathit{i}_{X}\omega$ nor $d(\mathit{i}_{X}\omega)$.
Thanks in advance for any help whatsoever.
 A: The issue seems to be that you do not have sufficient practice with computations in charts. Note that calculating things like Lie-derivatives, exterior-derivatives, interior products etc are all very simple if you just learn the basic rules for them (and with some practice it becomes as simple as calculating that for $g(x) = e^{\sin(x^2)}$, we have $g'(x) = e^{\sin(x^2)}\cos(x^2) \cdot 2x$).
Note that things like interior derivative and exterior derivatives satisfy some form of the "product rule":

*

*$d(\alpha\wedge \beta) = d\alpha \wedge \beta + (-1)^{\deg \alpha} \alpha \wedge \beta$

*$X \,\lrcorner\, (\alpha\wedge \beta) = (X\, \lrcorner \, \alpha)\wedge \beta + (-1)^{\deg \alpha} \alpha \wedge (X\,\lrcorner\, \beta)$. i.e $\iota_X(\alpha\wedge \beta) = (\iota_X\alpha)\wedge \beta + (-1)^{\deg \alpha} \alpha \wedge (\iota_X\beta)$
Also, these are "local operators" in the sense that if you have a differential form $\alpha$ and an open set $U$ then $(d\alpha)|_U = d(\alpha|_U)$ (i.e restriction of exterior derivative is exterior derivative of restriction). Similarly for interior product. As a result of this, in order to calculate exterior derivatives/interior products, all you need to know is how to calculate it for $0$-forms and for $1$-forms. Then, in the general case of a $k$-form, you just expand it as $\alpha = \sum \alpha_{i_1\dots i_k}\, dx^{i_1}\wedge \dots \wedge dx^{i_k}$ and repeatedly apply the product rule (and the fact that these operations are $\Bbb{R}$-linear).
The only other thing you really need to know in order to calculate things is that for smooth functions $f$, we have $df = \frac{\partial f}{\partial x^i} dx^i$ and $X\, \lrcorner \, f = 0$, and for one-forms of the type $dg$, we have $d(dg) = 0$ and $X\, \lrcorner \,dg = dg(X) = \frac{\partial g}{\partial x^i} dx^i(X) =  \frac{\partial g}{\partial x^i} X^i$.

Exterior Derivatives:
So, for example, if we have a $k$-form $\alpha$, you can either prove from these axioms (or take as your definition) that if $\alpha = \sum_I \alpha_I dx^I \equiv \sum_I \alpha_{i_1\dots i_k} dx^{i_1}\wedge \dots \wedge dx^{i_k}$, (where $I$ is an injective tuple) then by repeatedly applying the product rule, and the rules for calculating $df$ and the rule that $d(df) = 0$, we find that
\begin{align}
d\alpha &= \sum_{I} d(\alpha_I)\wedge  dx^{i_1}\wedge \dots \wedge dx^{i_k}  \\
&= \sum_{I,j} \frac{\partial \alpha_I}{\partial x^j}\, dx^j \wedge dx^{i_1}\wedge \dots \wedge dx^{i_k}
\end{align}

Interior Product:
To calculate interior products, it's easily observed that $\iota_X\alpha$ is $C^{\infty}(M)$-linear in both the $X$ slot and also $\alpha$. This is why I've been using the $\lrcorner$ notation for interior product: it "almost behaves" like a "regular product" $\cdot$ in the sense that
\begin{align}
X\, \lrcorner \, \alpha &= \left(\sum_aX^a \frac{\partial}{\partial x^a}\right)\, \lrcorner \,
\left(\sum_I \alpha_I \, dx^I\right) = \sum_{a,I} X^a \alpha_I \left(\frac{\partial}{\partial x^a} \, \lrcorner \, dx^I\right)
\end{align}
So, you see, to calculate the interior product, all you need to know is how the interior product of the basic "coordinate vector fields" and "coordinate $1$-forms" works. Now, using repeated application of the product rule, and the fact that $\frac{\partial}{\partial x^a}\, \lrcorner \, dx^i = \frac{\partial x^i}{\partial x^a}=\delta^i_a$ (immediate consequence of the definitions), we see that
\begin{align}
\frac{\partial}{\partial x^a}\, \lrcorner \, (dx^{i_1}\wedge \dots dx^{i_k}) &= + \left(\frac{\partial}{\partial x^a} \, \lrcorner\,  dx^{i_1}\right) \cdot dx^{i_2}\wedge \dots \wedge dx^{i_k} \\
&\,\,- dx^{i_1}\wedge \left(\frac{\partial}{\partial x^a} \, \lrcorner\,  dx^{i_2}\right) dx^{i_3}\wedge \dots \wedge dx^{i_k} \\
&+ \cdots \\
& - \cdots \\
& + (-1)^k dx^{i_1}\wedge \dots \wedge dx^{i_{k-1}} \left(\frac{\partial}{\partial x^a} \, \lrcorner\,  dx^{i_k}\right) \\
\end{align}
In other words, you just alternate signs and replace subsequent $dx^i$'s by an appropriate $\frac{\partial x^i}{\partial x^a}=\delta^i_a$. If you want a single formula, then this is just
\begin{align}
\frac{\partial}{\partial x^a}\, \lrcorner \, (dx^{i_1}\wedge \dots dx^{i_k}) 
&= \sum_{\mu=1}^k (-1)^{\mu-1}\, \frac{\partial x^{i_{\mu}}}{\partial x^a} dx^{i_1}\wedge \dots \wedge \widehat{dx^{i_{\mu}}} \wedge \dots \wedge dx^{i_k}\\
&= \sum_{\mu=1}^k (-1)^{\mu-1}\, \delta^{i_{\mu}}_a \cdot dx^{i_1}\wedge \dots \wedge \widehat{dx^{i_{\mu}}} \wedge \dots \wedge dx^{i_k}
\end{align}
(Just try this out explicitly for the case $k=3,4,5$, and you'll definitely see the pattern)

Now, putting these rules together we can apply to your special case. For $X = X^{\mu}\frac{\partial}{\partial q^{\mu}} + Y_{\mu}\frac{\partial}{\partial p_{\mu}}$ and $\omega = dp_a\wedge dq^a$, we have:
\begin{align}
\iota_X\omega &\equiv X\, \lrcorner \, \omega \\
&= \left(X^{\mu}\frac{\partial}{\partial q^{\mu}} + Y_{\mu}\frac{\partial}{\partial p_{\mu}}\right) \, \lrcorner \, (dp_a\wedge dq^a) \\
&= X^{\mu}\left(\frac{\partial}{\partial q^{\mu}} \, \lrcorner\, (dp_a\wedge dq^a) \right) 
+ Y_{\mu}\left(\frac{\partial}{\partial p_{\mu}} \, \lrcorner\, (dp_a\wedge dq^a) \right) \\
&= X^{\mu}\left( \frac{\partial p_a}{\partial q^{\mu}} dq^a - \frac{\partial q^a}{\partial q^{\mu}} dp_a\right)
+
Y_{\mu}\left( \frac{\partial p_a}{\partial p_{\mu}} dq^a - \frac{\partial q^a}{\partial p_{\mu}} dp_a\right) \\
&= Y_{\mu} dq^{\mu} - X^{\mu} dp_{\mu}
\end{align}
(with some practice you'll be able to skip a few steps and keep track of what are the non-zero terms). So, now calculating the exterior derivative of this, we see that
\begin{align}
d(X \, \lrcorner\, \omega) &= d(Y_{\mu}) \wedge dq^{\mu} - d(X^{\mu}) \wedge dp_{\mu} \\
&= \left( \frac{\partial Y_{\mu}}{\partial q^{\lambda}}dq^{\lambda} + 
\frac{\partial Y_{\mu}}{\partial p_{\lambda}}dp_{\lambda} \right)\wedge dq^{\mu} 
- \left( \frac{\partial X^{\mu}}{\partial q^{\lambda}}dq^{\lambda} + 
\frac{\partial X^{\mu}}{\partial p_{\lambda}}dp_{\lambda} \right)\wedge dp_{\mu} \\
&= \left[\left(\frac{\partial X^{\mu}}{\partial q^{\lambda}} +
\frac{\partial Y_{\lambda}}{\partial p_{\mu}}\right) dp_{\mu}\wedge dq^{\lambda}\right] + 
\left[\frac{\partial Y_{\mu}}{\partial q^{\lambda}}\, dq^{\lambda}\wedge dq^{\mu}\right]
+ \left[\frac{\partial X^{\mu}}{\partial p_{\lambda}}\, dp_{\mu}\wedge dp_{\lambda}\right]
\end{align}
where in the last line, I did quite a bit of index juggling, along with the fact that wedge product is "anti-commutative"; i.e for $1$-forms $\alpha,\beta$, we have $\alpha\wedge \beta = - \beta \wedge \alpha$. Now, here, one must be careful because not all of the forms are linearly independent; we can rewrite this expression as:
\begin{align}
d(X \, \lrcorner\, \omega) &=
\sum_{\lambda,\mu} \left(\frac{\partial X^{\mu}}{\partial q^{\lambda}} +
\frac{\partial Y_{\lambda}}{\partial p_{\mu}}\right) dp_{\mu}\wedge dq^{\lambda}\\
&+
\sum_{\lambda < \mu} \left( \frac{\partial Y_{\mu}}{\partial q^{\lambda}} - \frac{\partial Y_{\lambda}}{\partial q^{\mu}}\right) dq^{\lambda}\wedge dq^{\mu} \\
&+ \sum_{\lambda < \mu} \left(\frac{\partial X^{\mu}}{\partial p_{\lambda}} - \frac{\partial X^{\lambda}}{\partial p_{\mu}} \right) dp_{\mu}\wedge dp_{\lambda}
\end{align}
Now, the forms are linearly independent, so $d(X\, \lrcorner \, \omega) = 0$ if and only if each of the coefficients vanishes: i.e if and only if:
\begin{align}
\begin{cases}
\dfrac{\partial X^{\mu}}{\partial q^{\lambda}} +
\dfrac{\partial Y_{\lambda}}{\partial p_{\mu}} &= 0 \quad \text{for all $\lambda,\mu \in\{1,\dots, n\}$}\\\\
\dfrac{\partial Y_{\mu}}{\partial q^{\lambda}} - 
\dfrac{\partial Y_{\lambda}}{\partial q^{\mu}} &= 0 \quad \text{for all $\lambda,\mu \in\{1,\dots, n\}$, such that $\lambda < \mu$} \\\\
\dfrac{\partial X^{\mu}}{\partial p_{\lambda}} - 
\dfrac{\partial X^{\lambda}}{\partial p_{\mu}} &= 0 \quad \text{for all $\lambda,\mu \in\{1,\dots, n\}$, such that $\lambda < \mu$}
\end{cases}
\end{align}
This condition is clearly equivalent to saying that for all $\lambda,\mu \in \{1,\dots, n\}$,
\begin{align}
\begin{cases}
\dfrac{\partial X^{\mu}}{\partial q^{\lambda}} +
\dfrac{\partial Y_{\lambda}}{\partial p_{\mu}} = 0\\\\
\dfrac{\partial Y_{\mu}}{\partial q^{\lambda}} =
\dfrac{\partial Y_{\lambda}}{\partial q^{\mu}} \\\\
\dfrac{\partial X^{\mu}}{\partial p_{\lambda}} = 
\dfrac{\partial X^{\lambda}}{\partial p_{\mu}} \tag{$\ddot{\smile}$}
\end{cases}
\end{align}
So, the condition for a vector field $X$ on a symplectic manifold to be locally-Hamiltonian (i.e $\mathcal{L}_X\omega = d(X \,\lrcorner\, \omega) = 0$), expressed in terms of a Darboux Coordinate system is the set PDEs $(\ddot{\smile})$.
A: Well, let me use the following notation for vectors in Darboux coordinates
$$X=X^\mu_{(q)}\frac{\partial}{\partial q^\mu}+X_\mu^{(p)}\frac{\partial}{\partial p_\mu}.$$
We then have
$$\omega(X,Y)=X_\mu^{(p)}Y^\mu_{(q)}-X^\mu_{(q)}Y_\mu^{(p)}.$$
From this we conclude that
$$\iota_X\omega=\omega(X,\cdot)=X_\mu^{(p)}\text{d}q^\mu-X^\mu_{(q)}\text{d}p_\mu.$$
Now, the Hamiltonian condition reads
$$0=\text{d}(\iota_X\omega)=\left(\frac{\partial X_\mu^{(p)}}{\partial p^\nu}+\frac{\partial X^\mu_{(p)}}{\partial q^\nu}\right)\text{d}p_\nu\wedge\text{d}q^\mu,$$
which is the result you were looking for.
A: First of all, let us agree on terminology: In a symplectic manifold $(M,\omega)$ a Hamiltonian vector field (HVF) $X_f$ is always a symplectic vector field (SVF) ${\cal L}_X\omega=0$, which in local coordinates reads
$$ 0~=~({\cal L}_X\omega)_{IJ}~=~X[\omega_{IJ}] +(\partial_I X^K)\omega_{KJ}+ \omega_{IK}(\partial_J X^K), \qquad I,J~\in~\{1,\ldots,2n\}. $$
Conversely, a SVF is a HVF locally in contractable neighborhoods, but not necessarily globally.
