I am trying to understand a proof for critical points of certain energy functions being harmonic functions. It goes as follows: For a function $u(x_1,..,x_n)$, a functional E(u) is defined as
$E(u) = \frac{1}{2}\int |\nabla u|^2 $
For the proof, a curve is constructed in the space of functions by using $u+t\phi$. Restricting the energy functional to this curve gives:
$E(u+t\phi) = \frac{1}{2} \int | \nabla (u+t\phi)|^2 = \frac{1}{2} \int |\nabla u|^2 + t \int \langle u,\nabla \phi \rangle + \frac{t^2}{2} \int |\nabla \phi|^2 $
Then differentiating at $t=0$
$\frac{d}{dt_{t=0}}E(u+t\phi) = \int \langle\nabla u, \nabla \phi\rangle = - \int \phi \triangle u$
The proof then states that the last equality is due to divergence theorem which I know is
$\int \int_S F \cdot n d\sigma = \int \int \int \nabla \cdot F dV$
I do not understand the connection between divergence theorem and how it is used in this proof. Any help?
Link:
http://arxiv.org/pdf/1102.1411 (page 2)