# Constant Electric Field

## Homework Statement

A volumetric charge density ##\rho = \frac{A}{r}## is distributed in the spheric region ##r_1 < r < r_2## (##A## is constant). A point charge ##q## is located in the center of the sphere (##r = 0##). What should be the value of ##A## so that the module of the electric field is constant for ##r_1 < r < r_2##?

## Homework Equations

Gauss Theorem for continuous distribution
##\Phi_s (\vec E_0) = \int_S \vec E_0 \cdot d\vec S = \frac{1}{\epsilon_0} \int_\tau \rho (x, y, z) d\tau##

## The Attempt at a Solution

What the problem is asking is to find ##A## so that ##E_0 = const##.
I started by finding the electric field for ##r_1## and ##r_2##, so, if I'm not wrong:
for ##r_1##
##E_0 4 \pi r_1^2 = \frac{1}{\epsilon_0} \int_\tau \rho (x, y, z) d\tau##
We know that ##dq = \rho (x, y, z) d\tau## so we have
##E_0 4 \pi r_1^2 = \frac{Q}{\epsilon_0}##
##E_0 = \frac{Q}{4 \pi \epsilon_0 r_1^2}## or ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{Q}{r_1^2}##
same thing for ##r_2##
##E_0 = \frac{Q}{4 \pi \epsilon_0 r_2^2}## or ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{Q}{r_2^2}##
Since we know that it's a sphere, ##Q = \rho \frac{4}{3} \pi r_1^3## and ##Q = \rho \frac{4}{3} \pi r_2^3##.
So the above expressions become
##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{\rho}{r_1^2} \frac{4}{3} \pi r_1^3 = \frac{\rho r_1}{3 \epsilon_0}##
and
##E_0 = \frac{\rho r_2}{3 \epsilon_0}##

At this point I thought that by simply doing this ##\frac{\rho r_1}{3 \epsilon_0} = \frac{\rho r_2}{3 \epsilon_0}## I would have found ##A## but it's not true because I obviously find myself with ##r_1 = r_2##. How should I proceed doing this? Was it good finding the two electric field? Or I went the wrong way?

SammyS
Staff Emeritus
Homework Helper
Gold Member

## Homework Statement

A volumetric charge density ##\rho = \frac{A}{r}## is distributed in the spheric region ##r_1 < r < r_2## (##A## is constant). A point charge ##q## is located in the center of the sphere (##r = 0##). What should be the value of ##A## so that the module of the electric field is constant for ##r_1 < r < r_2##?

## Homework Equations

Gauss Theorem for continuous distribution
##\Phi_s (\vec E_0) = \int_S \vec E_0 \cdot d\vec S = \frac{1}{\epsilon_0} \int_\tau \rho (x, y, z) d\tau##

## The Attempt at a Solution

What the problem is asking is to find ##A## so that ##E_0 = const##.
I started by finding the electric field for ##r_1## and ##r_2##, so, if I'm not wrong:
for ##r_1##
##E_0 4 \pi r_1^2 = \frac{1}{\epsilon_0} \int_\tau \rho (x, y, z) d\tau##
We know that ##dq = \rho (x, y, z) d\tau## so we have
##E_0 4 \pi r_1^2 = \frac{Q}{\epsilon_0}##
##E_0 = \frac{Q}{4 \pi \epsilon_0 r_1^2}## or ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{Q}{r_1^2}##
same thing for ##r_2##
##E_0 = \frac{Q}{4 \pi \epsilon_0 r_2^2}## or ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{Q}{r_2^2}##
Since we know that it's a sphere, ##Q = \rho \frac{4}{3} \pi r_1^3## and ##Q = \rho \frac{4}{3} \pi r_2^3##.
So the above expressions become
##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{\rho}{r_1^2} \frac{4}{3} \pi r_1^3 = \frac{\rho r_1}{3 \epsilon_0}##
and
##E_0 = \frac{\rho r_2}{3 \epsilon_0}##

At this point I thought that by simply doing this ##\frac{\rho r_1}{3 \epsilon_0} = \frac{\rho r_2}{3 \epsilon_0}## I would have found ##A## but it's not true because I obviously find myself with ##r_1 = r_2##. How should I proceed doing this? Was it good finding the two electric field? Or I went the wrong way?
What is the total charge inside the sphere at radius r1 ?

I should have been more complete with my answer:

The only charge at r < r1 is the charge, q, at the center.

Therefore, the magnitude of the electric field at r = r1 is ##\displaystyle \ E=\frac1{4\pi\epsilon_0}\frac{q}{ r_1}\ .##

