Do we have $\int_{\partial M}f\langle X,N\rangle_g dV_\tilde{g}=0$ if both $f$ and $X$ are compactly supported? In Euclidean spaces, if a partial integration involves a function with compact support, then we won't have to include the boundary integral because it contributes nothing. More precisely, if $U\subseteq\mathbb{R}^n,u\in C^1(U),\phi\in C_c^\infty(U)$, then for $i=1,\ldots,n$,
$$\int_U u\phi_{x_i}dx=-\int_U \phi u_{x_i}dx.\tag{1}$$
Motivated by this fact, I'm considering a similar question with Euclidean spaces replaced by Riemannian manifolds. Let $(M,g)$ be an oriented Riemannian manifold with boundary. For any compactly supported smooth vector field $X$ on $M$, the divergence theorem states that
$$\int_M\mathrm{div}X dV_g=\int_{\partial M}\langle X,N\rangle_g dV_\tilde{g},\tag{2}$$
where $N$ is the outward-pointing unit normal vector field along $\partial M$ and $\tilde{g}$ is the induced Riemannian metric on $\partial M$. I know a manifold boundary is not necessarily a topological boundary, and maybe that's why the integration on the RHS of (2) is not trivial even though $X$ has compact support. Now, if a $\color{red}{\text{compactly supported}}$ smooth function $f$ on $M$ comes in, I'd like to know whether or not
$$\int_{\partial M}f\langle X,N\rangle_g dV_\tilde{g}=0.\tag{3}$$
Yeah, I was thinking about an affirmative answer but didn't know how to prove it. Does anyone have an idea? Thank you.
Added:
I was told in Geometric Relativity that the gradient operator $\mathrm{grad}$ and $-\mathrm{div}$ are the formal adjoints of each other, so I'm planning on showing that
$$\int_M\langle\mathrm{grad}f,X\rangle_g dV_g=\int_M f(-\mathrm{div}X) dV_g\tag{4}$$
for all compactly supported $f$ and $X$. And the book just mentioned told me to make use of the divergence theorem and the product rule
$$\mathrm{div}(fX)=\langle\mathrm{grad}f,X\rangle+f\mathrm{div}X.\tag{5}$$
Then I followed the hint to get the partial integration formula for Riemannian manifolds:
$$\int_M\langle\mathrm{grad}f,X\rangle_g dV_g=\int_{\partial M}f\langle X,N\rangle_g dV_\tilde{g}-\int_M f\mathrm{div}X dV_g\tag{6}$$
This begs the question: how come does (3) hold true?
 A: The way you’ve currently phrased things, no, and you have very obvious counterexamples. For example, let $M=\overline{B(0,1)}\subset\Bbb{R}^n$ be the closed unit ball. This is obviously a smooth manifold with boundary, and it is compact, so by default every vector field is compactly supported. Consider the vector field $X$ corresponding to the identity map (i.e $X(p):=\sum_{i=1}^np^i\frac{\partial}{\partial x^i}(p)$). This vector field can be defined on all of $\Bbb{R}^n$, and by restricting to $M$, you get a vector field tangent to $M$. The normal $N$ is just $X$ restricted to $\partial M$, so
\begin{align}
\int_{\partial M}\langle X,N\rangle\,dA&=\int_{\partial M}\langle N,N\rangle\,dA=\text{area}(\partial M)\quad\left(=\frac{2\pi^{n/2}}{\Gamma(n/2)}\right).
\end{align}
So, the answer is definitely not zero.
The correct generalization of the result you quoted is the following:

Let $(M,g)$ be a smooth ($C^2$ works) $n$-dimensional (pseudo-)Riemannian manifold (without boundary, like $\Bbb{R}^n$). Then, for any smooth ($C^1$ works) compactly supported vector field $X$ on $M$, we have $\int_M\text{div}(X)\,dV_g=0$.

Or, you can work with manifolds-with-boundaries, and require that the vector field is compactly supported in the manifold interior $\text{int}(M)$, so that the vector field vanishes on $\partial M$. In this case, by the divergence theorem, the boundary term vanishes by hypothesis.
