I am trying to understand the proof of the following lemma:
Lemma. Let $g: \mathbb{R} \rightarrow \mathbb{R}$ be continuous with primitive $G(u)=\int_{0}^{u} g(v) d v$ and let $u \in C^{2}(\Omega) \cap C^{1}(\bar{\Omega})$ be a solution of the equation
$$ -\Delta u=g(u) \quad \text { in } \Omega,\quad \ (1.5) $$ $$ u=0 \quad \text { on } \partial \Omega,\quad \quad (1.6) $$ in a domain $\Omega \subset \subset \mathbb{R}^{n} .$ Then there holds $$ \frac{n-2}{2} \int_{\Omega}|\nabla u|^{2} d x-n \int_{\Omega} G(u) d x+\frac{1}{2} \int_{\partial \Omega}\left|\frac{\partial u}{\partial \nu}\right|^{2} x \cdot \nu d S=0 $$ where $\nu$ denotes the exterior unit normal.
Proof Attempt: The author proceeds by multiplying $x\cdot \nabla u$ to the equation (1.5) to get, \begin{aligned} 0=(\Delta u&+g(u))(x \cdot \nabla u) \\ &=\operatorname{div}(\nabla u(x \cdot \nabla u))-|\nabla u|^{2}-x \cdot \nabla\left(\frac{|\nabla u|^{2}}{2}\right)+x \cdot \nabla G(u) \\ &=\operatorname{div}\left(\nabla u(x \cdot \nabla u)-x \frac{|\nabla u|^{2}}{2}+x G(u)\right)+\frac{n-2}{2}|\nabla u|^{2}-n G(u) \end{aligned} Now here is the part that I don't understand. The author says that since $u=0$ on the boundary $\partial \Omega$ we have, $$x\cdot \nabla u = (x\cdot \nu) \frac{\partial u}{\partial \nu}.$$ I don't know understand why we can make this assumption. Furthermore if we assume that this is true then why does, \begin{align} \frac{1}{2}\int_{\partial \Omega} \left|\frac{\partial u}{\partial \nu}\right|^2 x\cdot \nu dS = \int_{\Omega} \operatorname{div}\left(\nabla u(x \cdot \nabla u)-x \frac{|\nabla u|^{2}}{2}+x G(u)\right)dx. \end{align} I am guessing this is an application of the divergence theorem and that $G(u)=0$ since $u=0$ on $\partial \Omega.$ But I don't understand how the other two terms are maniupulated to the get the expression. Any comments/suggestions are much appreciated.
At a point $p\in\partial\Omega$, we can choose an orthonormal basis with the unit vector $\nu$ normal to $\partial\Omega$ as one of the basis vectors. All the other basis vectors $\omega_i$ point along $\partial\Omega$. But $u$ is constant on $\partial\Omega$, so $\frac {\partial u}{\partial \omega_i} = 0$. Now as with any orthonormal basis, $$\nabla u = \dfrac {\partial u}{\partial \nu}\nu + \sum_{i=1}^{n-1} \dfrac{\partial u}{\partial \omega_i}\omega_i = \dfrac {\partial u}{\partial \nu}\nu$$
And after applying the divergence theorem, you will find from using this same representation of $\nabla u$, that the first two terms have the same value on the boundary, except for the $-\frac 12$ coefficient.