[Math] How to integrate by parts in spherical coordinates

calculusintegrationspherical 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.

Best Answer

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.

Related Question