# Calculating the E-Field inside and outside a sphere.

#### Alex_Neof

1. Homework Statement
Consider a sphere of radius $R$, with a charge density $\rho(r)=\frac{\alpha} {r^2},$ with $\alpha$ a constant. Use Gauss' law to calculate the electric field outside the sphere at a distance $r$ from the sphere's centre (ie. $(r > R)$ and inside the sphere (ie. $(r > R).$ Plot the magnitude of the electric field for both inside and outside the sphere.

2. Homework Equations

Gauss' Law:

$\int\vec E.d\vec A=\frac {q_{encl}} {\epsilon_0}.$

3. The Attempt at a Solution

For the first part outside the sphere $(r > R),$

I calculated the enclosed charge as follows:

$\frac {\alpha} {R^2}\times \frac {4} {3} \pi R^3.$

Now using a Gaussian surface (sphere) of radius $r$ enclosing this charge,

$\Rightarrow E = \frac{R\alpha} {3\epsilon_0 r^2}.$

For the second part inside the sphere $(r < R),$

The enclosed charge now is:

$\frac {\alpha} {r^2}\times \frac {4} {3} \pi r^3.$

Using another Gaussian surface (sphere) inside, with radius $r$,

$\Rightarrow E = \frac{\alpha} {3\epsilon_0 r}.$

When I draw the graph, the magnitude of the E-field continues to decay with distance, but increasingly outside the sphere. Is this correct?

Related Introductory Physics Homework Help News on Phys.org

#### MarcusAgrippa

Gold Member
The density is not constant. Your total charge is incorrect. Rethink this problem.

In fact, you repeat the error in the second part. I think you need to reread your textbook or your class notes before attempting the problem and before posting on this forum. We are here to help you with difficulties, and not to repeat lectures to you.

• Alex_Neof

#### BvU

Homework Helper
Well now, MA is playing bad cop here. In spite of his (borrowed) grim appearance he's a really good guy, so pay attention to his remarks (very correct ones) and suggestions (also very valuable advice).

Let me play the good cop (I've been young too), so let's make a deal: you follow MA's suggestion, you also check out hyperphysics to see if you can follow the simpler case of a charged sphere with uniform charge distribution, and then we move on to the exercise at hand.

The world is tough and MA is absolutely right, so subsequently the first step will be to find the enclosed charge as a function of r.

• Alex_Neof and SammyS

#### Alex_Neof

Thank you for the feedback guys. Here is my reasoning:

When it said "Consider a sphere of radius $R$, with a charge density $\rho(r) = \frac{\alpha} {r^2}$" I assumed that the maximum charge the sphere could have is $\rho(R) \times volume$, reason being the maximum space or volume the sphere takes is $\frac {4} {3} \pi R^3$. Thus the maximum total charge the sphere can have is $\frac {4} {3} \pi R \alpha$. So no matter what distance you are away and outside of the sphere of radius $R$, its total charge is constant.

Now using Gauss' law, I obtained the magnitude of the electric field as a function of $r$ to be $E=\frac{R\alpha} {3\epsilon_0 r^2}$, this expression being for the E-field outside the sphere.

For the second bit (inside the sphere):

The bit where I was definitely wrong was when I calculated the charge enclosed inside of the sphere, I used $\rho(r) = \frac{\alpha} {r^2}$. I understand the density is not constant, and that it changes inside the sphere, but outside the density is at its maximum and thus is constant outside. Using the hyperphysics link provided by BvU, I came across:

The charge inside the sphere of radius $R$, is equal to the ratio of the of the Gaussian sphere inside (of radius $r$) and the volume of the sphere of radius $R$. Which leads to this equation:

$Q'=Q\frac{r^3} {R^3}$.

Using this, I obtained an expression for the magnitude of the E-field inside the sphere to be:

$E=(\frac{\alpha}{3R^2\epsilon_0})r$.

Which makes sense, as the E-field should increase as the radius increases from $0$ to $R$ as the charge enclosed increases from $0$ to $R$. According to the expression for the E-field inside the sphere, this increases linearly. Once outside of the sphere, the E-field decrease exponentially as expected, similar to point charges with the $\frac{1}{r^2}$.

Also when I plug in $r=R$ into both expressions for the E-fields they are equal, which should be a good sign ?

#### BvU

Homework Helper
Oh, boy, now you're ticking off the good cop too ! (I've been watching too many crime series, sorry).
Last chance : look here how they calculated the enclosed charge for r < R from the volume.
They can do that because it's uniformly charged. Your sphere is not uniformly charged, so you'll have to do something else to find the enclosed charge as a function of r. You are given the charge density is a function of r only. If r is very small, the charge density is enormous. How do you calculate the enclosed charge in your sphere as a function of r ?

I assumed that the maximum charge the sphere could have is ρ(R), reason being the maximum space or volume the sphere takes is $\frac {4} {3} \pi R^3$.
Not true
1. $\rho$ is not a charge but a charge density.
2. $\rho = {\alpha\over r^2}$, so the further away form the center, the smaller $\rho$
3. You don't have anything to do with the maximum charge. You want the actual total charge.
no matter what distance you are away outside of the sphere of radius R, its total charge is constant.
Yes that's true.

• Alex_Neof and SammyS

#### Alex_Neof

BvU, I really am lost. Sorry I meant $\rho \times volume$ for the charge (edited above). If the charge is constant, then shouldn't we measure the total charge of the sphere, to know what the charge enclosed is? I know this might be cheeky to ask, but I have an exam on Electric and Magnetic fields tomorrow and I would be truly grateful if I could know how to go about this question? I shouldn't have left it this late I know.

#### Alex_Neof

Also,

$charge(r) = \rho(r) \times \frac {4} {3} \pi r^3= \frac {\alpha} {r^2} \times \frac {4} {3} \pi r^3 = \frac {4} {3} \alpha \pi r$

so maximum charge should occur at $charge(R)$?

I'm missing something throughout this exercise I think, but can you help me see it? The reasoning seems to make sense to me, which is why I probably can't see what I am missing.

#### Alex_Neof

whoops.. I found a video online, where it suggested summing up shells contained within the sphere.
The total charge these shells contain is:

$dQ=\rho dV = \rho 4\pi r^2dr$.

Therefore, the total charge that my sphere of radius $R$ has is:

$Q=\int_{r=0}^R(\frac{\alpha}{r^2})4\pi r^2dr=\int_{r=0}^R\alpha4\pi dr$

$=\alpha4\pi R$.

Therefore E-field outside sphere is:

$E = \frac{\alpha R}{\epsilon_0 r^2}$.

For inside the sphere, I just change my limits from $0$ to $r$ and obtain the charge enclosed as:
$Q=\int_{r=0}^r(\frac{\alpha}{r^2})4\pi r^2dr=\alpha4\pi r$.

Therefore my E-field inside is:

$E = \frac{\alpha }{\epsilon_0 r}$.

But that makes my E-field decrease with r. Does this look better guys?

• BvU

#### ehild

Homework Helper
It looks quite good now • Alex_Neof

#### BvU

Homework Helper
Well done ! Very good indeed that you found out on your own !

For my information (and a bit for those who come after you): I wanted to lure you towards this "summing up thin shells" way to find the charge as a function of r without giving away the whole answer; was there a better way I could have nudged you in the right direction ?

Good luck with your exam !

• Alex_Neof