# Using Gauss's law to calculate magnitude of electric field

1. Apr 9, 2006

### Signifier

I understand how to use Gauss's law to calculate the electric field at some point for say a sphere with charge distributed uniformly in it. I am bit confused, though, about calculating the electric field at some point for a non-uniform charge distribution.

For example, say that I have a spherically symmetric negative charge distribution around the origin of my reference frame, with charge density p(r) given by -0.5e^(-r), where r is the distance from the origin (IE, the radius of a given sphere) (so, p(0) = -0.5 and p(1) ~ -0.2). If I wanted to calculate the magnitude of the electric field vector at some radius r, how would I do this?

Let's say I wrap up a portion of the charge distribution in a Gaussian sphere of radius r. The net flux through all tiles on this spherical Gaussian surface would be 4*pi*(r^2)*E, where E is the magnitude of the electric field at all points on the surface. Then, using Gauss's law and solving for E, I get

E = [k / (r^2)]Qenc(r)

Where Qenc(r) is the total charge enclosed by the closed surface at radius r. This is where I get stuck. Knowing the charge density function p(r) (in units C / m^3, let's say), how do I find the net enclosed charge by the sphere of radius r?

Any help would be appreciated.

2. Apr 9, 2006

### nrqed

By definition, the charge in a volume V is the integral of the volume charge density p over that volume, $q_{enc}= \int dV \rho$. In your case, it is obviously easier to work in spherical coordinates and since the charge density is independent of the angle, you simply get $q_{enc}= 4 \pi \int_0^R dr r^2 \rho(r)$ where R is the location of the point where you want to evaluate the E field.

(I am assuming that this point is inside the charged sphere. If the point is
outside of the sphere then you obviously integrate up to the radius of the sphere only)

Patrick

3. Apr 9, 2006

### durt

You'll have to integrate. Imagine thin spherical shells a distance $$r$$ from the origin of thickness $$dr$$.

4. Apr 9, 2006

### Signifier

Okay, so I have a spherical shell of radius r and thickness dr. The volume enclosed by this shell would be the surface area of the sphere multiplied by the thickness (?), or 4*pi*(r^2)*dr. The charge enclosed by this would then be 4*pi*(r^2)*p(r)*dr. Then, to get the net charge enclosed by all of these shells from radius r = 0 to radius r = R, I integrate this expression from 0 to R as nrqed has.

Thanks durt and nrqed, I get it now!