Divergence Theorem, Laplacian, Energy Minimization 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)
 A: The identity
$$ \int_V d\vec x\, \langle \nabla \phi, \nabla u \rangle = -\int_V d\vec x\  \phi\Delta u $$
is a consequence of integration by parts and the divergence theorem. Namely, we have
$$ \langle \nabla \phi, \nabla u \rangle = \sum_i \partial_i\phi\,\partial_i u = \sum_i \left(\partial_i (\phi\,\partial_i u) - \phi\,\partial_i^2 u\right) = \nabla\cdot(\phi\nabla u) - \phi\Delta u$$
Hence, integrating over the volume gives
$$ \int_V d\vec x\,\langle \nabla \phi, \nabla u \rangle = \int_V d\vec x\,(\nabla\cdot(\phi\nabla u) - \phi\Delta u) = \int_{\partial V} d\vec n\cdot \phi\nabla u - \int_V d\vec x\ \phi\Delta u .$$
Since the variation $\phi$ is assumed to vanish on the boundary $\partial V$, the surface integral vanishes.

This trick of "shifting the derivatives of $\phi$ to $u$" is extremely common in the calculus of variations. I suggest that you absorb it by doing several exercises. For instance, I recommend to derive the Euler-Lagrange equations for a general functional
$$ S[u] := \int_V d\vec x\ \mathcal L(u,\partial_i u) .$$
A: This is more often called Green's identity but is indeed a consequence of the divergence theorem as you know it.
To get an intuition of why this is true, one can go back to dimension $1$. Integration by parts gives
$$
\int \phi' u'=[\phi u']-\int\phi u'',
$$
and you recognize the LHS and the last term on the RHS. And the first term $[\phi u']$ on the RHS is zero because the functional $E:u\mapsto E(u)$ is defined on functions $u$ with a prescribed value on the boundary, and the tangent space of these is made of functions $\phi$ which are zero on the boundary. In other (simpler) words, for any $t\ne0$, both functions $u$ and $u+t\phi$ coincide with a prescribed function on the boundary if and only if $\phi=0$ on the boundary.
