Consider the second order operator


$Lu=\partial\_i(a\_{ij}\partial\_j)u+b\_i\partial\_iu+cu$.


Can we find a functional $I[u]$ such that $Lu$ is the variation of $I[u]$ with respect to $u$? I have successfully dealt with the first and third term, but found difficulties with the second term. Is it even possible to do so?



Variational formulation of second order equations of the divergence form
Actually, Math604 is closer to the right answer. To see the correct condition, you need to pay attention to the placement of your indices. Your operator should be written in the form
$$
Lu = \partial\_i(a^{ij}\partial\_ju) + b^k\partial\_ku + c u = 0,
$$
where one sums over repeated indices *in opposition* (i.e., `one up, one down'). Also, you didn't say this, but, usually, when one writes the operator this way, one assumes that the coefficients $a^{ij}$, $b^k$ and $c$ are functions of the independent variables (say, $x^i$), *and* that the matrix $A = (a^{ij})$ is both symmetric and invertible. If you didn't intend for us to make these assumptions, you should say so, and we can work out the more general case.


Under these conditions, there are unique functions $f\_j$ satisfying the equations
$$
a^{ij}f\_j = b^i.
$$


Then the condition you want is simply that the $1$-form $\phi = f\_i\,\mathrm{d} x^i$ should be *exact*, i.e., that there should exist a function $f$ on your $x$-domain such that $\partial\_i f = f\_i$ for all $i$. Then, the Lagrangian you want is
$$
I[u] = \frac12\int\_D e^{f(x)}\bigl(-a^{ij}(x)\,(\partial\_iu)(\partial\_ju) 
+ c(x)\, u^2\bigr)\,\mathrm{d} x
$$
If the $1$-form $\phi$ is not exact, the equation $Lu=0$ is not the Euler-Lagrange equation of any first-order functional.


