TITLE: Why is negative divergence an adjoint of gradient?
QUESTION [6 upvotes]: In my notes, I have $\langle F, \nabla f\rangle_{L^2(\mathcal{TX})} = \langle 
 \nabla^* F, f\rangle_{L^2(\mathcal{X})} = \langle -\operatorname{div} F, f\rangle_{L^2(\mathcal{X})}$, where $f$ is a scalar field, $F$ is a vector field, $\mathcal X$ is a manifold and $T\mathcal X$ is a tangent plane. My question is why is negative divergence an adjoint of gradient?

REPLY [3 votes]: In general, for a function $f$ and a vector field $F$, we have the following easily verified formula, see for example this wikipedia page:
$$\nabla \cdot (fF) = \langle \nabla f, F \rangle + f \,\nabla \cdot F; \tag 1$$
then if $\Omega \subset \mathcal X$ is an open set of finite measure with a sufficiently nice boundary $\partial \Omega$,
$$ \int_\Omega \nabla \cdot (fF) \, dV = \int_\Omega (\langle \nabla f, F \rangle + f \, \nabla \cdot F) \, dV = \int_\Omega \langle \nabla f, F \rangle \, dV + \int_\Omega f \, \nabla \cdot F \, dV; \tag 2$$
by the divergence theorem,
$$ \int_\Omega \nabla \cdot (fF) \, dV = \int_{\partial \Omega} (fF)\cdot \vec n \, dS, \tag 3$$
where $\vec n$ is an outward pointing unit vector field on $\partial \Omega$; using (3) in (2) yields
$$ \int_{\partial \Omega} (fF)\cdot \vec n \, dS = \int_\Omega \langle \nabla f, F \rangle \, dV + \int_\Omega f \, \nabla \cdot F \, dV; \tag 4$$
if we now make an additional assumption such as $\Omega$ is without boundary, i.e. $\partial \Omega = \emptyset$ or that $f$ or $F$ vanish on $\partial \Omega$, we have
$$ \int_{\partial \Omega} (fF)\cdot \vec n \, dS = 0, \tag 5$$
and then (4) immediately becomes
$$ \int_\Omega \langle \nabla f, F \rangle \, dV = -\int_\Omega f \, \nabla \cdot F \, dV = \int_\Omega (-\nabla \cdot F) f \, dV. \tag 6$$
Note: Though the above argument uses a slightly different notation than that of our OP Aha, it establishes the desired result with the caveat that some assumptions on the behavior of $f$ and $F$ on $\partial \Omega$ must be made.  In fact, $\nabla$ and $\nabla \cdot$ require such an assumption if they are to be adjoints of one another, as indicated by (4).  We are essentially performing integration by parts on $\bar \Omega = \Omega \cup \partial \Omega \subset \mathcal X$.  End of Note.