TITLE: Show that $\nabla\cdot\left(\dfrac{\mathbf{e}_r}{r^2}\right)=4\pi\delta(\mathbf{r})$ using the divergence theorem.
QUESTION [6 upvotes]: The book answer goes as follows:

By the divergence theorem, in spherical coordinates we find $$\color{red}{\iiint_\limits{\large\text{volume}\,\tau}\nabla\cdot\left(\dfrac{\mathbf{e}_r}{r^2}\right)\mathrm{d}\tau}=\color{blue}{\iint_\limits{\large\text{surface enclosing}\, \tau}\dfrac{\mathbf{e}_r}{r^2}\cdot\mathbf{e}_r\,\mathrm{d}\sigma}=\color{#180}{\int_{\phi=0}^{2\pi}\int_{\theta=0}^{\pi}\frac{1}{r^2}r^2\sin\theta\,\mathrm{d}\theta\,\mathrm{d}\phi}=4\pi$$ Thus $\nabla\cdot\left(\dfrac{\mathbf{e}_r}{r^2}\right)$ has the properties that it is zero $\forall\,r\gt 0$ but its integral over any volume including the origin is $4\pi$; this suggests that it is equal to $4\pi\delta(\mathbf{r})$.

As mentioned in a comment below; $\mathbf{e}_r$ is a unit radial vector.
I know that the $\color{red}{\mathrm{red}}$ and $\color{blue}{\mathrm{blue}}$ integrals are a statement of the divergence theorem. The only thing I can't understand is how the $\color{#180}{\mathrm{green}}$ integral was obtained from the $\color{blue}{\mathrm{blue}}$ integral.
I know that $$\mathrm{d}\sigma=\left|\frac{\partial  r}{\partial \theta}\times\frac{\partial r}{\partial \phi}\right|\,\mathrm{d}\theta\,\mathrm{d}\phi\tag{1}$$ I think that equation $(1)$ has been used but I'm not sure how to use it. Could someone please explain how the $\color{#180}{\mathrm{green}}$ integral was reached?

REPLY [2 votes]: A note on what I think to be a misleading trend in some texts, where I have recently stumbled.
As a proper Riemann integral, $$\iiint_{\tau}\nabla\cdot\left(\frac{\mathbf{e}_r}{r^2}\right)d\tau$$ where $\frac{\mathbf{e}_r}{r^2}=\frac{\mathbf{x}-\mathbf{y}}{\|\mathbf{x}-\mathbf{y}\|^3}$ (it seems that $\mathbf{y}=\mathbf{0}$ in your case), is $0$ if $\mathbf{y}\notin\bar{\tau}$ and does not exist if $\mathbf{y}\in\bar{\tau}$, because the integrand of a Riemann integral, in the usual calculus definitions of it, has to be defined on all the domain.
As the limit $$\lim_{\varepsilon\to 0}\iiint_{\tau\setminus B(\mathbf{y},\varepsilon)}\nabla\cdot\left(\frac{\mathbf{x}-\mathbf{y}}{\|\mathbf{x}-\mathbf{y}\|^3}\right)dx_1dx_2dx_3$$ it is $0$ because $\lim_{\varepsilon\to 0}0=0$ and the same holds for the Lebesgue integral $$\int_{\tau}\nabla\cdot\left(\frac{\mathbf{x}-\mathbf{y}}{\|\mathbf{x}-\mathbf{y}\|^3}\right)d\mu_{\mathbf{x}}$$which is calculated as the preceding limit.
This shows that, under these definitions of the integral and the usual definition of the derivative, the divergence theorem, certainly valid if, instead of $\frac{\mathbf{e}_r}{r^2}$ you had a vector field $\mathbf{F}\in C^1(\mathring{A})$ with $\tau\subset\mathring{A}$ satisfying opportune assumptions, cannot be applied.
Since $\forall\mathbf{x}\in\mathbb{R}^3\setminus\{\mathbf{y}\}\quad\frac{\mathbf{x}-\mathbf{y}}{\|\mathbf{x}-\mathbf{y}\|^3}=-\nabla\left(\frac{1}{\|\mathbf{x}-\mathbf{y}\|}\right)$ and the divergence of the gradient is the Laplacian $\nabla\cdot\nabla=\nabla^2$, we see that $\nabla\cdot\left(\frac{\mathbf{x}-\mathbf{y}}{\|\mathbf{x}-\mathbf{y}\|^3}\right)=-\nabla^2\left(\frac{1}{\|\mathbf{x}-\mathbf{y}\|}\right)$. Then by reading the integral $$\int_{\tau}-\nabla^2\left(\frac{1}{r}\right)\varphi \,d\tau$$ where $\varphi\in C^2(\mathbb{R}^3)$ (typically $\varphi\in C^\infty(\mathbb{R}^3)$) is such that $\forall\mathbf{x}\notin\tau\quad\varphi(\mathbf{x})=0$, in the symbolic way of the Laplacian of the distribution defined by $-\frac{1}{r}$, it can be shown, as it is here, that $-\int_{\tau}\nabla^2\left(\frac{1}{r}\right)\varphi \,d\tau=4\pi\int_{\tau}\delta_{\mathbf{y}}\varphi \,d\tau:=4\pi\varphi(\mathbf{y})$ (where $\delta_{\mathbf{y}}(\mathbf{x}):=\delta(\mathbf{x}-\mathbf{y})$), but that is$$\lim_{\varepsilon\to 0}\iiint_{\tau\setminus B(\mathbf{y},\varepsilon)}\frac{-\nabla^2\varphi(\mathbf{x})}{\|\mathbf{x}-\mathbf{y}\|}dx_1dx_2dx_3=\int_{\tau}\frac{-\nabla^2\varphi(\mathbf{x})}{\|\mathbf{x}-\mathbf{y}\|}d\mu_{\mathbf{x}}$$if we use the usual Riemann (one th left) or Lebesgue (on the right) integrals, while $$\lim_{\varepsilon\to 0}\iiint_{\tau\setminus B(\mathbf{y},\varepsilon)}\nabla\cdot\left(\frac{\mathbf{x}-\mathbf{y}}{\|\mathbf{x}-\mathbf{y}\|^3}\right)\varphi(\mathbf{x})dx_1dx_2dx_3=\int_{\tau}\nabla\cdot\left(\frac{\mathbf{x}-\mathbf{y}}{\|\mathbf{x}-\mathbf{y}\|^3}\right)\varphi(\mathbf{x})d\mu_{\mathbf{x}}\equiv 0$$for all $\mathbf{y}$ and all functions $\varphi$.