Help with this integral substitution This came up in my physics exercise:
$$\int_{\theta=0}^{\pi}\frac{\cos\left ( \theta \right )\sin\left ( \theta \right )}{\sqrt{R^{2}+r^{2}-2Rr\cos\left ( \theta \right )}}d\theta$$
I've tried the substitution $u=$ everything under the square root but it didn't worked.
I don't like this integral.
Any help is appreciated.
Thanks in advance.
 A: Let $u=R^2+r^2-2Rr\cos\theta,\;$ so $du=2Rr\sin\theta d\theta$ and $\cos\theta=\frac{R^2+r^2-u}{2Rr}$.
Then $\displaystyle\int_{0}^{\pi}\frac{\cos\left ( \theta \right )\sin\left ( \theta \right )}{\sqrt{R^{2}+r^{2}-2Rr\cos\left ( \theta \right )}}d\theta=\frac{1}{2Rr}\int_{(R-r)^2}^{(R+r)^2}\frac{\frac{R^2+r^2-u}{2Rr}}{\sqrt{u}}du=\frac{1}{4R^2r^2}\int_{(R-r)^2}^{(R+r)^2}\left(\frac{R^2+r^2}{\sqrt{u}}-\sqrt{u}\right)du$
$\displaystyle=\frac{1}{4R^2r^2}\left[2(R^2+r^2)\sqrt{u}-\frac{2}{3}u^{3/2}\right]_{(R-r)^2}^{(R+r)^2}$
$\displaystyle=\frac{1}{4R^2r^2}\left[2(R^2+r^2)\big[(R+r)-(R-r)\big]-\frac{2}{3}\big[(R+r)^3-(R-r)^3\big]\right]$
$\displaystyle=\frac{1}{4R^2r^2}\left[2(R^2+r^2)(2r)-\frac{2}{3}(6R^2r+2r^3)\right]=\frac{1}{4R^2r^2}\left[4r-\frac{4}{3}r^3\right]=\color{blue}{\frac{2r}{3R^2}}$
A: $$\text{I}\left(\text{r},\text{R}\right)=\int_0^\pi\frac{\cos(\theta)\sin(\theta)}{\sqrt{\text{R}^2+\text{r}^2-2\text{R}\text{r}\cos(\theta)}}\space\text{d}\theta=$$

Subsitute $u=\text{R}^2+\text{r}^2-2\text{R}\text{r}\cos(\theta)$ and $\text{d}u=2\text{R}\text{r}\cos(\theta)\space\text{d}\theta$.
This gives a new lower bound $u=(\text{r}-\text{R})^2$ and upper bound $u=(\text{r}+\text{R})^2$:

$$-\frac{1}{4\text{R}^2\text{r}^2}\int_{(\text{r}-\text{R})^2}^{(\text{r}+\text{R})^2}\frac{u-\text{R}^2-\text{r}^2}{\sqrt{u}}\space\text{d}u=$$
$$-\frac{1}{4\text{R}^2\text{r}^2}\left(\int_{(\text{r}-\text{R})^2}^{(\text{r}+\text{R})^2}\sqrt{u}\space\text{d}u-\text{R}^2\int_{(\text{r}-\text{R})^2}^{(\text{r}+\text{R})^2}\frac{1}{\sqrt{u}}\space\text{d}u-\text{r}^2\int_{(\text{r}-\text{R})^2}^{(\text{r}+\text{R})^2}\frac{1}{\sqrt{u}}\space\text{d}u\right)=$$
$$-\frac{1}{4\text{R}^2\text{r}^2}\left(\int_{(\text{r}-\text{R})^2}^{(\text{r}+\text{R})^2}u^{\frac{1}{2}}\space\text{d}u-\text{R}^2\int_{(\text{r}-\text{R})^2}^{(\text{r}+\text{R})^2}u^{-\frac{1}{2}}\space\text{d}u-\text{r}^2\int_{(\text{r}-\text{R})^2}^{(\text{r}+\text{R})^2}u^{-\frac{1}{2}}\space\text{d}u\right)$$
Now, use:


*

*When $n\ne-1$:
$$\int u^n\space\text{d}u=\frac{u^{1+n}}{1+n}+\text{C}$$



So we will get:
$$\text{I}\left(\text{r},\text{R}\right)=\frac{\sqrt{(\text{R}+\text{r})^2}(\text{r}^2-\text{R}\text{r}+\text{R}^2)-\sqrt{(\text{r}-\text{R})^2}(\text{r}^2+\text{R}\text{r}+\text{R}^2)}{3\text{R}^2\text{r}^2}$$
A: First use the substitution $u=\cos\theta$, then $du=-\sin\theta d\theta$. It follows that
$$\int_0^\pi\frac{\cos\theta\sin\theta}{\sqrt{R^2+r^2-2Rr\cos\theta}}d\theta=\int_{-1}^1\frac{u}{\sqrt{R^2+r^2-2Rru}}du,$$
Then use integration by parts:
$$\int f'g =fg-\int fg'$$
with
$$f(u)=-\frac{1}{Rr}\sqrt{R^2+r^2-2Rru}, \quad g(u)=u$$
