I've been doing a few Gauss' Law problems and I'm slightly confused about calculating charge enclosed by a nonconducting sphere.
So I have done 2 problems that involve finding the electric field inside nonconducting spheres:
1. Charge is uniformly distributed
2. Charge per unit volume given by the function ρ(r) = pr, where p is some constant.
I know how to solve both, but I'm not sure why I have to take different approaches to finding charge enclosed.
EA = Qenc/ε
The Attempt at a Solution
For (1), I was able to calculate Qenclosed using the fact that the charge density is Q/V, where V is the volume of the entire sphere, then multiplying it by the volume of the inner sphere, dV. Then I rearranged for E and got kQr/R3.
My question is, why can't I multiply the the volume of the inner sphere by the function ρ(r), to find the charge enclosed? Instead, I have to integrate ρ(r)*dV = ρ(r)*(4πr2) from 0 to r.
Both Q/V (1) and ρ(r) (2) provide the charge per unit volume, I don't understand why finding Qenclosed differs between the two.