# Electrostatics - finding the total charge of a sphere with varying charge density

1. Oct 2, 2011

### iejedijuerijr

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

I was given a sphere with radius R and a charge density function δ(r),where r is the distance from the center of the sphere. I want to find the total charge in the sphere.

2. Relevant equations

I know that Q = δV

3. The attempt at a solution

I tried integrating V ∫δ(r)dr over 0 to R, but I'm not sure that will give me the total charge, but am unsure that's the right way to go about this. is it? thanks.

2. Oct 2, 2011

### Tsunoyukami

I believe your approach is correct.

Just remember that when integrating from 0 to R in spherical coordinates your must remember to use the factors associated with this change of variable.

That is, I think you will want to integrate:

Q = $\int^{2\pi}_{0}$ $\int^{\pi}_{0}$ $\int^{R}_{0}$ $\delta$(r) r$^{2}$ sin$\theta$ dr d$\theta$ d$\phi$

where Q is the total charge enclosed by the sphere and R is the radius of the sphere.