computing an integral with sines and cosines Hi i'm trying to do this definite integral $$∫_{0}^{π }\frac{\sin ^3xdx}{\left(R^2+Z^2-2ZR\cos x\right)^{3/2}}=∫_{0}^{π}\frac{\sin xdx}{\left(R^2+Z^2-2RZ\cos x\right)}-∫_{0}^{π}\frac{\cos ^2x\sin xdx}{\left(R^2+Z^2-2RZ\cos x\right)}$$
And then i have to see what happens when $ Z<R$
I do the substitution: $u=R^2+Z^2-2RZ\cos x,du=2ZRsenx,\cos ^2x=\left(\frac{R^2+z^2-u}{2ZR}\right)^2$
$$\frac{1}{2ZR}∫\frac{du}{u^{3/2}}-\frac{1}{\left(2ZR\right)^2}\left(∫\frac{\left(R^2+Z^2\right)^2du}{u^{3/2}}-∫\frac{2\left(R^2+Z^2\right)u}{u^{3/2}}+∫\frac{u^2du}{u^{3/2}}\right)$$
$$\frac{-u^{-1/2}}{ZR}+\frac{\left(R^2+Z^2\right)^2u^{-1/2}}{2\left(ZR\right)^2}+\frac{\left(R^2+Z^2\right)u^{1/2}}{\left(RZ\right)^2}-\frac{2u^{3/2}}{3}=$$$$\frac{-(R^2+Z^2-2RZcosx)^{-1/2}}{ZR}+\frac{(R^2+Z^2)^2(R^2+Z^2-2RZcosx)^{-1/2}}{2(ZR)^2}+\frac{(R^2+Z^2)(R^2+Z^2-2RZcosx)^{1/2}}{(RZ)^2}-\frac{2(R^2+Z^2-2RZcosx)^{3/2}}{3} \big|_0^\pi
 $$
then
$$\frac{1}{\left(ZR\right)^2}(\frac{1}{2}\left(\frac{1}{|R+Z|}-\frac{1}{|R-Z|}\right)\left(\left(R^2+Z^2\right)^2-2ZR\right)+\left(R^2+Z^2\right)\left(|R+Z|-|R-Z|\right)-\frac{1}{6}\left(R+Z\right)^3+\frac{1}{6}\left(|R-Z|\left(R-Z\right)^2\right)$$
when $Z<R$
I get $$\frac{2}{3R^2}\frac{3R-2ZR^2-4Z^3}{R^2-Z^2}$$
but it has to be $\frac{4}{3R^3}$
i've looked at it too much i dont know where im doing wrong.please help
 A: I know how to do it now, a friend helped me, but it's a different way of solving it:
$$∫_{0}^{π}\frac{\sin ^3xdx}{\left(R^2+Z^2-2ZR\cos x\right)^{3/2}}$$
integrating by parts:
$$u=sen^2x, du=2senx\cos x$$$$dv=\frac{senxdx}{\left(R^2+Z^2-2ZR\cos x\right)^{3/2}},v=\frac{-\left(R^2+Z^2-2ZR\cos x\right)^{-1/2}}{ZR}$$$$\frac{sen^2x}{-\left(R^2+Z^2-2ZR\cos x\right)^{1/2}ZR}\big|_{0}^{π}+\frac{2}{ZR}∫\frac{senx\cos xdx}{\left(R^2+Z^2-2ZR\cos x\right)^{1/2}}$$
the first part becomes $0$ and again with parts
$$dv=\left(R^2+Z^2-2ZR\cos x\right)^{-1/2},v=\frac{-\left(R^2+Z^2-2ZR\cos x\right)^{1/2}}{ZR}$$
$$\frac{-2}{ZR}\left(\cos x\frac{\left(R^2+Z^2-2ZR\cos x\right)^{1/2}}{-ZR}+∫\frac{\left(R^2+Z^2-2ZR\cos x\right)^{1/2}du}{ZR}\right)$$$$\frac{-2}{\left(ZR\right)^2}\left(|R+Z|+|R-Z|\right)+\frac{4}{3\left(ZR\right)^3}\left(|R+Z|^3-|R-Z||R-Z|^2\right)$$
and when $Z<R$
$$\frac{-2}{\left(ZR\right)^2}\left(2R\right)+\frac{2}{3\left(ZR\right)^3}\left(R^3+3R^2Z+3RZ^2+Z^3-R^3+3R^2Z-3RZ^2+Z^3\right)=\frac{-4}{ZR^2}+\frac{4R^2Z}{3Z^3R^3}+\frac{4}{3R^3}=\frac{4}{3R^3}$$
However i don't understand why it doesn't work with the way I did it! 
