# Homework Help: Electric field due to a charge density.

1. Apr 25, 2012

### FLms

1. The problem statement, all variables and given/known data
Consider charge distribution $\rho = \frac{A}{r}$ with spherical symmetry, for $0 \leq r \leq R$, and $\rho = 0$ for $r > R$, and A is a constant. Find the Electric Field in all of space. Check your answer obtaining $\rho$ from your answer.

2. Relevant equations

Gauss's law:

$$\oint \mathbf{E} \cdot \mathbf{dS} = \frac{q_{enc}}{\epsilon_{0}}$$
or
$$\mathbf{\nabla} \cdot \mathbf{E} = \frac{\rho}{\epsilon_{0}}$$

3. The attempt at a solution

So, this should be pretty simple.

I should get the field using Gauss's law in it's integral form, since there is a spherical symmetry.

$$\mathbf{E} = \frac{q_{enc}}{4 \pi \epsilon_{0} R^{2}}$$

And then I find the $q$ by integrating the charge density:

$$q_{enc} = \iiint\limits_V \rho r^{2} sin(\theta) dr d\theta d\phi$$

$$V = \left\{ (r, \theta, \phi) | 0 \leq r \leq R, 0 \leq \theta \leq \pi, 0 \leq \phi \leq 2\pi\right\}$$

$$q_{enc} = \iiint\limits_V \frac{A}{r} r^{2} sin(\theta) dr d\theta d\phi$$

$$q_{enc} = 4 \pi A \int r dr$$

$$q_{enc} = 2 \pi A R^{2}$$

Substituting in the Electric field:

$$E = \frac{A}{2\epsilon_{0}}$$

But this has to be wrong.
By doing Gauss's law in the differential form, I got $\mathbf{\nabla} \cdot \mathbf{E} = 0$, instead of finding the charge density $\rho$.

Where am I going wrong here?

2. Apr 25, 2012

### Vipho

$\mathbf{E} = \frac{q_{enc}}{4 \pi \epsilon_{0} R^{2}}$

Is that really Electric Field in all of space? What're electric field inside and outside sphere?

Last edited: Apr 25, 2012
3. Apr 26, 2012

### FLms

Taking $r = a ; a < R$, I get:

$$q_{enc} = \iiint\limits_V \rho dV$$
$$q_{enc} = 4 \pi A \int r dr$$
$$q_{enc} = 2 \pi A a^{2}$$

More generally: $q_{enc} = 2 \pi A r^{2}$

And the total charge $Q_{tot}$ is $2 \pi A R^{2}$

So:

$$q_{enc} = \frac{Q_{tot} r^{2}}{R^{2}}$$

Now:

$$\oint \mathbf{E} \cdot \mathbf{dS} = \frac{q_{enc}}{\epsilon_{0}}$$
$$\mathbf{E} = \frac{q_{enc}}{4 \pi \epsilon_{0} r^{2}}$$
$$\mathbf{E} = \frac{Q_{tot} r^{2}}{4 \pi \epsilon_{0} r^{2} R^{2}}$$
$$\mathbf{E} = \frac{Q_{tot}}{4 \pi \epsilon_{0} R^{2}}$$

Still getting the same result here, and $\mathbf{\nabla} \cdot \mathbf{E}$ here still is zero, since $R$ is a constant.

For $r > R$:

$$q_{enc} = Q_{tot} = 2 \pi A R^{2}$$

$$\oint \mathbf{E} \cdot \mathbf{dS} = \frac{Q_{tot}}{\epsilon_{0}}$$
$$E 4 \pi r^{2} = \frac{2 \pi A R^{2}}{\epsilon_{0}}$$
$$E = \frac{A R^{2}}{2 \epsilon_{0} r^{2}}$$

I believe here I do have $\rho = 0$, because $\mathbf{\nabla} \cdot (\frac{\mathbf{r}}{r^{2}}) = 0$ everywhere, except the origin.

Shouldn't the EF outside the sphere behave like the EF of a point charge?

Last edited: Apr 26, 2012
4. Apr 26, 2012

### FLms

Anyone?

