# integration over a ball

I try to compute the value of the following integral:

Let $V=B_R(0)\subset \mathbb{R}^3$ be the Ball with radius $R$ around zero. How can I compute $\int_V \frac{1}{\left|\vec{x}-\vec{y}\right|}d^3y.$

First I substitute $z:=y-x$. Then I get the integral:

$\int_{V+z} \frac{1}{\left|\vec{z}\right|}d^3z$ Then I introduce spherical coordinates and I get:

$\int_{} \sin^2(\theta) \;d\theta \,dr\,d\phi.$

I can evaluate the integral, But I don't know how the integration area is changed by the transformation into spherical coordinates. Can you help me?

Regards

-

The value of the integral only depends on the distance $a:=|{\bf x}|\geq0$. Therefore you may assume ${\bf x}=(0,0,a)$ and introduce spherical coordinates. One has $$|{\bf y}-{\bf x}|=\sqrt{(r\sin\theta -a)^2+r^2\cos^2\theta}=\sqrt{a^2+r^2-2ar\sin\theta}\ ,$$ $${\rm d}(x,y,z)=r^2\cos\theta\ {\rm d}(r,\phi,\theta)\ ,$$ and the integrand is independent of $\phi$. Therefore the quantity $Q$ to be computed is given by the double integral $$Q=2\pi\int_0^R\int_{-\pi/2}^{\pi/2}r^2{\cos\theta\over\sqrt{a^2+r^2-2ar\sin\theta}}\ d\theta\ dr\ .$$ For the inner integral substitute $\ \sin\theta:= t$ $\ (-1\leq t\leq1)$; when dealing with the outer integral you may have to distinguish the cases $a<R$ and $a>R$.

-

Basically, you are integrating a radially simmetric function over a ball. In general, in $B \subset \mathbb{R}^n$ is the unit ball and $f=f(r)=f(|x|)$, then $$\int_B f \, d \mathcal{L}=|S^{n-1}| \int_0^1 f(r) r^{n-1}\, dr$$ where $|S^{n-1}|$ is the surface of the sphere $S^{n-1}$. In dimension $n=3$, the surface of $S^2$ is...

-
Sorry: $\mathcal{L}$ is the Lebesgue measure in $\mathbb{R}^n$, maybe this symbol is not very common in vector analysis. – Siminore Apr 24 '12 at 14:27
Thank you for your help but where does the equation comes from? – Braten Apr 24 '12 at 14:36
But the $f$ above isn't symmetic on $B_R(0)$ if $x \ne 0$, is it? – martini Apr 24 '12 at 14:44
Yes martini is right!!! – Braten Apr 24 '12 at 14:50
Sorry, I read $B_R(x)$ instead of $B_R(0)$. In this case the answer depends on $x$. I remeber a solution by noticing that $y \mapsto \frac{1}{|y|}$ is a harmonic function (where defined) in $\mathbb{R}^3$. I must try to recall the details... – Siminore Apr 24 '12 at 15:05

The value of this integral depends on whether or not $x$ is in $B_R(0)$. In general, you can think of this as the potential from a charged ball.

Note that your function is the Green's function for the 3D Laplace equation. You can now write the solution $\phi(x)$: $$\nabla^2\phi(\vec{x})=-\rho(\vec{x})$$ Where $\rho(x)$ is $1$ inside $B_R(0)$, and $0$ elsewhere. Use the Laplace Operator in spherical coordinates to separate the equation.

-
@nbusis: do you know how to compute the integral? – Braten Apr 25 '12 at 13:57
@Braten - see my edited answer. – nbubis Apr 27 '12 at 7:21

In physics (molecular theory of liquids), the following integral sometimes appears (and don't have proper reference at hand, only a spanish textbook) :

$$I(s) = \int_{V_R} f_1(r_1) f_2(r_2) d{\bf x}$$

where $V_R$ is a ball of radius $R$ (usually $R=\infty$), $r_1=|\bf{x}|$, $r_2=|{\bf x}-{\bf s}|$ and $s=|{\bf s}|$; WLOG, let ${\bf s}=(0,0,s)$ Changing first to polar coordinates ($x =r_1 \sin \theta \cos \phi$, $y =r_1 \sin \theta \sin \phi$ , $z=r_1 \cos \theta$) and then to bipolar coordinates ($r_1=r_1$, $r_2^2=r_1^2+s^2-2 r_1 s \cos \theta$, $\phi = \phi$) we get:

$$I(s) = 2 \pi \int_{0}^{R} \int_{|r_1-s|}^{r1+s}f_1(r_1) f_2(r_2) \frac{r_1 r_2}{s} dr_2 dr_1$$

This is slightly more general than we need, but it seems a interesting/useful formula.

In our case, $f_1 =1$, $f_2(r_2) = 1/r_2$, (and $s=|x|$), hence

$$I(s)=2\pi \int_{0}^{R} \int_{|r_1-s|}^{r1+s} \frac{r_1}{s} dr_2 dr_1$$

So $$\frac{I(s)}{2\pi}= \int_{0}^{s} \frac{r_1}{s} 2 r_1 dr_1 + \int_{s}^{R} \frac{r_1}{s} 2 s dr_1 = \frac{2}{3}s^2 + (R^2 -s^2)$$

and

$$I(s)=2 \pi \left(R^2-\frac{1}{3}s^2\right)$$

This should be valid (unless I've messed something) for ${\bf x}$ inside the ball (i.e. $s \le R$).

Edit: quick and dirty numerical test with Octave/Matlab:

R=5;
s=3.5;
N=30000;
X=rand(N,3)*2*R-R;
Y=sqrt(sum(abs(X).^2,2));
X1 = X(Y<R,:);
N1 = size(X1,1);
X1(:,3) = X1(:,3)-s;
V = 1./sqrt(sum(abs(X1).^2,2));
(4*pi*R^3/3)*sum(V)/N1
2*pi*(R^2-s^2/3)


It feels right.

-