Help with integral calculation I am reading this article and I am having trouble understanding a calculation there.
In it, this following equation is obtained:
$$ \frac{\partial}{\partial t} \int p_i n d \tau + \int p_i \left( \frac{\partial n}{\partial \textbf{x}} \frac{\partial \epsilon}{\partial \textbf{p}} - \frac{\partial n}{\partial \textbf{p}} \frac{\partial \epsilon}{\partial \textbf{x}}\right) d \tau = 0 .$$
where $\epsilon$ and p are the energy and momentum of the quasiparticles, and,
$$ d \tau =  g  \frac{d^3 p}{(2 \pi)^3} .$$
with g the degeneracy of each state.
This equation was next rewritten, by algebraic manipulation and integration by parts, in the form,
$$\frac{\partial}{\partial t} \int p_i n d \tau + \frac{\partial}{\partial \textbf{x}} \int p_i \frac{\partial \epsilon}{\partial \textbf{p}} n d \tau + \frac{\partial}{\partial x_i}\int n \epsilon d \tau - \int \epsilon \frac{\partial n }{\partial x_i} d \tau =0 .$$
My question is how was this second form obtained? I can't follow the calculation.
 A: It's just a plain double integration by parts. Recall the bold vectors dot each other, and  since there is no integration over x, its  divergence/gradient term survives.
$$\left( \frac{\partial n}{\partial \textbf{x}} \frac{\partial \epsilon}{\partial \textbf{p}} - \frac{\partial n}{\partial \textbf{p}} \frac{\partial \epsilon}{\partial \textbf{x}}\right) =\frac{\partial }{\partial \textbf{x}}\left( n \frac{\partial \epsilon}{\partial \textbf{p}}\right ) - \frac{\partial }{\partial \textbf{p}}\left ( n \frac{\partial \epsilon}{\partial \textbf{x}}\right) .
$$
Your second starting integral, thus, reduces to
$$
\int\!\! d\tau ~~ p_i \left (  \frac{\partial }{\partial \textbf{x}}\left( n \frac{\partial \epsilon}{\partial \textbf{p}}\right ) - \frac{\partial }{\partial \textbf{p}}\left ( n \frac{\partial \epsilon}{\partial \textbf{x}}\right)   \right ) \\ =  \frac{\partial }{\partial \textbf{x}}\int\!\! d\tau ~~ p_i   n \frac{\partial \epsilon}{\partial \textbf{p}}  - \int\!\! d\tau ~~ p_i  \frac{\partial }{\partial \textbf{p}}\left ( n \frac{\partial \epsilon}{\partial \textbf{x}}\right)    \\
=  \frac{\partial }{\partial \textbf{x}}\int\!\! d\tau ~~ p_i   n \frac{\partial \epsilon}{\partial \textbf{p}}  + \int\!\! d\tau ~~ \frac{\partial p_i}{\partial \textbf{p}}   n\frac{\partial \epsilon}{\partial \textbf{x}}\\
= \frac{\partial }{\partial \textbf{x}}\int\!\! d\tau ~~ p_i   n \frac{\partial \epsilon}{\partial \textbf{p}}  + \int\!\! d\tau ~~    n\frac{\partial \epsilon}{\partial  x_i}
\\
 = \frac{\partial }{\partial \textbf{x}}\int\!\! d\tau ~~ p_i   n \frac{\partial \epsilon}{\partial \textbf{p}}  + \frac{\partial}{\partial x_i}\int n \epsilon d \tau - \int \epsilon \frac{\partial n }{\partial x_i} d \tau .
$$
