The integrability conditions for the existence of a Lagrangian or Hamiltonian are known as "conditions of variational self-adjointness."

The conditions are studied in the context of the Inverse Problem, which

formulates as:

*Given the totality of solutions $y(x) = \left\{y^1(x), \ldots, y^n(x)\right\}$ of a system of $n$ ordinary differential equations of order $r$,
$$F_k\left(x, y^{(0)}, y^{(1)}, \ldots, y^{(r)}\right)=0\qquad\text{(I.23)}$$
$$y^{(i)}=\frac{d^iy}{dx^i},\qquad i=1,\ldots,r,\qquad k=1,2,\ldots,n,$$
determine whether there exists a functional
$$A(y)=\int_{x_1}^{x_2}dxL\left(x,y^{(0)},\ldots,y^{(r-1)}\right)\qquad\text{(I.24)}$$
which admits such solutions as extremals.*

It appears Helmholtz was the first to study the Inverse Problem (*ibid.*, p. 12):

The necessary and sufficient conditions for the existence of a solution $L$ of system (I.29)* were apparently formulated for the first time by Helmholtz
(1887)^{26} on quite remarkable intuitional grounds. In essence, Helmholtz's starting point was the property of the self-adjointness of Lagrange's equations, i.e., their system of variational forms coincides with the adjoint system (see Chapter 2 and following). This is a property which goes back to Jacobi (1837).^{27} Without providing a rigorous proof, Helmholtz indicated that the necessary and sufficient condition for the existence of a solution $L$ of system (I.28)** is that the system $F_k = 0$ be self-adjoint.

^{26. Helmholtz did not consider an explicit dependence of the equations of motion on time. Subsequent studies indicated that his findings were insensitive to such a dependence.27. The equations of variations of Lagrange's equations or, equivalently, of Euler's equations of a variational problem, are called Jacobi's equations in the current literature of the calculus of variations. We shall use the same terminology for our Newtonian analysis.}

^{*(I.29) is the Euler-Lagrange equation corresponding to (I.24) when $n>1$, $r=2$.**(I.28) is the case when $n=r=1$.}

This same analysis of conditions for variational self-adjointness of a Lagrangian can be applied to Hamiltonians, as Hamiltonians are simply the Legendre transform of Lagrangians (cf. Callen's *Thermodynamics and an Introduction to Thermostatistics* §5.2 (pp. 137-145) for a good introduction to Legendre transforms).

Helmholtz (1887) is:

This post imported from StackExchange MathOverflow at 2018-08-28 16:20 (UTC), posted by SE-user Geremia