Average of the inverse distance between two points in a uniform ball

averageinverse functionuniform distribution

I'd like to compute the average of the inverse distance between two different points $x=(x_1,x_2)$ and $y=(y_1,y_2)$ in a ball $B(0,R)$. In particular, I'd like to calculate the following integral (when it converges)

$\int_{B(0,R)} \int_{B(0,R)} \frac{1}{|x-y|} dx dy$

In general, this integral doesn't converge, but I could assume that $|x-y|>\epsilon$ for some small $\epsilon>0$.

I found an estimate from below and from above and I computed it. In particular,

$ \int_{B(0,R)} \int_{B(0,R)} \frac{1}{2 max\{|x_1-y_2|, |x_2-y_2|\}} dx dy \leq \\
\int_{B(0,R)} \int_{B(0,R)} \frac{1}{|x-y|} dx dy \leq \\ \int_{B(0,R)} \int_{B(0,R)} \frac{1}{max\{|x_1-y_2|, |x_2-y_2|\}} dx dy$

The problem is interesting because it is useful to compute the following integral
$\int_{B(0,R)} \int_{B(0,R)} \frac{1}{|x-y|^\lambda} dx dy$
for some $\lambda$, that can be interpret as a long range interaction between two particles.

Thanks in advance.

Best Answer

Distance to a Sphere in a Direction Offset from the Closest

Consider the following diagram

enter image description here

Define $r=OP$ and $R=OS=OQ$. Then the Pythagorean Theorem says $$ \begin{align} MS &=MQ\tag{1a}\\[3pt] &=\sqrt{OQ^2-OM^2}\tag{1b}\\ &=\sqrt{R^2-r^2\sin^2(\theta)}\tag{1c} \end{align} $$ Furthermore, $$ MP=r\cos(\theta)\tag2 $$ Therefore, $$ \begin{align} PQ&=MQ-MP\tag{3a}\\[3pt] &=-r\cos(\theta)+\sqrt{R^2-r^2\sin^2(\theta)}\tag{3b} \end{align} $$ and $$ \begin{align} PS&=MS+MP\tag{4a}\\[3pt] &=r\cos(\theta)+\sqrt{R^2-r^2\sin^2(\theta)}\tag{4b}\\ &=-r\cos(\theta-\pi)+\sqrt{R^2-r^2\sin^2(\theta-\pi)}\tag{4c} \end{align} $$ Thus, we have shown the following

Theorem: Given a point $P$ at a distance $r$ from the center of a sphere of radius $R$, the distance $\Delta$ from $P$ to the sphere in a direction at angle $\theta$ from the direction to the closest point of the sphere is $$ \Delta=-r\cos(\theta)+\sqrt{R^2-r^2\sin^2(\theta)}\tag5 $$


Mean Reciprocal Distance in a Given Solid Angle

enter image description here

Given a solid angle $\Omega$, the volume of the solid slab is $\Omega r^2\,\mathrm{d}r$, where $r$ is the distance of the slab from the vertex. Thus, the volume-weighted integral of the reciprocal distance from the vertex is $$ \int_0^\Delta\frac{\Omega r^2\,\mathrm{d}r}r=\frac{\Omega\Delta^2}2\tag6 $$ where $\Delta$ is the maximum distance of the slabs from the vertex.


Computing the Mean Reciprocal Distance from a Given Point

Let $P$ be a point at a distance $r$ from $O$, the center of a sphere of radius $R$, The set of points on the sphere at distance $\Delta$ from $P$ are along the edge of the base of a right-circular cone with angle $\theta$. Formula $(5)$ applies to any planar slice of the sphere containing $OP$.

enter image description here

The solid angle subtended by the infinitesimal wedge of a cone between angles $\theta$ and $\theta+\mathrm{d}\theta$ is $$ \mathrm{d}\Omega=2\pi\sin(\theta)\,\mathrm{d}\theta\tag7 $$ Thus, using $\Delta=-r\cos(\theta)+\sqrt{R^2-r^2\sin^2(\theta)}$, we integrate $\frac{\Delta^2\mathrm{d}\Omega}2$ (from $(6)$): $$ \begin{align} \iiint_{|x|\le R}\frac{\mathrm{d}V}{|P-x|} &=\frac12\int_0^\pi\left(-r\cos(\theta)+\sqrt{R^2-r^2\sin^2(\theta)}\right)^22\pi\sin(\theta)\,\mathrm{d}\theta\tag{8a}\\ &=\pi\int_{-1}^1\left(-ru+\sqrt{R^2-r^2+r^2u^2}\right)^2\,\mathrm{d}u\tag{8b}\\ &=\pi\frac{\sqrt{R^2-r^2}^3}r\int_{-\frac{r}{\sqrt{R^2-r^2}}}^{\frac{r}{\sqrt{R^2-r^2}}}\left(-u+\sqrt{1+u^2}\right)^2\,\mathrm{d}u\tag{8c}\\ &=\pi\frac{\sqrt{R^2-r^2}^3}r\int_{-\frac{r}{\sqrt{R^2-r^2}}}^{\frac{r}{\sqrt{R^2-r^2}}}\left(1+2u^2\right)\mathrm{d}u\tag{8d}\\ &=\pi\frac{\sqrt{R^2-r^2}^3}r\left(\frac{2r}{\sqrt{R^2-r^2}}+\frac{\frac43r^3}{\sqrt{R^2-r^2}^3}\right)\tag{8e}\\ &=2\pi\left(R^2-r^2\right)+\frac{4\pi}3r^2\tag{8f}\\ &=2\pi R^2-\frac{2\pi}3r^2\tag{8g} \end{align} $$ Explanation:
$\text{(8a):}$ combine $(6)$ and $(7)$
$\text{(8b):}$ substitute $u=\cos(\theta)$
$\text{(8c):}$ substitute $u\mapsto \frac{\sqrt{R^2-r^2}}ru$
$\text{(8d):}$ after squaring the integrand, the odd part is cancelled
$\text{(8e):}$ integrate
$\text{(8f):}$ simplify
$\text{(8g):}$ simplify

Dividing by $\frac{4\pi}3R^3$ gives the average reciprocal distance from a point at distance $r$ from the center of a sphere with radius $R$: $$ \frac3{2R}-\frac1{2R}\left(\frac rR\right)^2\tag9 $$


Compute the Mean Reciprocal Distance Between Two Points

The average reciprocal distance between two random points in a sphere of radius $R$ is $$ \frac3{4\pi R^3}\int_0^R\left(\frac3{2R}-\frac1{2R}\left(\frac rR\right)^2\right)4\pi r^2\,\mathrm{d}r=\frac6{5R}\tag{10} $$


Empirical Verification

Generating five runs of $4000$ random points in a unit sphere and taking the average of the reciprocals of the distances between all pairs, I got $1.19412,1.2,1.19647,1.20498,1.20042$. These are all close to the theoretical average of $\frac65=1.2$

Related Question