# Gauss's Law (Differential Form)

1. Mar 26, 2015

### roam

1. The problem statement, all variables and given/known data

Find the electric field inside and outside a sphere of radius R using the differential form of Gauss's law. Then find the electrostatic potential using Poisson's equation.

Charge density of the sphere varies as $\rho (r) = \alpha r^2 \ (r<R)$ and $\rho(r)=0 \ elsewhere$.

2. Relevant equations

$\nabla . E = \frac{\rho}{\epsilon_0}$

$\nabla^2 \phi = - \frac{\rho}{\epsilon_0}$ (Poisson)

3. The attempt at a solution

I'm confused since using the differential form seems redundant, because you must first find the electric field using the integral form (unless I'm mistaken). Here's my attempt:

For inside the sphere ($r<R$) the charge enclosed is:

$Q=\rho V = \alpha r^2 . \frac{4}{3} \pi r^3 = \frac{4\alpha r^5 \pi}{3}$​

Divergence of the field in spherical coordinates is:

$\nabla . \vec{E} = \frac{1}{r^2} \frac{\partial}{\partial r} (r^2 E_r) + \frac{1}{r sin \theta} \frac{\partial}{\partial \theta} (sin \theta E_\theta) + \frac{1}{r sin \phi} \frac{\partial}{\partial \phi}$

Since no change in $\theta$ and $\phi$ we can just take the first term:

$\nabla . \vec{E} = \frac{1}{r^2} \frac{\partial}{\partial r} (r^2 E_r)$

Now finding $E_r$

$|E_r| \oint da = |E_r| 4 \pi r^2 = \frac{4 \alpha r^5 \pi}{3 \epsilon_0}$

$E_r = \frac{\alpha r^3}{3 \epsilon_0}$

So substituting back:

$\nabla . \vec{E} = \frac{1}{r^2} \frac{\partial}{\partial r} (r^2 \frac{\alpha r^3}{3 \epsilon_0})$

$=\frac{\alpha}{3 \epsilon_0} \frac{\partial}{\partial r} r^3 = \frac{\alpha r^2}{\epsilon_0}= \frac{\rho(r)}{\epsilon_0}$

Now integrating we get:

$\int(\nabla. E) dr=\int \frac{\alpha r^2}{\epsilon_0} dr = \frac{\alpha r^3}{3 \epsilon_0} + C$

So it's the same answer as using the integral form of Gauss's law. So what is the point of using the differential form?

Now using Poisson's equation:

$\nabla^2 \phi = - \frac{\rho}{\epsilon_0} = - \frac{\alpha r^2}{\epsilon_0}$

I think I must take a double integral:

$\int \int - \frac{\alpha r^2}{\epsilon_0} dr dr$

$\frac{-\alpha}{\epsilon_0} \int (\frac{r^3}{3} + C) dr$

$\phi = \frac{-\alpha}{\epsilon_0} (\frac{r^4}{12}+Cr+B)$

Is this right? And what I should I do about the constants?

And when we are outside the sphere (r>R), with $\rho=0$ we will have $Q=(0)V=0$. Therefore both the electric field and $\phi$ will be zero?

Any help would be greatly appreciated.

#### Attached Files:

• ###### density.jpg
File size:
14.1 KB
Views:
123
2. Mar 26, 2015

### vela

Staff Emeritus
This isn't correct. $Q=\rho V$ only works if you have a constant charge density. Because the density varies in this problem, you have to integrate to find the charge enclosed. But you don't need that here.

The differential form of Gauss's Law is $\nabla \cdot \vec{E} = \rho$. You have expressions for both sides. Just substitute them in to get a differential equation you have to solve. You're going to integrate, but you're not using the integral form of Gauss's law.

3. Mar 27, 2015

### roam

Thank you for the reply. But should it not be $\nabla \cdot \vec{E} = \rho / \epsilon_0$ (divided by the permittivity of free space)? This is what I did:

$\nabla \cdot \vec{E} = \frac{\rho}{\epsilon_0} = \frac{\alpha r^2}{\epsilon_0}$

$\int \nabla \cdot \vec{E} = \int \frac{\alpha r^2}{\epsilon_0} \implies \vec{E} = \frac{\alpha r^3}{3\epsilon_0}$​

Is this right? For the potential I used Poisson's equation:

$\nabla^2 \phi = - \frac{\rho}{\epsilon_0} \implies \phi= \int \int \frac{- \alpha r^2}{\epsilon_0} dr dr = -\frac{\alpha}{\epsilon_0} (\frac{r^4}{12} + Cr + B)$

I tried to check if the answer is correct by taking the gradient of the potential (since $- \nabla \phi = \vec{E}$), but it seems it is not. What was the mistake?

So for the case $r>R$ do I need to integrate to find $Q_{enc}$?

$dQ= \rho dV = \rho 4 \pi r^2 dr = 4 \pi \alpha \int^R_0 r^4 dr$

