Determining charge distribution from electric field (Griffiths 4th)

I am trying to teach myself Electrodynamics by following Griffiths' book. This is probably what's considered a "homework question", but as I don't have an instructor to ask for help, I'm hoping someone here can do so. If this is really not permitted here, please close this with my apologies

Griffiths Introduction to Electrodynamics 4th Ed Problem 2.50 asks to compute the electric field and then the charge distribution based on a potential $V(r)=A \frac{e^{-\lambda r}}{r}$.

I found the electric field: $$E=\frac{Ae^{-\lambda r}(1+\lambda r)}{r^2}\hat r$$ without too much trouble. To get the charge distribution from the electric field one applies Gauss' law in differential form:

$$\rho=\epsilon _0 \nabla \cdot E$$ $$=\epsilon _0 \nabla \cdot \Biggl(\frac{Ae^{-\lambda r}(1+\lambda r)}{r^2}\hat r\Biggl)$$

Since $\nabla\cdot E$ in spherical coordinates is $\frac{1}{r^2}\frac{\partial}{\partial r}r^2E_r + ... E_\theta + ... E_\phi$, and since E doesn't have theta or phi terms, I simply applied the formula, getting:

$$=\epsilon _0 \frac{1}{r^2}\frac{\partial}{\partial r}\Biggl(r^2 \frac{Ae^{-\lambda r}(1+\lambda r)}{r^2}\Biggl)$$

The $r^2$ cancels and moving A outside the dericvative, I get: $$=\frac{A\epsilon _0}{r^2}\frac{\partial}{\partial r}(e^{-\lambda r})(1+\lambda r)$$ Running the derivative through Wolfram Alpha and rearranging gives: $$\rho=-\frac{A\epsilon _0}{r}(e^{-\lambda r})\lambda ^2$$

However, this isn't what the solution manual (or Chegg) had. Rather, instead of taking the divergence of E, they applied a product rule: $$=\epsilon _0 \Biggl(Ae^{-\lambda r}(1+\lambda r)\nabla \cdot \biggl( \frac{\hat r}{r^2}\biggl)+ \biggl( \frac{\hat r}{r^2}\biggl) \nabla \cdot (Ae^{-\lambda r}(1+\lambda r)) \Biggl)$$ and proceeded from there to get $$\rho=A \epsilon_0 \Biggl(4 \pi \delta^3(r)-\frac{\lambda^2}{r}e^{-\lambda r} \Biggl)$$

I can see what they did, and can follow the computation, but I don't understand why my method was incorrect. Can anyone explain where I erred?

Thank you!

• You dropped a minus sign in E. – my2cts Jul 12 '18 at 20:13
• You can't use the normal divergence formula for the divergence of $\frac{\hat{r}}{r^2}$, as the function has a singularity at zero. See physics.stackexchange.com/questions/20604/… – probably_someone Jul 12 '18 at 20:14

You went wrong in cancelling out the $r^2$. This works only if $r\neq 0$. But at $r=0$, the interesting stuff is happening, as the field diverges and is not well defined there. Taking the divergence will actually result in a term with a delta spike, like derived in what you showed.
This is the equivalent of the Coulomb potential for massive electromagnetism. Gauss's law takes a different form for this case, something like $\Delta V + m^2 V = \rho / \epsilon_0$. (No guarantees on the signs).