Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to calculate the integral

$$I = \int_{-1}^1 \mathrm dx \int_{-1}^1 \mathrm dy \int_{-1}^1 \mathrm dz \frac{1}{x^2 + y^2 + z^2}$$

analytically? I tried using spherical coordinates

$$I = \int_0^{r(\vartheta,\varphi)} \mathrm dr \int_0^\pi \mathrm d\vartheta \int_0^{2\pi} \mathrm d\varphi \sin(\vartheta) \;,$$

but I couldn't come up with a proper expression for $r(\vartheta,\varphi)$, which is the radial component for points on the boundary of the cube $[0,1]^3$.

share|cite|improve this question
Using Gauss theorem (applied to the punctuated cube $C_{\epsilon} = [-1, 1]^3 - B_{\epsilon}(0)$ with $\epsilon \to 0$) for $f = \mathrm{r}/\| \mathrm{r} \|^2$, we have $$ \int_{C_0} \frac{dV}{\| \mathrm{r} \|^2} = \int_{\partial C_{0}} \frac{\mathrm{r}}{\| \mathrm{r} \|^2}\cdot \nu \, d\sigma = 24 \int_{0}^{1} \int_{0}^{1} \frac{dxdy}{x^2+y^2+1}. $$ But I have no idea how to go further... – Sangchul Lee May 15 '11 at 9:39
@sos440: Well, I guess the natural next step would be to split the integral into two triangles and go to polar coordinates, so that you get $$48 \int_0^{\pi/4} \int_0^{1/\cos\phi} \frac{r}{r^2+1} dr \, d\phi.$$ – Hans Lundmark May 15 '11 at 9:54
@hennes: That's because Wolfram/ Mathematica knows nothing about Clausen functions and their ilk, and thus has to use dilogarithms with complex argument. – J. M. May 15 '11 at 12:29
@hennes: Well, the result must be real, and numerical evaluation indicates that the imaginary part is indeed zero (up to some tiny numerical roundoff error). Maybe it's possible to write the answer in some nicer way which is obviously real, but I don't know. Anyway, if you've ever evaluated trig integrals using Euler's formulas, you might yourself have produced a complex-looking result which is actually real-valued. – Hans Lundmark May 15 '11 at 12:34
The "messy closed form" spat out by Mathematica for reference: $$\frac{i}{4}\left(\mathrm{Li}_2(-i(3-\sqrt{8}))-\mathrm{Li}_2(i(3-\sqrt{8}))\ri‌​ght)+\frac{\pi}{8}\mathrm{artanh}\frac{\sqrt{8}}{3}-\frac{G}{2}$$ – J. M. May 15 '11 at 17:04
up vote 4 down vote accepted

I. Spherical coordinates

Let's try to do this in spherical coordinates by brute force and see what happens. $$I = 16\int_R d \Omega \ d r,$$ where $R$ is the region for which $0\leq \theta\leq \pi/2$ and $0\leq\phi\leq \pi/4$. This region splits into two parts.

In region 1, $0\leq\theta \leq \theta'$ and we integrate up to $z=1$, so $0\leq r \leq 1/\cos\theta$.

In region 2, $\theta' \leq\theta \leq \pi/2$ and we integrate to $x=1$, so $0\leq r \leq 1/(\sin\theta\cos\phi)$.

Here $\theta'$ is a function of $\phi$, $\tan\theta' = \sqrt{1+\tan^2\phi}$. Notice that $\cos\theta' = 1/\sqrt{2+\tan^2\phi}$.

The integrals over region 1 and 2 are not elementary, $$\begin{eqnarray*} I_1 &=& 16 \int_0^{\pi/4} d\phi \int_0^{\theta'} d\theta \ \sin\theta \int_0^{1/\cos\theta} dr \\ &=& 8 \int_0^{\pi/4} d\phi \ \ln(2+\tan^2\phi) \\ %%% I_2 &=& 16 \int_0^{\pi/4} d\phi \int_{\theta'}^{\pi/2} d\theta \ \sin\theta \int_0^{1/(\sin\theta \cos\phi)} dr \\ &=& 16 \int_0^{\pi/4} d\phi \ \sec\phi \ \left(\frac{\pi}{2} - \theta'\right) \\ &=& 8\pi\ln(1+\sqrt2) - 16 \int_0^{\pi/4} d\phi \ \sec\phi \ \tan^{-1}\sqrt{1+\tan^2\phi}. \end{eqnarray*}$$ It is possible to go further with these integrals, but they are pretty ugly. Numerically they give $15.3482\cdots$. Let's try another approach.

II. Divergence theorem

Let's put together the steps in the comments and make it obvious our final answer is real.

Using the divergence theorem for ${\bf F} = \hat r/r$ we find $$I = 24\int_0^1 d x \int_0^1 d y \frac{1}{x^2+y^2+1},$$ and so, going to polar coordinates, $$\begin{eqnarray*} I &=& 48\int_0^{\pi/4} d \phi \int_0^{1/\cos\phi} d r \ \frac{r}{r^2+1} \\ &=& 24\int_0^{\pi/4} d\phi \ \ln(1+\sec^2\phi). \end{eqnarray*}$$ This integral is nontrivial.

Let us try a series approach and expand in small $\phi$. We find $$\begin{eqnarray*} I &=& 6\pi \ln 2 + 24\int_0^{\pi/4}d \phi \ \left[\ln\left(1-\frac{1}{2}\sin^2\phi\right) - \ln(1-\sin^2\phi)\right] \\ &=& 6\pi \ln 2 + 12\sum_{k=1}^\infty \frac{1}{k}\left(1-\frac{1}{2^k}\right) B_{\frac{1}{2}} \left(k+\frac{1}{2},\frac{1}{2}\right) \end{eqnarray*}$$ where $B_x(a,b)$ is the incomplete beta function. The $k$th term of the sum goes like $1/k^{3/2}$. Notice that $6\pi \ln 2 \approx 13$ so the ``zeroeth'' term is already a pretty good approximation.

Mathematica gives a result that doesn't appear explicitly real, but it can be massaged into $$I = 24 \mathrm{Ti}_2(3-2\sqrt2) + 6\pi \tanh^{-1}\frac{2\sqrt2}{3} - 24 C,$$ where $\mathrm{Ti}_2(x)$ is the inverse tangent integral, with the series $$\mathrm{Ti}_2(x) = \sum_{k=1}^\infty (-1)^{k-1} \frac{x^{2k-1}}{(2k-1)^2},$$ and $C$ is the Catalan constant.

share|cite|improve this answer
Nice! Thank you. – hennes Mar 17 '12 at 11:57
@hennes: You're welcome. Glad to help. – user26872 Mar 17 '12 at 17:13

The set of limits corresponds to a sphere of radius $1$ ($x$ ranges from $-1$ to $+1$; $y$ ranges from $-1$ to $+1$; and $z$ ranges from $-1$ to $+1$). Therefore we successively integrate: w.r.t.theta between zero and $\pi$; w.r.t. phi between zero and $2\pi$; and w.r.t. $r$ bet. zero and $1$ (radius vector extends from the origin to $1$). Thus we get $4\pi$ for the answer.

share|cite|improve this answer
I think you're missing something. The volume [-1,1] x [-1,1] x [-1,1] describes a cube not a sphere. The sphere of radius 1 you refer to does for instance not include the point (1,1,1). – hennes Feb 23 '12 at 11:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.