Remark: I have decided to rework this answer completely. I was unhappy with it and it was incomplete. I have replaced functional derivatives as the main tool with Euler and Helmholtz operators as it is more rigorous mathematically that way.
The problem OP is asking about is called the inverse problem to the calculus of variations. It is useful to separate this problem into two branches, the weak inverse problem, and the strong inverse problem (these are not standard names). In addition to that, it is also useful to separate them into global and local problems.
This answer will focus on the weak local problem, but I will make some remarks about the strong and global problem as well.
1 . Preliminaries:
Let us fix some notation first.
Variablies, indices.We consider $m$ independent variables $x=(x^1,\dots,x^m)=(x^i)$ and $n$ field components $\psi(x)=(\psi^1(x),\dots,\psi^n(x))=(\psi^\sigma(x))$.
The space of independent variables is denoted $X\subseteq\mathbb R^m$ and is considered to be some open subset of Cartesian $m$-space. Since we are interested in formal aspects of the calculus of variations, I will assume all fields/functions to be $C^\infty$ as I have no interest in considering weak extremals and this kind of problems here.
As indicated, latin indices $i,j,k,\dots$ take the values $1,\dots,m$ and greek indices take the values $1,\dots,n$. Summation convention is assumed except for the multiindices to be introduced later.
We assume throughout this answer that both the set $X$ of independent varibles, and the field space involved are contractible to $0$, explicitly meaning that if $x$ is an allowed set of variables, then so is $sx$ for $0\le s\le 1$, and if $\psi$ is an allowed field configuration, then $s\psi$ is also an allowed field for $0\le s\le 1$.
Functionals.The object $f$ is a local functional if it maps a field $\psi$ into a function$f[\psi]$ defined on $X$ such that the value $f[\psi](x)$ depends only on $x$ and the values of the derivatives of $\psi$ up to some finite order $r$ which is called the order of $f$. Note that if $f$ is order $r$ then it is also trivially order $s$ for $s\ge r$.
We can then write $$ f[\psi](x)=f(x,\psi(x),\psi^{(1)}(x),\dots,\psi^{(r)}(x)), $$ where $$ \psi^{(r)}(x):=\left(\psi^\sigma_{i_1...i_r}(x)\right)_{i_1\le\cdots\le i_r}, $$ and $\psi^\sigma_{i_1...i_r}:=\partial_{i_1}\dots\partial_{i_r}\psi^\sigma$. The restriction $i_1\le\dots\le i_r$ is necessary because the higher derivatives are symmetric in the indices and are thus only independent if we restrict them this way.
We will refer to a local functional $L[\psi]=L(x,\psi,\dots,\psi^{(r)})$ of a single component as a Lagrangian, and to a local functional $\varepsilon_\sigma[\psi]=\varepsilon_\sigma(x,\psi,\dots,\psi^{(r)})$ with $n$ (number of field components) components as a source expression.
Derivatives.Because it is inconvenient to order the sums, if $f$ is a local functional let $$\frac{\eth f}{\eth \psi^\sigma_{i_1...i_k}},\quad i_1\le\dots \le i_k $$ denote the derivatives with respect to the derivative variables. Extend these derivatives symmetrically to all orders of the indices $i_1\dots i_k$, then define the symmetric derivative to be $$ \frac{\partial f}{\partial \psi^\sigma_{i_1...i_k}}:=\frac{m_1!\dots m_m!}{k!}\frac{\eth f}{\eth \psi^\sigma_{i_1...i_k}}, $$where $m_i$ is the number of times the index $i$ appears in $i_1\dots i_k$. This multinomial coefficient will ensure that the chain rule can be used with symmetric derivatives with no additional factors. We remark that $$ \frac{\partial \psi^\sigma_{j_1...j_k}}{\partial\psi^\tau_{i_1...i_k}}=\delta^\sigma_\tau\delta^{i_1}_{(j_1}\dots\delta^{i_k}_{j_k)}. $$ With these conventions the total derivative of a local functional is $$ d_if\equiv\frac{df}{dx^i}=\frac{\partial f}{\partial x^i}+\sum_{k=0}^r\psi^\sigma_{i_1...i_ki}\frac{\partial f}{\partial\psi^\sigma_{i_1...i_k}}. $$
Multiindices.For latin indices, a multiindex$I$ of length $r$ is an ordered list of $r$ ordinary indices, eg. $I=(i_1\dots i_r)$. For the length we write $|I|=r$.
We only use multiindices for quantities that are symmetric in their indices, and the summation convention is not valid for them, i.e. we always indicated summations over multiindices. This is because multiindices can be summed in various ways. For example, the total derivative can be written as $$ d_i f=\frac{\partial f}{\partial x^i}+\sum_{|I|=0}^r\psi^\sigma_{Ii}\frac{\partial f}{\partial\psi^\sigma_I}. $$
2. The weak and strong inverse problems:
At its core the inverse problem is the following. If $L[\psi]$ is a Lagrangian of order $r$, then the Euler-Lagrange (EL) operator $$ E_\sigma(L)=\sum_{|I|=0}^r(-d)_I\frac{\partial L}{\partial\psi^\sigma_{I}},\quad (-d)_I =(-1)^{|I|}d_I,\quad d_I=d_{i_1}\dots d_{i_k}$$ maps it into a source expression of order $2r$.
So given a differential equation represented by setting a source expression to zero, i.e. $$ \varepsilon_\sigma[\psi]=0, $$ when does a Lagrangian $L$ exist such that $E_\sigma(L)=\varepsilon_\sigma$, and how to find one (or better yet, all) such Lagrangian(s). If a Lagrangian exists for $\varepsilon_\sigma$, then we say that it is variational.
Strictly speaking, this is the weak inverse problem. As indicated by Qmechanic's answer, the primary difficulty is not to solve the weak problem, but that the EL equations always have a specific algebraic form. It is easy to see that for example if $\varepsilon_\sigma$ is an EL expression and $f$ is a function (it does not even have to be a local functional), then $f\varepsilon_\sigma$ is no longer an EL expression. But if $f$ is nowhere zero then the solutions of $\varepsilon_\sigma[\psi]=0$ and $f\varepsilon_\sigma[\psi]=0$ clearly coincide.
So the strong inverse problem is about characterizing when is a source expression equivalent to one that is variational.
Analogy.The problem is quite similar to an analogous problem in ordinary calculus/differential geometry to which the Frobenius integrability theorem provides an adequate solution (unfortunately for the strong variational problem, we know of no "variational Frobenius theorem").
To consider an "ur-example", let $\omega$ be an $1$-form on a finite dimensional manifold and we are interested in finding out when is $\omega$ orthogonal to a stack of (hyper)surfaces (i.e. a foliation). We know that foliations by hypersurfaces can be locally described as the level sets of a smooth function with nonvanishing differential, so we can try to check for the condition $\omega=df$, which - by Poincaré's lemma - is locally equivalent to $d\omega=0$, and in fact via the usual de Rham homotopy operators, an appropriate $f$ can be constructed explicitly.
But this condition is too restrictive, $\omega$ is still orthogonal to the foliation if there is a function $g$ such that $\omega=gdf$, but $\omega$ is not necessarily exact in this case. Frobenius' theorem states that the complete local integrability conditions of this equation is $d\omega\wedge\omega=0$, i.e. $\omega$ no longer has to be closed, but only "closed modulo itself".
Variational multipliers.Accordingly, let $\varepsilon_\sigma[\psi]$ be a source expression, and $A^\sigma_{\ \tau}[\psi]$ an invertable matrix whose elements are also local functionals. This matrix is a variational multiplier for $\varepsilon$ if the source expression $$ \bar{\varepsilon}_\sigma[\psi]=A^\tau_{\ \sigma}[\psi]\varepsilon_\tau[\psi] $$ is variational.
The multiplier problem is a form of the strong inverse problem that concerns itself with the question of characterizing those source expressions that admit variational multipliers.
More general problems.Variational multipliers do not exhaust all possibilities for the strong inverse problem. For example in addition to the field variables $\psi^\sigma$, one may also introduce other variables $\lambda^\alpha$ such that the desired dynamics of the $\psi^\sigma$ arise as the dynamics of a subsystem of the system that consists of the total variables $\psi$ and $\lambda$ (and maybe the latter can be made variational). This may give an approximate equivalence to the original system, or it may happen that the $\lambda$ are Lagrange multipliers are are otherwise "pure gauge" variables and their own dynamics are unobservable or decouple from those of $\psi$.
There is also the example of the Maxwell equations where the original first order Maxwell equations for $F_{ij}$ are nonvariational, but one of the equations can be solved (at least locally, via Poincaré's lemma) for the potentials $A_i$, then reinserting the potentials into the other equation now provides a second order equation for the potentials that is variational.
Examples.Here we consider two examples for variational multipliers:
- The equation $\varepsilon[\psi]=m\psi^{\prime\prime}+k\psi^\prime+\frac{\partial U}{\partial\psi}$ ($m=n=1$) which when $x$ is interpreted as time and $\psi$ as the position (and the primes are $x$-derivatives) describes one dimensional motion of a particle affected by a potential $U=U(x,\psi)$ and also a dissipative force (air drag) proportional to the velocity. This equation is not variational, but if we multiply by $\exp(\frac{k}{m}x)$, it becomes variational with Lagrangian $$ L[\psi]=e^{\frac{k}{m}x}\left(\frac{1}{2}m\psi^{\prime 2}-U\right). $$
- The (vacuum) Einstein field equation $\varepsilon_{ij}[g]=G_{ij}[g]$ ($G_{ij}=R_{ij}-\frac{1}{2}Rg_{ij}$ is the Einstein tensor) is not variational. However if we take as the source expression the densitized Einstein tensor$\mathfrak G_{ij}=G_{ij}\sqrt{-\mathfrak g}$ (here $\mathfrak g$ is the metric determinant), then it becomes variational and a possible Lagrangian is the second order Einstein-Hilbert Lagrangian $$ L[g]=R\sqrt{-\mathfrak g}. $$
Solutions.The strong inverse problem does not have any complete solution currently. Some partial results exist which I am going to mention with links at the end of this answer.
3. Solution of the weak-local inverse problem:
In this section we detail the solution to the weak and local inverse problem. Therefore the problem is to determine when is a source expression $\varepsilon_\sigma[\psi]$ variational as is, and determine a Lagrangian. Locality here means that we are working on a contractible coordinate space (as mentioned in the intro) as opposed to a general manifold and therefore no topological obstructions can arise.
The solution will be "de Rham-type", i.e. we can define a formal cochain complex $$ \left\{\text{Currents}\right\}\xrightarrow{\mathrm{Div}}\left\{\text{Lagrangians}\right\}\xrightarrow{E}\left\{\text{Source expr.}\right\}\xrightarrow{H}\left\{\text{Lin. diff. ops.}\right\}, $$ where currents are local functionals $K^i[\psi]$ with $m$ components (functional "vector fields"), $\mathrm{Div}$ is taking the total divergence, i.e. $\mathrm{Div}(K)=d_i K^i$, $E$ is the Euler-Lagrange operator and $H$ is something called the Helmholtz operator which takes source expressions and maps them into the coefficients of certain formally anti-selfadjoint linear differential operators.
The crucial property is that this is indeed a cochain complex in that composing two subsequent arrows gives zero, i.e. $E\circ\mathrm{Div}=0$ and $H\circ E=0$. Such a sequence is exact if in a sense the reverse is also true, i.e. if $E(L)=0$ for a Lagrangian, then there is a current $K$ such that $L=\mathrm{Div}(K)$ and if $H(\varepsilon)=0$ for a source expression, then there is a Lagrangian $L$ such that $\varepsilon=E(L)$.
Exactness is most easily proven in terms of homotopy operators, i.e. we need to find three linear operators $$ \mathbb Q:\left\{\text{Lin. diff. ops.}\right\}\rightarrow \left\{\text{Source expr.}\right\}, \\ \mathbb{L}:\left\{\text{Source expr.}\right\}\rightarrow \left\{\text{Lagrangians}\right\}, \\ \mathbb H: \left\{\text{Lagrangians}\right\}\rightarrow \left\{\text{Currents}\right\}, $$ which satisfy $$ L=\mathbb L(E(L))+\mathrm{Div}(\mathbb H(L)),\qquad (\ast) \\ \varepsilon=\mathbb Q(H(\varepsilon))+E(\mathbb L(\varepsilon)),\qquad \quad(\ast\ast) $$for all Lagrangians $L$ and source expressions $\varepsilon$. In this answer I will refer to $(\ast)$ as the first homotopy formula and $(\ast\ast)$ is the second homotopy formula. The homotopy operator $\mathbb L$ is often called the Vainberg-Tonti operator and its value $\mathbb L(\varepsilon)$ on a source expression as the Vainberg-Tonti Lagrangian associated to the source expression $\varepsilon$. The operators $\mathbb Q$ and $\mathbb H$ do not have any standard names, however I am tempted to call $\mathbb H$ the Horndeski operator, since iirc it was first derived by Horndeski in [1].
It is clear that the desired exactness result follows from the homotopy formulae ($\ast$) and ($\ast\ast$) since if $L$ has vanishing EL equations then ($\ast$) gives $$ L=\mathrm{Div}(\mathbb H(L)), $$ i.e. $L$ is the total divergence of $\mathbb H(L)$, meanwhile if $\varepsilon$ has vanishing Helmholtz expressions, then ($\ast\ast$) gives $$ \varepsilon=E(\mathbb L(\varepsilon)), $$i.e. $\mathbb L(\varepsilon)$ is a Lagrangian for $\varepsilon$.
Higher order product formulae and Euler operators.Before proceeding we need some combinatorial tools to be able to deal with the high number of derivatives that appear in a variatation problem of arbitrary orders.
If $f,g^I=g^{i_1...i_r}$ are (smooth) functions on $X$ (don't need to be functionals) with $g^I$ symmetric in its indices, we have the higher product formula$$ \sum_{|I|=r}\partial_I(fg^I)=\sum_{|I|+|J|=r}C^{|I|+|J|}_{|I|}\partial_If\partial_J g^{IJ}, $$where $$ C^{r}_{s}:=\left(\begin{matrix}r \\ s\end{matrix}\right) $$ is short notation for the binomial coefficient.
We also have the higher integration by parts formula$$ \sum_{|I|=r}\partial_If g^I=\sum_{|I|+|J|=r}C^{|I|+|J|}_{|I|}\partial_I\left(f(-\partial)_J g^{IJ}\right). $$These are not difficult to prove via induction on the order $r$ of derivatives.
Let now $L=L[\psi]$ be a Lagrangian of order $r$ and we calculate its variation that gives $$ \delta L[\psi,\delta\psi]=\sum_{|I|=0}^r\frac{\partial L}{\partial\psi^\sigma_I}\delta\psi^\sigma_I=\sum_{|I|+|J|=0}^r C^{|I|+|J|}_{|I|}d_I\left(\delta\psi^\sigma(-d)_J\frac{\partial L}{\partial\psi^\sigma_{IJ}}\right), $$ where the higher order integration by parts formula have been used. We now change the summation such that first $|J|$ goes from $0$ to $r-|I|$, then $|I|$ goes from $0$ to $r$ (these are equivalent) to get $$ \delta L[\psi,\delta\psi]=\sum_{|I|=0}^r d_I\left(\delta\psi^\sigma\sum_{|J|=0}^{r-|I|}C^{|I|+|J|}_{|I|}(-d)_J\frac{\partial L}{\partial\psi^\sigma_{IJ}}\right) \\ =\sum_{|I|=0}^r d_I(E^I_\sigma(L)\delta\psi^\sigma), $$ where $$ E^I_\sigma(L)=\sum_{|J|=0}^{r-|I|}C^{|I|+|J|}_{|I|}(-d)_J\frac{\partial L}{\partial \psi^\sigma_{IJ}},\quad 0\le|I|\le r $$are the so-called higher Euler operators (also called Lie-Euler operators by Anderson in [2]).
By applying the product formula to the defining expression we also get the inverse relation $$ \frac{\partial L}{\partial\psi^\sigma_I}=\sum_{|J|=0}^\infty C^{|I|+|J|}_{|I|}d_JE^{IJ}_\sigma(L), $$where the sum is finite, I just did not bother to calculate which is the last nonzero term.
For $|I|=0$ clearly $E_\sigma$ is just the ordinary Euler-Lagrange operator, and by splitting the sums we also have the first variation formula$$ \delta L[\psi,\delta\psi]=E_\sigma(L)[\psi]\delta\psi^\sigma+d_i\sum_{|I|=0}^{r-1}d_I\left(E^{iI}_\sigma(L)[\psi]\delta\psi^\sigma\right), $$ where we also write $$ \Theta^i(L)[\psi,\delta\psi]=\sum_{|I|=0}^{r-1}d_I\left(E^{iI}_\sigma(L)[\psi]\delta\psi^\sigma\right). $$
The first homotopy formula.A relation we need here is that for any local functional $f[\psi]$ we have $$ (d_if)[s\psi]=d_i(f[s\psi]) $$ for a real parameter $s$, i.e. we can first take the total derivative, then evaluate on $s\psi$ or first evaluate on $s\psi$ and then take the total derivative and both will give the same results. This is easy to prove by writing out the total derivative explicitly.
We then calculate $dL[s\psi]/ds$, where $L$ is a Lagrangian of order $r$ to get $$ \frac{d}{ds}L[s\psi]=\sum_{|I|=0}^r\frac{\partial L}{\partial\psi^\sigma_I}[s\psi]\psi^\sigma_I=E_\sigma(L)[s\psi]\psi^\sigma+d_i\sum_{|I|=0}^{r-1}d_I\left(E^{iI}_\sigma(L)[s\psi]\psi^\sigma\right), $$where we have basically followed the same steps as the proof of the first variation formula.
We now integrate this from $0$ to $1$ with respect to $s$, giving $$ L[\psi]-L[0]=\int_0^1E_\sigma(L)[s\psi]\psi^\sigma ds+d_i\int_0^1\sum_{|I|=0}^{r-1}d_I\left(E^{iI}_\sigma(L)[s\psi]\psi^\sigma\right)ds. $$
Here we can use the fact that $L[0]$ is now no longer a local functional, just an ordinary function of the coordinates $x^i$, so the usual Poincaré lemma applies, and because the domain $X$ is contractible to zero, we can express $L[0]$ as a divergence: $$ L[0](x)=\partial_i\int_0^1 s^{m-1}L[0](sx)x^i ds, $$and here we can replace the partial derivatives with total derivatives since $L[0]$ is constant as a functional, which when inserted into the previous formula gives $$ L[\psi]=\int_0^1E_\sigma(L)[s\psi]\psi^\sigma ds+d_i\int_0^1\left(\sum_{|I|=0}^{r-1}d_I\left(E^{iI}_\sigma(L)[s\psi]\psi^\sigma\right)+s^{m-1}L[0](sx)x^i\right)ds. $$
This is the desired homotopy formula ($\ast$) and we can read off the homotopy operators to be $$ \mathbb L(\varepsilon)[\psi]=\int_0^1\varepsilon_\sigma[s\psi]\psi^\sigma ds $$ and $$ \mathbb H^i(L)[\psi]=\int_0^1\left(\sum_{|I|=0}^{r-1}d_I\left(E^{iI}_\sigma(L)[s\psi]\psi^\sigma\right)+s^{m-1}L[0](sx)x^i\right)ds. $$The second homotopy formula.This is a good place to define the Helmholtz operator $H$ acting on a source expression $\varepsilon=(\varepsilon_\sigma)$ of order $r$ by $$ H^I_{\sigma\tau}(\varepsilon)=\frac{\partial\varepsilon_\sigma}{\partial\psi^\tau_I}-(-1)^{|I|}E_\sigma^I(\varepsilon_\tau),\quad 0\le |I|\le r. $$ When the source expression is order $2$ as it is quite common, the nonzero Helmholtz expressions are $$ H_{\sigma\tau}(\varepsilon)=\frac{\partial\varepsilon_\sigma}{\partial\psi^\tau}-\frac{\partial\varepsilon_\tau}{\partial\psi^\sigma}+d_i\frac{\partial\varepsilon_\tau}{\partial\psi^\sigma_i}-d_id_j\frac{\partial\varepsilon_\tau}{\partial\psi^\sigma_{ij}} \\ H^i_{\sigma\tau}(\varepsilon)=\frac{\partial\varepsilon_\sigma}{\partial\psi^\tau_i}+\frac{\partial\varepsilon_\tau}{\partial\psi^\sigma_i}-2d_j\frac{\partial\varepsilon_\tau}{\partial\psi^\sigma_{ij}} \\ H^{ij}_{\sigma\tau}(\varepsilon)=\frac{\partial\varepsilon_\sigma}{\partial\psi^\tau_{ij}}-\frac{\partial\varepsilon_\tau}{\partial\psi^\sigma_{ij}}. $$
Now we take an arbitrary source form $\varepsilon_\sigma[\psi]$ of say order $r$ and compare $\varepsilon$ to $E(\mathbb L(\varepsilon))$. We first calculate $$ \frac{d}{ds}\left(s\varepsilon_\sigma[s\psi]\right)=\varepsilon_\sigma[s\psi]+\sum_{|I|=0}^rs\frac{\partial\varepsilon_\sigma}{\partial\psi^\tau_I}[s\psi]\psi^\tau_I, $$and integrate this from $0$ to $1$ to get $$ \varepsilon_\sigma[\psi]= \int_0^1\varepsilon_\sigma[s\psi] ds+\int_0^1\sum_{|I|=0}^rs\frac{\partial \varepsilon_\sigma}{\partial\psi^\tau_I}[s\psi]\psi^\tau_I . $$
We then calculate $$ E_\sigma(\mathbb L(\varepsilon))[\psi]=\sum_{|I|=0}^r(-d)_I\frac{\partial}{\partial\psi^\sigma_I}\int_0^1\varepsilon_\tau[s\psi]\psi^\tau ds \\=\sum_{|I|=0}^r(-d)_I\int_0^1s\frac{\partial\varepsilon_\tau}{\partial\psi^\sigma_I}[s\psi]\psi^\tau ds+\int_0^1\varepsilon_\sigma[s\psi]ds, $$then use the higher order product formula and the definition of the Euler operators on the first term to get $$ E_\sigma(\mathbb L(\varepsilon))[\psi]=\int_0^1\sum_{|I|=0}^r(-1)^{|I|}s\psi^\tau_IE^I_\sigma(\varepsilon_\tau)[s\psi]ds+\int_0^1\varepsilon_\sigma[s\psi]ds. $$ Substraction now gives $$ \varepsilon_\sigma[\psi]-E_\sigma(\mathbb L(\varepsilon))[\psi]=\int_0^1s\sum_{|I|=0}^r\left(\frac{\partial\varepsilon_\sigma}{\partial\psi^\tau_I}[s\psi]-(-1)^{|I|}E_\sigma^I(\varepsilon_\tau)[s\psi]\right)\psi^\tau_Ids \\ =\int_0^1 s\sum_{|I|=0}^r H^I_{\sigma\tau}(\varepsilon)[s\psi]\psi^\tau_I ds, $$ which proves the second homotopy formula ($\ast\ast$) with $$ \mathbb Q_\sigma(A)[\psi]=\int_0^1 \sum_{|I|=0}^rA^I_{\sigma\tau}[s\psi]s\psi^\tau_I ds. $$
To complete the proofs of all the relations introduced before, we still need to show that $H(E(L))=0$, i.e. the Helmholtz operator vanishes on EL expressions.
This is most easily proven by defining $\mu=dx^1\wedge\dots dx^m$ and the action functional $$ S_\Omega[\psi]=\int_\Omega L[\psi]\mu $$ associated with the Lagrangian $L$, where $\Omega$ is a regular domain (compact, is the closure of an open set, its boundary is piecewise smooth etc., i.e. Stokes' theorem applies to it), then we consider a smooth two-parameter family $\psi_{t,s}^\sigma(x)$ of fields such that $\psi_{0,0}=\psi$. Let $\delta_1:=\frac{\partial}{\partial s}|_{s=t=0}$ and $\delta_2:=\frac{\partial}{\partial t}|_t=0$. Then by the commutativity of partial derivatives we have $$ 0=\left.\frac{\partial S_\Omega[\psi_{t,s}]}{\partial s\partial t}\right|_{t=s=0}-\left.\frac{\partial S_\Omega[\psi_{t,s}]}{\partial t\partial s}\right|_{t=s=0}=\int_\Omega\sum_{|I|=0}^{2r}\left(\frac{\partial E_\sigma(L)}{\partial\psi^\tau_I}\delta_1\psi^\tau_I\delta_2\psi^\sigma-\frac{\partial E_\tau(L)}{\partial\psi^\sigma_I}\delta_1\psi^\tau\delta_2\psi^\sigma_I\right)\mu+\int_\Omega\mathrm{Div}(\cdots)\mu. $$ We integrate by parts on the second term to get $$ 0=\int_\Omega\sum_{|I|=0}^{2r}\left(\frac{\partial E_\sigma(L)}{\partial\psi^\tau_I}-(-1)^{|I|}E^I_\sigma(E_\tau(L))\right)\delta_1\psi^\tau_I\delta_2\psi^\sigma\mu+\int_\Omega\mathrm{Div}(\cdots)\mu \\ =\int_\Omega\sum_{|I|=0}^{2r}H^I_{\sigma\tau}(E(L))\delta_1\psi^\tau_I\delta_2\psi^\sigma\mu+\int_\Omega\mathrm{Div}(\cdots)\mu. $$ Since this is true for arbitrary variations $\delta_1\psi$ and $\delta_2\psi$, we set $\delta_2\psi$ to be a bump function with narrow support within $\Omega$. Then the divergence term vanishes (it is a boundary term), and by the usual Lagrange's lemma argument, the coefficients of $\delta_2\psi$ must vanish as well. We get $$ 0=\sum_{|I|=0}^{2r}H^I_{\sigma\tau}(E(L))\delta_1\psi^\tau_I. $$ It follows that all Helmholtz expressions $H^I_{\sigma\tau}(E(L))$ must vanish separately, because we can eg. set $\delta_1\psi$ to be an arbitrary constant, which forces $H_{\sigma\tau}(E(L))$ to vanish, when we can set $\delta_1\psi$ such that its first derivatives are arbitrary, which forces $H^i_{\sigma\tau}(E(L))$ to vanish, then we can set $\delta_1\psi$ to have arbitrary second derivatives (symmetric in the indices, but so is $H$), which foreces $H^{ij}_{\sigma\tau}(E(L))$ to vanish, etc. We thus have $$ H^I_{\sigma\tau}(E(L))=0\quad 0\le |I|\le 2r $$ for all Lagrangians $L$ of order $r$ as we have asserted.
This concludes the treatment of the local weak inverse problem.
Finally we remark that the Vainberg-Tonti operator $\mathbb L$ and the Horndeski operator $\mathbb H$ are not "efficient" in the sense that they usually produce objects of higher order than necessary. The EL operator will turn a Lagrangian of order $r$ into a source expression of order $2r$, but the Vainberg-Tonti Lagrangian of an order $2r$ source expression is order $2r$ as well. Likewise, a current of order $r-1$ differentiates into a Lagrangian of order $r$, but the Horndeski current of an order $r$ Lagrangian is order $2r-1$.
Some order reduction results can be found in [2].
4. Global considerations:
If the global structure of these operators and the global validity (or lack of thereof) of the homotopy formulae ($\ast$) and ($\ast\ast$) are to be investigated, one needs a proper differential geometric formulation of the calculus of variations.
In this case $X$ is an $m$ dimensional manifold and we consider a fibered manifold $\pi:Y\rightarrow X$ over $X$ with $n$ dimensional fibres. The field functions that appear in the variational problem are interpreted as sections of $\pi$.
One can then construct the infinite jet prolongation $J^\infty Y$ of this fibered manifold and this is the place where the "local functionals" live. The relevant objects are actually differential forms on this space. We have a bigraded differential double complex $ (\mathcal O^{\bullet,\bullet}(Y),d_H,\delta) $ of differential forms on $J^\infty Y$ where $\mathcal O^{k,l}(Y)$ is the set of differential forms with $k$ horizontal and $l$ contact degrees. The horizontal differential $$ d_H:\mathcal O^{k,l}(Y)\rightarrow\mathcal O^{k+1,l}(Y) $$ is what corresponds to taking total divergences and the vertical differential $$ \delta:\mathcal O^{k,l}(Y)\rightarrow\mathcal O^{k,l+1}(Y) $$ corresponds to taking variations. The horizontal degrees are capped at $m$ while the vertical degrees can increase indefinitely.
One can define operators $I:\mathcal O^{m,l}(Y)\rightarrow\mathcal O^{m,l}(Y)$ for $l\ge 1$ which has the property that the spaces $\mathcal F^l(Y):=I(\mathcal O^{m,l}(Y))$ appear in the direct sum decomposition $$ \mathcal O^{m,l}(Y)=\mathcal F^l(Y)\oplus d_H\mathcal O^{m-1,l}(Y). $$ Then the above differential double complex augmented with the spaces $\mathcal F^l(Y)$ is called the variational bicomplex associated with the fibered manifold $\pi:Y\rightarrow X$. Specifically of the most significant interest is the sequence$$ 0\xrightarrow{}\mathbb R\xrightarrow{}\mathcal O^{0,0}\xrightarrow{d_H}\mathcal O^{1,0}\xrightarrow{}\cdots\xrightarrow{d_H}\mathcal O^{m-1,0}\xrightarrow{d_H}\mathcal O^{m,0} \\ \mathcal O^{m,0}\xrightarrow{\delta_\ast}\mathcal F^1\xrightarrow{\delta_\ast}\mathcal F^2\xrightarrow{\delta_\ast}\cdots, $$ where $\delta_\ast=I\circ\delta$ is the induced differential. This sequence is called the variational sequence or Euler-Lagrange sequence.
The term $\mathcal O^{m-1,0}(Y)$ can be interpreted as the space of currents, $\mathcal O^{m,0}(Y)$ as the space of Lagrangians, $\mathcal F^1(Y)$ as the space of source expressions and $\mathcal F^2(Y)$ as the space of the appropriate linear differential operators the Helmholtz operator maps into. The differentials $\delta_\ast$ reproduce the EL operator when applied to $\mathcal O^{m,0}$ and the Helmholtz operator when applied to $\mathcal F^1(Y)$.
Via methods of homological algebra and sheaf theory it is possible to calculate the cohomology of the variational complex. It turns out that $$H(\mathcal O^{k,0}(Y))\cong H^k_{\mathrm{dR}}(Y)$$ and $$ H(\mathcal F^k(Y))\cong H^{m+k}_{\mathrm{dR}}(Y), $$i.e. the cohomology of the variational complex is isomorphic to the de Rham cohomology of $Y$, which allows one to learn the global obstructions to exactness by calculating the cohomology of $Y$.
5. Remarks on the partial solutions to the strong inverse problem:
[Work in progress]
References:
- [1] G.W. Horndeski: Sufficiency conditions under which a Lagrangian is an ordinary divergence. (1975)
- [2] I. M. Anderson: The Variational Bicomplex (unfinished and unpublished book/technical report; can be found on the internet easily; still the "canonical" work on the subject)
- D. Krupka: Introduction to Global Variational Geometry
The original papers are
- E. Tonti: Variational formulations of nonlinear differential equations (1969)
- M. M. Vainberg: Variational methods for the study of nonlinear operators (1964)
- F. Takens: A global version of the inverse problem of the calculus of variations (1979)
- A. Vinogradov: A spectral sequence that is connected with a nonlinear differential equation, and the algebraic-geometry foundations of the Lagrange field theory with constraints (1978)
- W. M. Tulczyjew: The Euler-Lagrange resolution (1980)
- I. M. Anderson, T. Duchamp: On the existence of global variational principles (1980)