Evaluate the integral
\[J=\int _{\mathcal{V}}e^{-r} \left( \nabla \cdot \frac{\hat{\mathbf{r}}}{r^2 } \right) d\tau \]Where $\mathcal{V} $ is a sphere of radius $R $, centered at the origin by two different methods (see Example 1.16)
As suggested by example 1.16 (page 49), there are two ways to solve this problem.
1. Short way: Using the Dirac Delta
Let's start by recalling
\[\nabla \cdot \left( \frac{\hat{\mathbf{r}} }{r^2 } \right) =4\pi \delta ^3(\mathbf{r}) \tag{Eq. 1.99, page 48}\]Let's use this formula on the integrand:
\begin{align*} J &= \int _{\mathcal{V}}e^{-r} \left( \nabla \cdot \frac{\hat{\mathbf{r}}}{r^2 } \right) d\tau \\ &= \int _{\mathcal{V}}e^{-r}(4\pi \delta ^3 (\mathbf{r}))d\tau \end{align*}To evaluate this, we recall:
\[\int f(\mathbf{r})\delta ^3 (\mathbf{r}-\mathbf{a})d\tau =f(\mathbf{a})\tag{Eq. 1.98, page 48} \]So
\begin{align*} J &= \int _{\mathcal{V}}e^{-r}(4\pi \delta ^3 (\mathbf{r}))d\tau \\ &= 4\pi\int _{\mathcal{V}}e^{-r} \delta ^3 (\mathbf{r})d\tau \\ &= 4\pi e^{-r}\Big|_{r=0} \\ &= 4\pi \end{align*}2. Long way: Integration by parts
Let's start by recalling
\[\int _{\mathcal{V}}f\cdot (\nabla \cdot \mathbf{A})d\tau =-\int _{\mathcal{V}}\mathbf{A}\cdot \nabla f\;d\tau +\oint _{\mathcal{S}} f\mathbf{A}\cdot d\mathbf{a} \tag{Eq. 1.59, page 36} \]That is, we will transfer $\nabla $ from the vector function $\hat{\mathbf{r}}/r^2 $ to the scalar function $e^{-r} $. This will avoid the use of the Dirac Delta, but it picks up a new term (a surface integral)!
In our current problem:
\begin{align*} f &= e^{-r} \\ \mathbf{A} &= \frac{\hat{\mathbf{r}}}{r^2 } \end{align*}To compute the integral, let's remind ourselves the required integration elements:
\begin{align*} d\tau &= r^2 \sin \left( \theta \right) dr d\theta d\phi \tag{As seen on the cover of your book} \\ d\mathbf{a} &= R^2 \sin \left( \theta \right) d\theta d\phi \hat{\mathbf{r}}\tag{At constant radius} \end{align*}Important remark: The vector area element won't always be that one. See page 39 for more information.
To calculate the volume integral we will need the gradient of $f=e^{-r} $. We recall that in spherical coordinates:
\[\nabla f= \frac{\partial f}{\partial r}\hat{\mathbf{r}} +\frac{1}{r}\frac{\partial f}{\partial \theta }\hat{\theta } + \frac{1 }{r \sin \theta }\frac{\partial f}{\partial \phi }\hat{\phi } \tag{As seen on the cover of your book} \]It is clear that the last 2 terms vanish, and we are left with
\[\nabla f= -e^{-r}\hat{\mathbf{r}}\]We are now ready to evaluate the integral $J $:
\begin{align*} J &= \int _{\mathcal{V}}e^{-r} \left( \nabla \cdot \frac{\hat{\mathbf{r}}}{r^2 } \right) d\tau \\ &= -\int _{\mathcal{V}} \left( \frac{\hat{\mathbf{r}}}{r^2 } \right) \cdot \left( -e^{-r}\hat{\mathbf{r}} \right) d\tau +\oint _{\mathcal{S}}e^{-r} \left( \frac{\hat{\mathbf{r}}}{r^2 } \right) \cdot d\mathbf{a} \\ &= \int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi } \int_{r=0}^{R} \frac{e^{-r}}{\cancel{r^2} }(\cancel{r^2 }\sin \left( \theta \right) )drd\theta d\phi + \int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi } \frac{e^{-R}\cancel{R^2} }{\cancel{R^2} }\sin \left( \theta \right) d\theta d\phi \\ &= \int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi } \int_{r=0}^{R}e^{-r}\sin \left( \theta \right) drd\theta d\phi +e^{-R}\int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi }\sin \left( \theta \right) d\theta d\phi \\ &= \int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi } \left( 1-e^{-R} \right) \sin \left( \theta \right) d\theta d\phi +e^{-R}\int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi }\sin \left( \theta \right) d\theta d\phi \\ &= \int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi }\sin \left( \theta \right) d\theta d\phi - \cancel{e^{-R}\int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi }\sin \left( \theta \right) d\theta d\phi} +\cancel{e^{-R}\int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi }\sin \left( \theta \right) d\theta d\phi} \\ &= \int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi }\sin \left( \theta \right) d\theta d\phi\\ &= \int_{\phi =0}^{2\pi }2d\phi \\ &= 4\pi \end{align*} We get (as expected) the same answer as with method 1. Still, method 2 took considerably more steps than the first.