The electric potential of some configuration is given by the expression
\[V(\mathbf{r})=A\frac{e^{-\lambda r}}{r} \]Where $A $ and $\lambda $ are constants. Find the electric field $\mathbf{E}(\mathbf{r}) $, the charge density $\rho (r) $, and the total charge $Q $.
Start by recalling that
\[\mathbf{E}=-\nabla V \]Using the spherical gradient, it is clear that
\begin{align*} \mathbf{E} &= -A\frac{\partial }{\partial r} \left( \frac{e^{-\lambda r}}{r} \right) \hat{\mathbf{r}} \\ &= A\frac{e^{-\lambda r}}{r^2 }(r\lambda +1)\hat{\mathbf{r}} \end{align*}To find $\rho $, we recall
\[\rho =\epsilon _0 \nabla \cdot \mathbf{E} \]To calculate such divergence, we need to recall two things:
1. Product rule.
\[\nabla \cdot (f\mathbf{v})=\nabla (f)\cdot \mathbf{v}+f(\nabla \cdot \mathbf{v}) \]2. The special case of the divergence of $1/r^2 $.
\[\nabla \cdot \left( \frac{\hat{\mathbf{r}}}{r^2 } \right) =4\pi \delta ^3 (\mathbf{r}) \]With that in mind, we proceed:
\begin{align*} \rho &= \epsilon _0\nabla \cdot \left( A\frac{e^{-\lambda r}}{r^2 }(r\lambda +1)\hat{\mathbf{r}} \right) \\ &= \epsilon A \left( e^{-\lambda r}(r\lambda +1)\nabla \cdot \left( \frac{\hat{\mathbf{r}}}{r^2 } \right) + \left( \frac{\hat{\mathbf{r}}}{r^2 } \right) \cdot \nabla (e^{-\lambda r}(r\lambda +1)) \right) \\ &= \epsilon _0 A \left( 4\pi \delta ^3 (\mathbf{r})-\frac{\lambda ^2 }{r}e^{-\lambda r} \right) \end{align*} To get the charge, we integrate \begin{align*} Q &= \int \rho d\tau \\ &= \epsilon _0 A\int 4\pi \delta ^3 (\mathbf{r})d\tau -\epsilon _0 A\lambda ^2 \int \frac{e^{-\lambda r}}{r}d\tau \\ &= \epsilon _0 A4\pi -\epsilon _0 A\lambda ^2 \int_{\phi =0}^{2\pi } \int_{\theta =0}^{\pi } \int_{r=0}^{\infty } \frac{e^{-\lambda r}}{r}r^2 \sin \left( \theta \right) drd\theta d\phi \\ &= \epsilon _0 A4\pi -\epsilon _0 A\lambda ^2 4\pi \int_{0}^{\infty } re^{-\lambda r}dr\\ &= \epsilon _0 A4\pi -\epsilon _0 A\lambda ^2 4\pi \frac{1}{\lambda ^2 }\\ &= 0 \end{align*}