Last edited:
So this means that ##A = \frac{3 r q}{4 \pi r_1 r_2}##? How do I check if it's correct? Do I have to find the electric field in ##r_1 < r < r_2##?
Because the electric field there for me is ##E_0 = A \frac{(r_2 - r_1)}{r^2}## and so ##\frac{3 q}{4 \pi} \left(\frac{r_2}{r_1} - \frac{r_1}{r_2} \right)##. Is it correct?

SammyS
Staff Emeritus
Homework Helper
Gold Member
So this means that ##A = \frac{3 r q}{4 \pi r_1 r_2}##? How do I check if it's correct? Do I have to find the electric field in ##r_1 < r < r_2##?
Because the electric field there for me is ##E_0 = A \frac{(r_2 - r_1)}{r^2}## and so ##\frac{3 q}{4 \pi} \left(\frac{r_2}{r_1} - \frac{r_1}{r_2} \right)##. Is it correct?
A is a constant, so it does not depend on r .

How did you arrive at that value ?

For ##r = r_1## we have ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_1}## while for ##r = r_2## we have ##E_0 = \frac{\rho r_2}{3 \epsilon_0} = \frac{A r_2}{3 \epsilon_0 r}##. Then I thought that in order to find ##A## I could do this ##\frac{1}{4 \pi \epsilon_0} \frac{q}{r_1} = \frac{A r_2}{3 \epsilon_0 r}## and so ##A = \frac{3 r q}{4 \pi r_1 r_2}##. Is it wrong?

SammyS
Staff Emeritus
Homework Helper
Gold Member
For ##r = r_1## we have ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_1}## while for ##r = r_2## we have ##E_0 = \frac{\rho r_2}{3 \epsilon_0} = \frac{A r_2}{3 \epsilon_0 r}##. Then I thought that in order to find ##A## I could do this ##\frac{1}{4 \pi \epsilon_0} \frac{q}{r_1} = \frac{A r_2}{3 \epsilon_0 r}## and so ##A = \frac{3 r q}{4 \pi r_1 r_2}##. Is it wrong?
For r = r2 both q and the amount of charge between r1 an r2 contribute to the electric field .

You are leaving out ## \displaystyle \ E=\frac1{4\pi\epsilon_0}\frac{q}{ r_2}\ .##

Oh! So for ##r = r_2## we have ##E_0 = \left( \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2} \right) + \left( \frac{A r_2}{3 \epsilon_0 r} \right)##?

SammyS
Staff Emeritus
Homework Helper
Gold Member
Oh! So for ##r = r_2## we have ##E_0 = \left( \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2} \right) + \left( \frac{A r_2}{3 \epsilon_0 r} \right)##?
Not correct.

Over what range of r are you integrating ρ(r) ?

Also, what is r doing in the denominator?

Because ##\rho = \frac{A}{r}## so I simply wrote that instead of ##\rho##. The range is from ##0## to ##r_2##. Should I do it from ##r_1## to ##r_2##?

SammyS
Staff Emeritus
Homework Helper
Gold Member
Because ##\rho = \frac{A}{r}## so I simply wrote that instead of ##\rho##. The range is from ##0## to ##r_2##. Should I do it from ##r_1## to ##r_2##?
It's from ##\ r_1\ ## to ##\ r_2\,,\ ## so use that.

Okay, so it should be this:
##E_0 4 \pi r^2 = \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \rho(r) d\tau##
##E_0 = \frac{1}{4 \pi r^2} \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \rho(r) d\tau##
##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{1}{r^2} \int_{r_1}^{r_2} \frac{A}{r} \frac{4}{3} \pi r^3 dr##
##E_0 = \frac{1}{\epsilon_0} \frac{A}{3 r^2} \int_{r_1}^{r_2} r^2 dr##
##E_0 = \frac{A}{3 \epsilon_0 r^2} \left[ \frac{r^3}{3} \right]_{r_1}^{r_2}##
##E_0 = \frac{A}{9 \epsilon_0 r^2} \left( r_2^3 - r_1^3 \right)##
Is this correct?

SammyS
Staff Emeritus
Homework Helper
Gold Member
Okay, so it should be this:
## \displaystyle E_0 4 \pi r^2 = \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \rho(r) d\tau##
## \displaystyle E_0 = \frac{1}{4 \pi r^2} \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \rho(r) d\tau##
## \displaystyle E_0 = \frac{1}{4 \pi \epsilon_0} \frac{1}{r^2} \int_{r_1}^{r_2} \frac{A}{r} \frac{4}{3} \pi r^3 dr##

Is this correct?
No - not the way to integrate over a volume.

