# A triple integral in Spherical coordinates from Jackson's book on Electrodynamics [closed]

I have been trying a solution for the following integral from Jackson but i do not seem to go anywhere. Please help. The problem is to compute interaction energy due to 2 charges.

Compute following integral: $$\iiint \frac {(\vec x - \vec x_1).(\vec x- \vec x_2)}{|(\vec x - \vec x_1)|^3 |(\vec x- \vec x_2)|^3} \mathrm d^3 \vec x$$

After the substitution as suggested in Jackson's book, I came upon following (after taking $$x_1$$ at origin and $$x_2$$ on x axis. But I am not able to integrate it, aside from constant).

$$\iiint_{V}\frac {r+n\sin\theta \cos\phi}{(r^2+n^2+2rn\sin\theta \cos\phi)^{\frac {3}{2}}} \sin\theta \,\mathrm dr \,\mathrm d\theta \,\mathrm d\phi$$

Where the integration is over sphere of infinite radius and $$\theta$$ is the angle made by the position vector with the $$z$$ axis and $$n$$ is constant.

If you formulate the integral in the correct coordinates (i.e. in spherical polar coordinates with the axis along the inter-charge axis), then it reads $$E = \int_0^\infty\!\!\! \int_0^\pi\!\! \int_0^{2\pi} \frac{r-d\cos(\theta)}{\left(r^2+d^2 -2rd\cos(\theta)\right)^{3/2}} \sin(\theta) \,\mathrm d\phi \,\mathrm d\theta \,\mathrm dr ,$$ where $$d$$ is the inter-charge distance, $$r=|\vec x-\vec x_1|$$, and $$\theta$$ is the polar spherical angle in that coordinate frame; the factor of $$r^2$$ coming from the volume element has cancelled out with the $$1/r^2$$ coming from the electric field of the first charge.
Here the $$\phi$$ integral is trivial and returns a factor of $$2\pi$$, and the $$\theta$$ integral, as usual, can be simplified by changing variables to $$u=\cos(\theta)$$, with $$\mathrm du = \sin(\theta)\mathrm d\theta$$, giving $$E = 2\pi \int_0^\infty\!\!\! \int_{-1}^1 \frac{r-du}{\left(r^2+d^2 -2rd\,u\right)^{3/2}} \mathrm du \,\mathrm dr .$$ From here the inner integral in $$u$$ is reasonably-structured and it has a clean antiderivative. I found it using Mathematica, but if you want a strict pen-and-paper integration process then you can start with the first term, of the form $$1/(A-Bu)^{3/2}$$, which yields easily to standard variable substitutions, and then use those same substitutions for the $$u/(A-Bu)^{3/2}$$ term.
(It's relevant to note that while the original integral does contain an integrable singularity at $$\theta=0$$, $$r=d$$, it is gone by this stage. Moreover, that singularity needs to be handled with extreme care: every $$r$$ integral at fixed $$u$$, except $$u=1$$, is regular, as is every $$u$$ integral at fixed $$r$$ except $$r=d$$; as such, neither integration order presents a problem.)
The result after the $$u$$ integral cannot be handled in one go for all $$r\in[0,\infty)$$, but it's essentially trivial when separated into different integrals for $$0 and $$r>d$$.