$= \frac{4 \pi \alpha}{5} [r^5]^R_0 \implies Q= \frac{4 \pi \alpha R^5}{5}$​

The new density (a distance r away) would be:

$\rho'=Q.V'= \frac{4 \pi \alpha R^5}{5}. \frac{4\pi r^3}{3} = \frac{16 \pi^2 r^3 \alpha R^5}{15}$​

Hence the electric field is:

$\int \nabla \cdot \vec{E} dr = \int \frac{16 \pi^2 r^3 \alpha R^5}{15 \epsilon_0} dr$

$\therefore \vec{E} = \frac{16 \pi^2 r^4 \alpha R^5}{60 \epsilon_0} + C$

Is that right? And what sort of boundry conditions do we need to make the constant equal zero?

Last edited: Mar 27, 2015
4. Mar 27, 2015

### vela

Staff Emeritus
Yes, sorry. I'm used to using units where you don't have to include the constant.

No. You've implied the electric field is radial, so you can write $\vec{E} = E_r \hat{r}$. As you said in your first post, $\nabla\cdot\vec E = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2E_r)$, so you get, for r<R,
$$\frac{1}{r^2}\frac{\partial}{\partial r}(r^2E_r) = \frac{\alpha r^2}{\epsilon_0}.$$ Solve that differential equation. You'll also have to treat the case where r>R.

5. Mar 27, 2015

### roam

Thank you. I'm not very familiar with differential equations. So this is what I've done:

$\frac{1}{r^2}\frac{\partial}{\partial r}(r^2E_r) = \frac{\rho}{\epsilon_0}$ or

$\frac{\partial}{\partial r}(r^2E_r) = \frac{\rho r^2}{\epsilon_0}$​

Integrating both sides:

$r^2 |E_r| = \frac{\rho r^3}{3 \epsilon_0} + C_0$

$|E_r| = \frac{\rho r}{3 \epsilon_0} + \frac{C_0}{r^2}$​

Therefore:

$E_{inside} = \frac{\alpha r^3}{3 \epsilon_0} + \frac{C_0}{r^2}$

$E_{outside} = \frac{C_0}{r^2}$

Is this correct?

What should I do with the constant C0? Do I just need to say it is zero since $E (r \to \infty) =0$?

Also for the potential do I need to solve for $\phi$ in $\frac{1}{r^2} \frac{\partial}{\partial r} (r^2 \frac{\partial \phi}{\partial r}) = \frac{- \rho}{\epsilon_0}$?

6. Mar 28, 2015

### vela

Staff Emeritus
You didn't integrate correctly. Remember $\rho$ is a function of $r$.

7. Mar 28, 2015

### roam

My mistake, sorry. Thank you. This time before integrating I've substituted $\rho(r) = \alpha r^2$ and $0$ for r<R and r>R respectively.

$\frac{\partial}{\partial r} (r^2 E_r) = \frac{\alpha r^4}{\epsilon_0} \implies E_{in} = \frac{\alpha r^3}{5 \epsilon_0} + \frac{C_0}{r^2}$​

And:

$\frac{\partial}{\partial r} (r^2 E_r) = 0 \implies E_{out} = \frac{C_1}{r^2}$
Is this alright now? The second expression was obtained by the fact that he integral of zero is a constant. I think it makes sense since the field outside a charged sphere is NOT zero (as I've seen from other problems).

Now since the solution of Poisson's equation in spherical coordinates is:

$\nabla^2 \phi = \frac{1}{r^2} \frac{\partial}{\partial r} (r^2 \frac{\partial \phi}{\partial r})$​

I calculated the potentials by writting $\nabla^2 \phi = \rho(r) / \epsilon_0$ (for instance for r<R I got $\phi = - \frac{\alpha r^4}{20 \epsilon_0} - \frac{C_0}{r}$). Then I took their gradients and got back the electric field, so I believe the solutions are correct.

But what do we typically do with the constants?

Last edited: Mar 28, 2015
8. Mar 28, 2015

### vela

Staff Emeritus
Looks good so far. To figure out what $C_0$ is, take the limit of $E_\text{in}$ as $r \to 0$. There's no point charge at the origin, so we require that the electric field remain finite. This can only happen if $C_0 = 0$. To determine $C_1$, require that $E_\text{in} = E_\text{out}$ at $r=R$ because there's no surface charge density to cause a discontinuity in the electric field.

Another way to deal with the constants is to use definite integrals to avoid them in the first place. So for the electric field inside the sphere, you'd have
$$\int_0^r \frac{\partial}{\partial r}(r^2 E_r)\,dr = \int_0^r \frac{\alpha r^4}{\epsilon_0}.$$ Similarly, for outside the sphere, you'd have
$$\int_R^r \frac{\partial}{\partial r}(r^2 E_r)\,dr = \int_R^r 0\,dr = 0.$$ Again, use the fact that $E_\text{in}(R) = E_\text{out}(R)$ at the boundary.

9. Mar 29, 2015

### roam

Thank you so much for the help. It makes perfect sense now. :)