Application of Green's identities to boundary value problem Suppose $u = 0 $ on $\partial \Omega$, where $\Omega$ is a bounded domain in $\mathbb R^n$ with smooth boundary. Then, $$\int_{\Omega} (\nabla u) udx = \int_{\partial \Omega} nu^2ds - \int_{\Omega} (\nabla u) udx$$
Where does the $nu^2$ come from? I know $nu^2 = nu \times u$, so more specifically, where does $nu$ come from?
 A: By the chain rule we have
$\nabla (u^2) = \nabla (u u) = (\nabla u) u + u (\nabla u),$
which gives
$$(\nabla u) u = \nabla (u^2) - u (\nabla u)$$
Integrating over $\Omega$ therefore gives
$$\int_\Omega (\nabla u) u \, dx = \int_\Omega \nabla (u^2) \, dx - \int_\Omega u (\nabla u) \, dx$$
Here the first integral on the right hand side can be rewritten using Gauss theorem. To do so we first note that if $\mathbf a$ is a constant vector then
$$\nabla\cdot(u^2 a) = \nabla(u^2)\cdot\mathbf a$$
Therefore
$$
\int_\Omega \nabla (u^2) \, dx \cdot \mathbf a 
= \int_\Omega \nabla \cdot (u^2 \mathbf a) \, dx
= \int_{\partial\Omega} (u^2 \mathbf a) \cdot n \, ds
= \int_{\partial\Omega} u^2 n \, ds  \cdot \mathbf a
$$
where $n$ is the unit normal to $\partial\Omega$ and $ds$ is the induced measure on $\partial\Omega$.
Since $\mathbf a$ is arbitrary, we have
$$
\int_\Omega \nabla (u^2) \, dx
= \int_{\partial\Omega} u^2 n \, ds
$$
Thus,
$$\int_\Omega (\nabla u) u \, dx = \int_{\partial\Omega} u^2 n \, ds - \int_\Omega u (\nabla u) \, dx$$
