Change of variables - 1D integration I have the following integral
$$
\int dr_2 \frac{\partial}{\partial r_1} f(|r_1-r_2|) 
$$
and I change variables by
$$
r = r_1-r_2, \\ dr = -dr_2, \\ \frac{\partial}{\partial r_1}=\frac{\partial r}{\partial r_1}\frac{\partial}{\partial r}
= 1 \frac{\partial}{\partial r}
$$
to get
$$
-\int dr \frac{\partial}{\partial r} f(|r|)\,.
$$
Is this correct or did I transform $\partial/\partial r_1$ incorrectly?  If it's incorrect, how can I do the change of variables correctly? Thanks
I think the correct result  should be
$$
\int dr \frac{\partial}{\partial r} f(r),
$$ but what I have is incorrect by a minus sign and absolute value sign, so perhaps I am making the change of variables incorrectly due to the absolute value sign in $f$, or due to how I'm transforming $\partial/\partial r_1$.
I don’t think the answer posted below is correct so a correct solution would be greatly appreciated.
 A: Lemma
$$
\begin{align}
\frac{\mathrm{d}h(x)}{\mathrm{d}g(x)} &= \frac{\mathrm{d}h(x)}{\mathrm{d}x}\cdot\frac{\mathrm{d}x}{\mathrm{d}g(x)}\\\\
&= \frac{\mathrm{d}h(x)}{\mathrm{d}x}:\frac{\mathrm{d}g(x)}{\mathrm{d}x}\\\\
&= \frac{\frac{\mathrm{d}h(x)}{\mathrm{d}x}}{\frac{\mathrm{d}g(x)}{\mathrm{d}x}}
\end{align}
$$
How you solved it
You set  $g(r)=r+r_2$ and $h(r)=f(\lvert r \rvert)$.
So by the Lemma:
$$\frac{\partial}{\partial(r+r_2)}f(\lvert r\rvert)=\frac{\frac{\partial f(\lvert r\rvert)}{\partial r}}{\frac{\partial(r+r_2)}{\partial r}}=\frac{\partial f(\lvert r\rvert)}{\partial r}.$$
The negative sign comes from the new differential.
How the book solved it
They set $r=\lvert r_1-r_2\rvert$. We have to solve for $r_1$:

*

*Case 1: $r_1\ge r_2$. That means $r_1=r+r_2$.

*Case 2: $r_1 < r_2$. That means $r_1=r_2-r$.

Case 1 is the exact same case we solved with your method. Case 2 is very similar. By our Lemma we have
$$\frac{\partial}{\partial(r_2-r)}f(r)=\frac{\frac{\partial f( r)}{\partial r}}{\frac{\partial(r_2-r)}{\partial r}}=-\frac{\partial f( r)}{\partial r}.$$
Here we have a negative expression and in Case 1 we have a positive expression. These two will evaluate to positve values if multiplying by the differential.