The volume element of integration for a spherical shell is: ##\ 4\pi r^2 dr\ ##.

Use that instead of ## \displaystyle \ \frac43 \pi r^3 dr\ ##

Oh! So it's ##E_0 = \frac{A}{2 \epsilon_0 r^2} \left( r_2^2 - r_1^2 \right)##?
And for ##r = r_2## in total we have ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2} + \frac{A}{2 \epsilon_0 r^2} \left( r_2^2 - r_1^2 \right)##
After this I just have to do like this:
$$\frac{1}{4 \pi \epsilon_0} \frac{q}{r_1} = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2} + \frac{A}{2 \epsilon_0 r^2} \left( r_2^2 - r_1^2 \right)$$
Is it right in order to find ##A##?

SammyS
Staff Emeritus
Homework Helper
Gold Member
Oh! So it's ##E_0 = \frac{A}{2 \epsilon_0 r^2} \left( r_2^2 - r_1^2 \right)##?
And for ##r = r_2## in total we have ##E_0 = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2} + \frac{A}{2 \epsilon_0 r^2} \left( r_2^2 - r_1^2 \right)##
After this I just have to do like this:
$$\frac{1}{4 \pi \epsilon_0} \frac{q}{r_1} = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2} + \frac{A}{2 \epsilon_0 r^2} \left( r_2^2 - r_1^2 \right)$$
Is it right in order to find ##A##?
Too many different E0-s.

The amount of charge for the whole shell (from r1 to r2) is indeed ##\displaystyle\ 2\pi A\left( r_2^2 - r_1^2 \right)\,,\ ## which you must have gotten judging by you expressions.

Then the electric field at r2 is due that charge plus the charge, q, at the center.

The correct value of E at r = r2 is close to what you have on the second line, except you need r22 in the denominator, not r2.

