TITLE: Variational formulation of second order equations of the divergence form
QUESTION [5 upvotes]: 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?

REPLY [7 votes]: 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.