<aside> ✒️
Divergence Theorem.
Given $\bf{F}$ any vector function, $D$ a bounded solid region, and $\bf{n}$ the unit outer normal on $\partial D$ (the bounding surface) then
$$ \int_D \text{div}\ \mathbf{F}\ d\mathbf{x} = \int_{\partial D}\mathbf{F}\cdot \mathbf{n}\ dS. $$
Here $dS$ indicates the usual surface integral and $\text{div}\ \mathbf{F} = \nabla\cdot \mathbf{F} = \sum \nabla_i\mathbf{F}_i$
</aside>
<aside> 📺
Video explanation here.
</aside>
Let $u,\ v\in \mathcal{C}^2(\overline{D})$.
$$ \tag{G1}\int_D \Delta u\ dx=\int_{\partial D} \frac{\partial u}{\partial n}\ dS. $$
From the producto rule
$$ \nabla\cdot (v\nabla u) = \nabla v\cdot \nabla u + v\Delta u. $$
Now we integrate and use the divergence theorem on the left side:
$$ \tag{G2}\int_{\partial D} v\frac{\partial u}{\partial n}\ dS = \int_D\nabla v\cdot \nabla u\ d\mathbf{x} + \int_Dv\Delta u\ d\mathbf{x}. $$
Where $\partial u/\partial n = \mathbf{n} \cdot \nabla u$ is the directional derivative in the outward normal direction.
<aside> 💡
$u,\ v$ can be any function, sometimes it might be useful to take $v=1$.
</aside>
The middle term of (G2) does not change if $u$ and $v$ are switched. So if we write (G2) for the pair $u$ and $v$, and again for $v$ and $u$, and then subtract, we get the second Green identity:
$$ \tag{G3}\int_D (u\Delta v - v\Delta u)\ d\mathbf{x} = \int_{\partial D} \left(u\frac{\partial v}{\partial n}-v\frac{\partial u}{\partial n}\right)\ dS. $$
<aside> ✒️
Integration by parts formula.
Let $u, v\in \mathcal{C}^1(\overline{D})$. Then
$$ \int_D u_{x_i}v\ dx = -\int_D uv_{x_i}\ dx + \int_{\partial D}uvn^i\ dS\quad (i=1,\ldots, r). $$
Where $n^i$ correspond to the $i$ component of the outer normal on $\partial D$: $\mathbf{n}$.
</aside>
The formula can be shown in a different way:
<aside> ✒️
Integration by parts formula.
Let $u,\ v\in \mathcal{C}^1(\overline{D})$. Is well know that $v\nabla u = -(\nabla v)u + \nabla (vu)$. After integrating and applying the divergence theorem, we obtain
$$ \int_D v\nabla u\ dx = \int_D -(\nabla v)u\ dx+ \int_{\partial D} vu\mathbf{n}\ dS. $$
</aside>