(You're forgetting to square r in a number of places. Just because I did - that is no excuse. )

Too many different E0-s
##E_0 - s##? What do you mean?

The amount of charge for the whole shell (from r1 to r2) is indeed 2πA(r22−r21), 2πA(r22−r12), \displaystyle\ 2\pi A\left( r_2^2 - r_1^2 \right)\,,\ which you must have gotten judging by you expressions.
Oh yeah, it becomes ##\frac{q + 2 \pi A (r_2^2 - r_1^2)}{4 \pi \epsilon_0 r_2^2}##, right?

The correct value of E at r = r2 is close to what you have on the second line, except you need r22 in the denominator, not r2.
You're right, because the ##d\vec S## is of the sphere with ##r = r_2## and not a random ##r##, right?

(You're forgetting to square r in a number of places. Just because I did - that is no excuse. )
Yeah, I'm sorry...

SammyS
Staff Emeritus
Homework Helper
Gold Member
##E_0 - s##? What do you mean?

.

My poor attempt to pluralize E0 .

Oh okay.
But still, now that I have the electric field between ##r_1## and ##r_2##, how do I find ##A## so that the electric field is constant?
Is it something like this:
##E_0 = 2 \pi A (r_2^2 - r_1^2)##
##A = \frac{E_0}{2 \pi (r_2^2 - r_1^2)}##

SammyS
Staff Emeritus
Homework Helper
Gold Member
Oh okay.
But still, now that I have the electric field between ##r_1## and ##r_2##, how do I find ##A## so that the electric field is constant?
Is it something like this:
##E_0 = 2 \pi A (r_2^2 - r_1^2)##
##A = \frac{E_0}{2 \pi (r_2^2 - r_1^2)}##
What does that subscript of 0 mean?

What you need:
The electric field at r1 must be equal to the electric field at r2 .

Set them equal and solve for A.

In other words,
Fix this equation from post #13
##\displaystyle \frac{1}{4 \pi \epsilon_0} \frac{q}{r_1} = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2} + \frac{A}{2 \epsilon_0 r^2} \left( r_2^2 - r_1^2 \right)\ ##​

becomes:
##\displaystyle \frac{1}{4 \pi \epsilon_0} \frac{q}{r_1^2} = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2^2} + \frac{A}{2 \epsilon_0 r_2^2} \left( r_2^2 - r_1^2 \right)\ ##​

Solve for A.

Last edited:
So this:
##\frac{1}{4 \pi \epsilon_0} \frac{q}{r_1^2} = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2^2} + \frac{A}{2 \epsilon_0 r_2^2} \left( r_2^2 - r_1^2 \right)##
Because if it's this I have ##A = \frac{q}{2 \pi r_1^2}##.

SammyS
Staff Emeritus
Homework Helper
Gold Member
So this:
##\frac{1}{4 \pi \epsilon_0} \frac{q}{r_1^2} = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_2^2} + \frac{A}{2 \epsilon_0 r_2^2} \left( r_2^2 - r_1^2 \right)##
Because if it's this I have ##A = \frac{q}{2 \pi r_1^2}##.
Yes !

Now, does that work for E at r = c, if r1 < c < r2 ?

So for ##E## at ##r = c## we have:
##E 4 \pi c^2 = \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \rho d\tau##
##E 4 \pi c^2 = \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \frac{A}{c} d\tau##
##E = \frac{1}{4 \pi \epsilon_0} \frac{A}{c^2} \int_{r_1}^{r_2} \frac{1}{c} d\tau##
##E = \frac{1}{4 \pi \epsilon_0} \frac{A}{c^2} \int_{r_1}^{r_2} \frac{1}{c} 4 \pi c^2 dc##
##E = \frac{1}{4 \pi \epsilon_0} \frac{A 4 \pi}{c^2} \frac{\left( r_2^2 - r_1^2 \right)}{2}##
##E = \frac{1}{4 \pi \epsilon_0} \frac{q}{2 \pi r_1^2} \frac{4 \pi}{c^2} \frac{\left( r_2^2 - r_1^2 \right)}{2}##
##E = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_1^2 c^2} \left( r_2^2 - r_1^2 \right)##
##E = \frac{1}{4 \pi \epsilon_0} \frac{q}{c^2} \left( \frac{r_2^2}{r_1^2} - 1 \right)##
Right?

SammyS
Staff Emeritus
Homework Helper
Gold Member
So for ##E## at ##r = c## we have:
##E 4 \pi c^2 = \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \rho d\tau##
The Gaussian surface is at r = c, right?

Only integrate the charge density, ρ(r), up to r = c, for the enclosed charge.
##E 4 \pi c^2 = \frac{1}{\epsilon_0} \int_{r_1}^{r_2} \frac{A}{c} d\tau##
##E = \frac{1}{4 \pi \epsilon_0} \frac{A}{c^2} \int_{r_1}^{r_2} \frac{1}{c} d\tau##
##E = \frac{1}{4 \pi \epsilon_0} \frac{A}{c^2} \int_{r_1}^{r_2} \frac{1}{c} 4 \pi c^2 dc##
##E = \frac{1}{4 \pi \epsilon_0} \frac{A 4 \pi}{c^2} \frac{\left( r_2^2 - r_1^2 \right)}{2}##
##E = \frac{1}{4 \pi \epsilon_0} \frac{q}{2 \pi r_1^2} \frac{4 \pi}{c^2} \frac{\left( r_2^2 - r_1^2 \right)}{2}##
##E = \frac{1}{4 \pi \epsilon_0} \frac{q}{r_1^2 c^2} \left( r_2^2 - r_1^2 \right)##
##E = \frac{1}{4 \pi \epsilon_0} \frac{q}{c^2} \left( \frac{r_2^2}{r_1^2} - 1 \right)## (Doesn't look constant to me.)
Right?

So ##\int_{r_1}^{c} c dc##?
Then with all the operations we will have this:
##E = \frac{q}{4 \pi \epsilon_0} \left( \frac{1}{c^2} - \frac{1}{r_1^2} \right)##

SammyS
Staff Emeritus
Homework Helper
Gold Member
So ##\int_{r_1}^{c} c dc##?
Then with all the operations we will have this:
##E = \frac{q}{4 \pi \epsilon_0} \left( \frac{1}{c^2} - \frac{1}{r_1^2} \right)##
What should this value be ?

Somehow you've switched the signs.

You have ignored the contribution of q, the charge at the center.

Last edited:
You're right. I switched the signs. I was doing it in mind without writing.
You have ignored the contribution of q, the charge at the center.
So I should add ##\frac{1}{4 \pi \epsilon_0} \frac{q}{c^2}## to ##\frac{q}{4 \pi \epsilon_0} \left( \frac{1}{r_1^2} - \frac{1}{c^2} \right)##?

SammyS
Staff Emeritus
Homework Helper
Gold Member
You're right. I switched the signs. I was doing it in mind without writing.

So I should add ##\frac{1}{4 \pi \epsilon_0} \frac{q}{c^2}## to ##\frac{q}{4 \pi \epsilon_0} \left( \frac{1}{r_1^2} - \frac{1}{c^2} \right)##?
What will that give as a result ?

##\frac{1}{4 \pi \epsilon_0} \frac{q}{r_1^2}##
Oh! Now I got it! Thanks so much!