Weak derivative and integration by parts I'm confused by the following statement from the Evans text on Partial Differential Equations:

If $U \subseteq \mathbb{R}^{n}$ is open, and $u \in C^{1}(U)$ (i.e., $u$ is continuously differentiable on $U$), then given any $\phi \in C^{\infty}_{C}(U)$ ($\phi$ infinitely differentiable with compact support in $U$), we have via integration by parts:
$$\int \limits_{U} u \phi_{x_{i}}(x) \,dx = - \int \limits_{U} u_{x_{i}} \phi(x) \,dx$$

How does this follow via integration by parts?  If we let $u = u(x)$ and $dv = \phi_{x_{i}}(x) \,dx$, then we get:
$$\int \limits_{U} u\,dv = uv - \int \limits_{U} v \,du$$
Applying our substitutions, we get:
$$ \int \limits_{U} u(x) \phi_{x_{i}}(x) \,dx = u(x) \phi(x) - \int \limits_{U} \phi(x) u_{x_{i}}(x) \,dx $$
What happens to the $u(x)\phi(x)$ in the formula?  Why is it $0$?  I understand that near the boundary of $U$, we get that $\phi(x)$ is $0$, but I don't know how to rigorously show anything.
 A: First observe that the "partial integration" formula that you
are using strictly speaking does only apply in the case $n=1$. In
the case $n>1$, the "substitute" for the partial integration
rule that is ordinarily invoked to prove your formula is the divergence
theorem, which states
$$
\int_{U}{\rm div}f\, dx=\int_{\partial U} \langle f(x), \nu(x) \rangle \, dS(x) \qquad (\ddagger)
$$
for $f\in C^{1}\left(\overline{U};\mathbb{R}^{n}\right)$ and $U\subset\mathbb{R}^{n}$
open and bounded with $C^{1}$-boundary (the exact prerequisites may
vary). Here, $\nu(x)$ is the outward pointing unit normal vector and $S$ denotes the surface measure. This is then applied to 
$$
f=\left(\begin{matrix}0\\
\vdots\\
u\phi\\
0\\
\vdots\\
0
\end{matrix}\right),
$$
where the $u\phi$ is in the $i$th row. Observe that the right hand
side of $(\ddagger)$ vanishes because of $\phi\in C_{c}^{\infty}\left(U\right)$. Using the product rule to compute ${\rm div}\,f$ (see below), this implies your claim.
In your case, this can be applied with $U = B_R(0)$, where $R$ is chosen so large that ${\mathrm supp} \, \phi \subset B_R(0)$. Using the compact support of $\phi$ it is easy to see that even $u\phi \in C^1(\Bbb{R}^n)$, so that everything works fine.
This approach has the drawback that one has to know all the machinery of the divergence theorem (open sets with $C^1$ boundaries, the divergence, the outward pointing unit normal field, integration on manifolds and the divergence theorem itself).
Hence, I propose to give more love to the following Lemma which only uses


*

*partial integration in $\Bbb{R}^1$,

*some topological properties of $\Bbb{R}^1$ (components are intervals, $\Bbb{R}$ is second countable)

*Fubini's theorem and Lebesgue integration.


