# Confusion about volume component in Gauss's Law for a cylinder

I am currently working on a problem in which we use Gauss's Law to find the electric field within an infinitely long cylindrical shell (inner radius r, outer radius R) of charge density $$\rho = \rho_0 \sqrt{\frac{r}{s}}$$ from r to R. I am getting quite confused on the proper way to calculate the $$Q_{encl}$$ (charge enclosed) on the right side of the Gauss's Law equation. Here is where I'm at:

$$\int E \cdot da = \frac {Q_{encl}} {\epsilon_0}$$ $$E \int da = \frac {Q_{encl}} {\epsilon_0} = E (2\pi s l)$$ ($$2\pi s l$$ is the surface area of a cylinder in which the flux would be, since there is no flux through the ends.) $$Q_{encl}= ?$$ When integrating to find charge enclosed, I am integrating from 0 to some generic s where $$r because we want the final answer as a function of s.

I have tried the following for charge enclosed:

1.

$$Q_{encl}= \rho \cdot V_{cylinder}$$ $$= 2\pi l {\int \rho(s) ds}^2$$ (Whole integral squared) Which gave: $$E = \frac {2{\rho_0}^2 a} {\epsilon_0}$$ By the logic that the volume of a cylinder is $$2\pi s^2 l$$ for some length l (even though it is infinite, choose a Gaussian surface of a cylinder length l - length should cancel in the end), so enclosed charge is $$2 \pi l$$ and then $$\int \rho (s) ds$$ squared takes care of the $$s^2$$ component of the volume.

I also tried:

2. $$Q_{encl} = \int \rho (s) d\tau$$ (the definition of $$Q_{encl}$$ I think?) $$Q_{encl} = \iiint \rho (s) s ds d\phi dz$$ $$Q_{encl} = \iiint \rho_0 a^{1/2} s^{-1/2} s ds d\phi dz$$ $$= \frac {4\pi l \rho_0 \sqrt{a} s^{3/2}}{3\epsilon_0}$$ Which gave:

$$E = \frac {2\rho_0} {3\epsilon_0} \sqrt{as}$$

1. Am I missing an s here in the integral of $$\rho (s)$$ because in cylindrical coordinates, the ds component of $$d\tau$$ is $$s \cdot ds$$? Should I not have squared the integral? This doesn't seem right because the final answer doesn't depend on s.

2. I wasn't sure that I integrated correctly for $$d\phi$$ and $$dz$$. The $$2\pi$$ I believe comes from the $$d\phi$$ integration, and then does the $$l$$ come from the $$dz$$ integration? This makes logical sense but I'm not sure how to show that explicitly in my integration.

Which method is correct, if either? Am I missing something that uses r and R, or does it not matter that it's a hollow cylinder given that I'm only worried about the area between r and R? How/where would I include that? It seems like it should matter because the charge enclosed would be greater from 0 to some generic s if it were a solid cylinder (enclosing more volume). Would I just integrate from r to generic s? I'm thinking maybe 1. and 2. give the same result if done correctly (like if I took the corrections I mentioned in 1. just above). I think my multivariable calc is quite rusty - I am really confusing myself with this enclosed charge expression and want to make sure I am computing it properly.

Sorry if this is a silly question and sorry that this is such a long post; I wanted to be thorough. Any help or guidance is appreciated!

Sorry I just did a quick read through so I might not answer everything in one go:

Remember that the total charge is simply the density times the volume, in this instance we don’t have a uniform charge density and so we take the integral as you began to do:

$$Q = \int{\rho(s) dV}= \int{\rho_{0}*\sqrt{\frac{r}{s}}*2\pi L s ds}$$

This becomes $$2\pi L \rho_{0} \sqrt{r} \int{\sqrt{s} ds}$$

And that’s a pretty simple integral; moreover, I think (depending on the specific problem) that in this instance you’d likely want to integrate from r to s, rather than 0 to s as the way that I read your description makes it seem as though you only have charge in the region $$[r,R]$$

Let me know if you have any more questions/ I made a mistake (Quite possible as I’m on my phone) and I’d be glad to offer more help!