# Determining Electric Field Inside Long Cylinder (Using Gauss' Law)?

I'm working on a problem with an (infinitely) long cylinder with a charge density, and I'm trying to find the electric field. Using the charge density, I found the enclosed charge of a proportional, enclosed Gaussian surface, so

$$Q_enc=\frac{2\pi \ell s^3 k}{3}$$

As such, we know for the Gaussian surface

$$\int{E\cdot \mathrm da}=\frac{Q_{enc}}{e_0}$$

So, you can simply solve this if you know the area, and I know the solution is

$$E = \frac{k s^2 {\hat{\mathbf{s}}}}{3 \epsilon_0}$$

My question is, why do the charges on either end of the cylinder contribute nothing to E? My book tells me this is a result of E being perpendicular to $$\mathrm da$$, but I don't understand exactly why it that eliminates its contribution. I think it has something to do with the reliance of Gauss' Law on the divergence of E, but I don't entirely understand this in the physical sense. Hopefully the diagram helps, but let me know. If $E$ is perpendicular to the surface, then the dot-product in the integration $E \cdot da$ is just zero, because the dot-product is defined as such (remember the $cos(\theta)$ in the definition; when $\theta=\pi/2$, $cos(\theta)=0$).
• This needs to be changed to say the dot product is $0$ if $E$ is parallel to the surface. Not perpendicular. This is because the area vector is perpendicular to the surface. Aug 14 '18 at 17:36