Lemma: Let $\emptyset\neq V\subset\mathbb{R}^{d}$ be
open and bounded. Let $\varphi\in C\left(\overline{V}\right)$ with
$\varphi|_{\partial V}\equiv c$ for some $c\in\mathbb{R}$. Furthermore,
let $i\in\left\{ 1,\dots,d\right\} $ and assume that $\partial_{i}\varphi\in C\left(V\right)\cap L^{1}\left(V\right)$.
Then
$$
\int_{V}\left(\partial_{i}\varphi\right)\left(x\right)\, dx=0.
$$
Proof: Without loss of generality assume $i=d$ (the proof
is essentially the same in all other cases). Because of $\partial_{i}\varphi\in L^{1}\left(V\right)$,
we can apply Fubini's theorem to conclude
$$
(\dagger) \qquad \int_{V}\left(\partial_{i}\varphi\right)\left(x\right)\, dx=\int_{\mathbb{R}^{d-1}}\int_{\mathbb{R}}\left(\partial_{d}\varphi\right)\left(x_{1},\dots,x_{d-1},x_{d}\right)\cdot\chi_{V}\left(x_{1},\dots,x_{d-1},x_{d}\right)\, dx_{d}\, d\left(x_{1},\dots,x_{d-1}\right),
$$
where the inner integral converges absolutely for almost all $\left(x_{1},\dots,x_{d-1}\right)\in\mathbb{R}^{d-1}$.
Let us fix some $x'=\left(x_{1},\dots,x_{d-1}\right)\in\mathbb{R}^{d-1}$.
Note that the set
$$
V_{x'}:=\left\{ x_{d}\in\mathbb{R}\,\mid\,\left(x',x_{d}\right)\in V\right\} =\left(x_{d}\mapsto\left(x',x_{d}\right)\right)^{-1}\left(V\right)
$$
is an open subset of $\mathbb{R}$. In the case $V_{x'}\neq\emptyset$,
this implies
$$
V_{x'}=\biguplus_{n\in\mathbb{N}}\left(a_{n},b_{n}\right)
$$
with $-\infty<a_{n}\leq b_{n}<\infty$ for $n\in\mathbb{N}$. The intervals $(a_n, b_n)$ are the components of $V$, optionally "filled up" with $a_n = b_n$ for $n> n_0$ if the number $n_0$ of components is actually finite (this simplifies the notation).
Here, we used the boundedness of $V$. Otherwise, $a_{n}$ or $b_{n}$ could
be infinite. Observe that the $a_{n},b_{n}$ do depend on $x'$. What
we use here is that each set is the disjoint union of its components.
In $\mathbb{R}$, every component of an open set is an open interval.
Finally, $\mathbb{R}$ is second countable, so that the union is countable.
Finally, observe that in the case $a_{n}<b_{n}$, we can not
have $a_{n}\in V_{x'}$ or $b_{n}\in V_{x'}$ (why?). Hence, $\left(x',a_{n}\right),\left(x',b_{n}\right)\in\overline{V}\setminus V=\partial V$,
so that $\varphi\left(x',a_{n}\right)=c=\varphi\left(x',b_{n}\right)$,
which implies
$$
\int_{a_{n}}^{b_{n}}\frac{\partial\varphi}{\partial x_{d}}\left(x',x_{d}\right)\, dx_{d}=\varphi\left(x',b_{n}\right)-\varphi\left(x',a_{n}\right)=0.
$$
Here, we used that $x_d \mapsto \varphi(x', x_d)$ is continuously differentiable on $(a_n ,b_n)$ and extends continuously to $[a_n,b_n]$.
In the case $a_{n}=b_{n}$, the integral trivially vanishes.
In summary, we conclude
\begin{eqnarray*}
 &  & \int_{\mathbb{R}}\left(\partial_{d}\varphi\right)\left(x_{1},\dots,x_{d-1},x_{d}\right)\cdot\chi_{V}\left(x_{1},\dots,x_{d-1},x_{d}\right)\, dx_{d}\\
 & = & \sum_{n\in\mathbb{N}}\int_{a_{n}}^{b_{n}}\frac{\partial\varphi}{\partial x_{d}}\left(x',x_{d}\right)\, dx_{d}\\
 & = & 0.
\end{eqnarray*}
Plugging this into $\left(\dagger\right)$ above yields the claim.$\square$
Now choose some bounded open set $V\subset U$ with ${\rm supp}\left(\phi\right)\subset V$
and apply the above Lemma to $\varphi=u\cdot\phi$ (check that all
assumptions are satisfied with $c=0$). Using the product rule, this
implies
$$
0=\int_{V}\left(\partial_{i}\varphi\right)\left(x\right)\, dx=\int_{V}\phi\cdot\partial_{i}u+u\cdot\partial_{i}\phi\, dx,
$$
which yields your claim.
A: Recall that for $f \in C^1(U)$ and $X$ some vector field on $U$, the divergence operator satisfies the following Leibniz rule:
$$
\text{div}(fX) = f(\text{div}X) + \nabla f \cdot X
$$
where $\nabla f$ means the gradient of $f$ and $\cdot$ is the usual dot product in $\mathbb{R}^n$. Also, the divergence theorem says that
$$
\int_U \text{div}(X)dx = - \int_{\partial U}X \cdot \nu dx'.
$$
Here $\nu$ is the inward pointing normal vector field to the boundary of $U$ (this is just a convention and the other way around would just change the sign in front of the integral), and $dx'$ is the volume form on $\partial U$, defined such that if $e_2, \ldots, e_n$ is a positiviely oriented basis for the orientation of $\partial U$, then $\nu, e_2, \ldots, e_n$ is positiviely oriented in $\mathbb{R}^n$.
Coupling these two equations you get
$$
\int_U (f\text{div}X)dx = -\int_U \nabla f \cdot X dx - \int_{\partial U}X \cdot \nu dx'.
$$
In your case however, $U$ could be unbounded so you need to apply this argument on a sequence of compacts $K_i \subset \mathbb{R}^n$ such that $\bigcup_i K_i = U$. Then with $u \in C^1(U)$ and $\phi \in C^{\infty}_c(U)$, you apply this to the function $f(x) = u(x)$ and the vector field $X = \phi(x)\frac{\partial}{\partial x^i}$, so that $\text{div}X = \frac{\partial \phi(x)}{\partial x^i}$. What you get from this last formula is
$$
\int_{K_j}(u\phi_{x_i})dx = -\int_{K_j}(u_{x_i}\phi)dx - \int_{\partial K_j}\phi(x)\left(\frac{\partial}{\partial x^i} \cdot \nu \right) dx'
$$
for every $j$. Letting $j \to \infty$ you find your formula
$$
\int_U u\phi_{x_i}dx = -\int_U u_{x_i}\phi dx.
$$
This argument is actually valid on any Riemannian manifold with boundary, with the Riemannian metric playing the role of the dot product. There's a very thorough explanation in Gallot, Hulin & Lafontaine's Riemannian geometry book in the analysis chapter.
