# Do you integrate a variable charge density when solving for Q?

1. Nov 29, 2013

### Axxaaa

For example, let's say there was an block infinitely long in the x and y direction and in the z direction bounded by positive and negative a.

I am trying to find the charge of a imaginary partition infinitely long in the x and y direction and in the z direction bounded by positive and negative b, where b is less than a.

Here is where I get confused, if the charge density is something like p = p0*(a^2 - z^2), where z in the case is b, as mentioned above.

dQ = p * dV

Do i integrate from here or do I substitute in p = p0*(a^2 - z^2), and then integrate?

2. Nov 29, 2013

### Staff: Mentor

As p is equal to p0*(a^2 - z^2) it does not matter, but I wonder how you try to integrate it without replacing p by the other expression.

3. Nov 29, 2013

### Axxaaa

I thought to just take p out of the integral and substitute it in later after I integrate dV with respect to z. Also, p should still matter because I stated that z^2 is in this case b^2.

4. Nov 29, 2013

### Simon Bridge

Perhaps this will help: $\renewcommand{\d}{\text{d}}$
The charge in the infinite sheet between $z$ and $z+dz$ is $$\d q=p(z)\d z$$
So the charge within $|z|<b$ is the sum of all such sheets inside that range.

In your example, "$z^2=b^2$", as you say, only at the point $z=b$ ... but the total charge includes all the charge at all points between z=-b and z=b as well - so z has to be able to take on all values in between. vis: $$q=\int_{-b}^b p(z)\;\d z$$ ... i.e. you cannot take $p$ outside the integral because it depends on the variable being integrated over.

There may be a small confusion here though.
$$\d q=\rho(x,y,z) \d V = p(z)\d z : p(z)=\int_{-\infty}^\infty\int_{-\infty}^\infty\rho(x,y,z)\; \d x\d y$$ ... the provided density function has already done two of the integrations for you - so you are not integrating dV over z.

Last edited: Nov 29, 2013