Necessary and Sufficient Condition for First Order System to be Mutually Consistent

Theorem
Let $\mathbf y$, $\boldsymbol \psi$ be N-dimensional vectors.

Let $g$ be a twice differentiable mapping.

Let


 * $(1): \quad \map {\boldsymbol \psi} {x, \mathbf y} = \map {\mathbf y'} {x, \mathbf y}$


 * $(2): \quad \mathbf p \sqbrk {x, \mathbf y, \map {\boldsymbol \psi} {x, \mathbf y} } = \map {g_{\mathbf y} } {x, \mathbf y}$

where $\mathbf p$ is a momentum.

Then the boundary conditions defined by $(1)$ are mutually consistent the mapping $\map g {x, \mathbf y}$ satisfies the Hamilton-Jacobi equation:


 * $(3): \quad \dfrac {\partial g} {\partial x} + \map H {x, \mathbf y, \dfrac {\partial g} {\partial \mathbf y} } = 0$

Necessary condition
Take the partial derivative of $(3)$ $x$:


 * $(4): \quad \frac {\partial^2 \map g {x, \mathbf y} } {\partial \mathbf y \partial x} = -\dfrac \partial {\partial \mathbf y} \map H {x, \mathbf y, \dfrac {\partial g} {\partial \mathbf y} }$

By the Schwarz-Clairaut Theorem, the order of partial derivatives of $g$ can be exchanged:


 * $(5): \quad \dfrac {\partial^2 \map g {x, \mathbf y} } {\partial \mathbf y \partial x} = \dfrac {\partial \mathbf p \sqbrk {x, \mathbf y, \map {\boldsymbol \psi} {x, \mathbf y} } } {\partial x}$

Since $\map g {x, \mathbf y}$ depends on $\mathbf y$ only in a direct way, it follows that:
 * $\dfrac {\partial g} {\partial \mathbf y} = g_{\mathbf y}$

Hence, from $(2)$, $(4)$ and $(5)$ it follows that:


 * $\dfrac {\partial \mathbf p \sqbrk {x, \mathbf y, \map {\boldsymbol \psi} {x, \mathbf y} } } {\partial x} = -\dfrac \partial {\partial \mathbf y} \map H {x, \mathbf y, \mathbf p \sqbrk {x, \mathbf y, \map {\boldsymbol \psi} {x, \mathbf y} } }$

These are the consistency equations.