5. Apr 26, 2012

### Vipho

I think A must be zero, because at $r\rightarrow 0, \rho \rightarrow \infty$

6. Apr 26, 2012

### Mindscrape

A isn't zero, A=Q/(4pi(R^2/2)

The outside Efield does look like a point charge, check yourself. Also, div(1/r^2)=4pi delta(r), not 0.

The field inside is constant, but that doesn't mean it's divergenceless. Are you sure you're using spherical divergence formula?

7. Apr 26, 2012

### FLms

$\rho (\mathbf{r})$ isn't exactly defined at the origin; it explodes at the point $r = 0$.

So the integral would have to be from a small radius $a$ to a general radius $r \leq R$

Using this, I got:

$$q_{enc} = 2 \pi A (r^{2} - a^{2})$$

The total charge, however, still is $Q_{tot} = 2 \pi A R^{2}$

$$q_{enc} = \frac{Q_{tot}}{R^{2}} (r^{2} - a^{2})$$

$$\oint \mathbf{E} \cdot \mathbf{dS} = \frac{q_{enc}}{\epsilon_{0}}$$

$$E = \frac{Q_{tot}}{4 \pi \epsilon_{0} R^{2}} (1 - \frac{a^{2}}{r^{2}})$$

Calculating the divergence os $\mathbf{E}$, I got:

$$\mathbf{\nabla} \cdot \mathbf{E} = \frac{1}{r^{2}}\frac{\partial}{\partial r} (r^{2} \frac{Q_{tot}}{4 \pi \epsilon_{0} R^{2}} - \frac{Q_{tot} a^{2}}{4 \pi \epsilon_{0} R^{2}})$$

$$\mathbf{\nabla} \cdot \mathbf{E} = \frac{Q_{tot}}{2 \pi \epsilon_{0} R^{2} r}$$

Substituting $Q_{tot} = 2 \pi A R^{2}$

$$\mathbf{\nabla} \cdot \mathbf{E} = \frac{A}{\epsilon_{0} r} = \frac{\rho (\mathbf{r})}{\epsilon_{0}}$$

I got one last question: Is it possible to write $\rho (0) = 4 \pi A \delta (\mathbf{r})$?

Last edited: Apr 26, 2012
8. Apr 26, 2012

### FLms

Yes, I found out that I was miss calculating the Divergence of the Electric Field.
Too bad I was writing my other post while you answered it.
Thanks anyway.

By the way, about the Divergence of $\frac{\hat{r}}{r^2}$, it is equal to zero everywhere, except the origin. And in general form, it is written as $4 \pi \delta(\mathbf{r})$.
(Griffiths' "Itr. to Electrodynamics" section 1.5.3 and problem 1.16)

9. Apr 26, 2012

### Vipho

Oh, I think electric field inside sphere
$\mathbf{E}= E\hat{\mathbf{r}}=\frac{Q_{tot}}{4 \pi \epsilon_{0} R^{2}}\frac{\mathbf{r}}{r}$, ($\hat{\mathbf{r}}=\frac{\mathbf{r}}{r}$)
Hence,
$\mathbf{\nabla}\cdot \mathbf{E}= \frac{Q_{tot}}{4 \pi \epsilon_{0} R^{2}}\mathbf{\nabla}( \frac{\mathbf{r}}{r})$
So
$\mathbf{\nabla}\cdot (\frac{\mathbf{r}}{r})=\frac{2}{r}$ and $Q_{tot} = 2 \pi A R^{2}$
So, we have
$\mathbf{\nabla}\cdot \mathbf{E}= \frac{Q_{tot}}{4 \pi \epsilon_{0} R^{2}} \frac{2}{r}=\frac{A}{\epsilon_{0}r}=\frac{\rho}{ \epsilon_{0}}$

Last edited: Apr 26, 2012
10. Apr 26, 2012

### Staff: Mentor

The electric field for r < R is E =(A/2ε0) ir

The electric field for r > R isE =(A/2ε0) (R2/r2)ir

In spherical coordinates, the divergence of E is A/(rε0) for r < R and 0 for r > R.