# Calculating the divergence of electric field using the definition of divergence.

If I try to calculate the divergence of electric field created by a point charge at the origin then I shall do something like this:

$$\displaystyle \mathbf{E}= \frac{1} {4\pi\epsilon_0} \frac{q}{r^2} \hat r$$

$$\displaystyle \mathbf{\nabla} \cdot \mathbf{E} = \frac{1}{r^2} ~ \frac{\partial (r^2E_r)}{\partial r} + \frac{1}{rsin\theta} ~ \frac{\partial (E_{\theta}sin\theta)}{\partial{\theta}} + \frac{1}{rsin\theta} \frac{\partial E_{\phi}}{\partial{\phi}}$$

$$\displaystyle E_{\theta} ~and~ E_{\phi}$$ will be zero and $$\displaystyle r^2 E_r = \frac{1}{4\pi\epsilon_0}q$$

$$\displaystyle \mathbf{\nabla} \cdot \mathbf{E} = \frac{1}{r^2} \frac{\partial kq}{\partial r}~~~~~~~~~~~~~~~~~~~~~~~~~~~, k= \frac{1}{4\pi\epsilon_0}$$

The derivative of a constant is zero and therefore

$$\displaystyle \mathbf{\nabla} \cdot \mathbf{E} = 0$$

But I have studied that $$\displaystyle \nabla \cdot \mathbf{E} = \frac{\rho}{\epsilon_0}$$. Why there is a discrepancy? I have worked out the divergence from the it's very definition.

#### topsquark

Forum Staff
If I try to calculate the divergence of electric field created by a point charge at the origin then I shall do something like this:

$$\displaystyle \mathbf{E}= \frac{1} {4\pi\epsilon_0} \frac{q}{r^2} \hat r$$

$$\displaystyle \mathbf{\nabla} \cdot \mathbf{E} = \frac{1}{r^2} ~ \frac{\partial (r^2E_r)}{\partial r} + \frac{1}{rsin\theta} ~ \frac{\partial (E_{\theta}sin\theta)}{\partial{\theta}} + \frac{1}{rsin\theta} \frac{\partial E_{\phi}}{\partial{\phi}}$$

$$\displaystyle E_{\theta} ~and~ E_{\phi}$$ will be zero and $$\displaystyle r^2 E_r = \frac{1}{4\pi\epsilon_0}q$$

$$\displaystyle \mathbf{\nabla} \cdot \mathbf{E} = \frac{1}{r^2} \frac{\partial kq}{\partial r}~~~~~~~~~~~~~~~~~~~~~~~~~~~, k= \frac{1}{4\pi\epsilon_0}$$

The derivative of a constant is zero and therefore

$$\displaystyle \mathbf{\nabla} \cdot \mathbf{E} = 0$$

But I have studied that $$\displaystyle \nabla \cdot \mathbf{E} = \frac{\rho}{\epsilon_0}$$. Why there is a discrepancy? I have worked out the divergence from the it's very definition.
I don't have much time to look up how to find the answer, but consider that you are working with a term: $$\displaystyle \dfrac{k}{r^2} \dfrac{d q}{d r}$$. You have a problem at r = 0: That's where the charge is and we're also working with $$\displaystyle 1/r^2$$, which can't strictly be taken at r = 0. Essentially your charge distribution is $$\displaystyle \rho = 4 \pi \delta (r)$$, where $$\displaystyle \delta (r)$$ is the Dirac delta function.

See if that will get you started.

-Dan

1 person

You are saying $$\displaystyle \frac{\partial q}{\partial r}$$ can not be taken to be zero because with $$\displaystyle r$$ the charge $$\displaystyle q$$ is changing, it's zero everywhere but q at the center. I quite getting you but can you please help just a little more? I mean what's the problem with that derivative, $$\displaystyle \frac{\partial q}{\partial r}$$.

Last edited:

#### topsquark

Forum Staff
Yeah, this took a while. Again my apologies.

Whilst I was working on this I kept going in circles as to what needs to be derived in what way and where. I did do some web digging and I feel the following should work out for you. If not, let me know.

Divergence. Go down to the section that saya "You must use the Dirac $$\displaystyle \delta$$ function and its properites." The whole thing is there step by step.

-Dan

1 person

Now, to give the real happiness: I have understood my doubt, the problem is that $$\displaystyle \frac{\partial q}{\partial r}$$ isn't simply zero, the graph of charge vs distance from center has been attached (I have made curvature near the zero just to make more visible). In the figure $$\displaystyle Q$$ is zero everywhere but at $$\displaystyle r=0$$ it's value is $$\displaystyle q$$ and hence we have got special kind of step function whose derivative can't found by elementary definition of derivatives.