# How to integrate by parts in spherical coordinates

I'm running into some troubles with the integration of a spherically symmetric 3D function. I'm having the following expression to evaluate : $$I=\int_0^{2\pi} d\phi \int_0^\pi \sin\theta d\theta\int_0^\infty \frac{\partial f}{\partial r} r^2 dr$$

where the generic function $f$ only depends on the radius $r$. If I where in Cartesian coordinates, there wouldn't be any $r^2$ term and the integral would be 0 provided that $f$ vanishes at infinity (which is ok).

Now, in spherical coordinates, this does not seem to be true. If I integrate first over the angles, I get a factor $4\pi$ in front of the radial integral. I can then integrate by parts to remove the partial derivative and I obtain : $$I=-8\pi\int_0^\infty f(r)r dr$$ as the boundary terms vanish if $f(r) \rightarrow 0$.

At first sight, this seems to be correct. However, when looking at the definition of integration by parts in $R^n$:

$$\int_{\Omega} \frac{\partial u}{\partial x_i} v \,d\Omega = \int_{\Gamma} u v \, \nu_i \,d\Gamma - \int_{\Omega} u \frac{\partial v}{\partial x_i} \, d\Omega$$

Where $\nu_i$ is a unit vector on $\Gamma$ the boundary of $\Omega$. My previous computation does not seem to be right. The $r^2$ term is part of the integration measure $d\Omega$ and should thus not be taken into account for the "derivative-swap". This would mean that my first integral is $0$ for all functions $f$ that behave nicely and vanish sufficiently fast as $\rightarrow\infty$. $$I= \left| f(r) r^2 \right|_{r=0}^{r=\infty} = 0$$

Which (if any) of the two version is correct ?

Do you know any good reference on integration by parts in non-cartesian coordinates.

-
Your first version seems to be correct for me (with taking Tim's remark into account). But I dont understand your second version. However try to look at these key words : Stock' formula, Green-Ostrogradsky formula, divergence (these are the generalisation of the integration by part in $R^n$ ($n \geq 2$)). – user10676 May 23 '11 at 13:21
Thanks for your comment. The first version uses integration by part on the real line. The second version is exactly Ostrogradsky formula in $R^n$ if you take the divergence of $uv$. My concern is that both formula do not lead to the same result. – Nanoc May 24 '11 at 6:39
Are you still looking for some more information about this Nanoc? If you could explain what is sill missing for you, perhaps I could help. – Glen Wheeler Jun 2 '11 at 19:42

The "integration by parts" formula you cited applies to an integral over a 2D surface, this does not apply to an integral of a function over $\mathbb{R}^3$. Your integral $I$ is as simple as it looks, the integration over $r$ is just an ordinary one-dimensional integral over $[0, \infty)$, the fact that you got there by using polar coordinates does not matter.
You can apply the integration by parts formula as you did. (For the boundary terms to vanish you actually need $r^2 f(r)$ to be zero for $r=0$ and for $r \to \infty$.)
BTW: If the original problem is about integrating a function that does depend on $r$ only, then there is a $sin(\theta)$ missing in your formula for $I$, from the Jacobian of the transformation of 3D cartesian coordinates to 3D spherical coordinates.
Thanks for your answer. The $\sin\theta$ is missing. Mmmh. But that does sound quite contradictory. You tell me that both my formula are correct. Does this mean that integrating any derivative with respect to the radius of a radial function gives 0. At least if $r^2f(r) \rightarrow 0$ at the boundaries ? Even if I cannot find a counter-exemple, this does not sound right to me. – Nanoc May 23 '11 at 11:36