# Why doesn't fully integrating Gauss' law give the correct linear charge density here?

I've got a coaxial cylindrical transmission line with a long straight wire of radius $a$ along the $z$-direction surrounded by a cylindrical conducting cylinder of radius $b$.

The electric and magnetic fields for TEM mode in this transmission line is:

$$\vec{E} = \frac{E_0\cos{(kz-\omega t)}}{\rho}\hat{\rho}$$

$$\vec{B} = \frac{E_0\cos{(kz-\omega t)}}{c\rho}\hat{\phi}$$

I've got to find the charge density and the current on the inner conductor of radius $a$.

(For reference, this is problem 9.32 part b in Griffiths 4th edition Introduction to Electrodynamics.)

So the proper way to find the charge density (and it's supposed to be linear charge density) is:

$${\epsilon}_0\oint\vec{E}\cdot \operatorname{d}\vec{a} = Q_{enc} = \int_{0}^{z}\lambda \operatorname{d}z$$

and then

$$\oint\vec{E}\cdot \operatorname{d}\vec{a} = \int_{0}^{z}\int_{0}^{2\pi}\frac{E_0}{\rho}\cos{(kz-\omega t)}\rho \operatorname{d}\phi \operatorname{d}z = \int_{0}^{z}2\pi E_0\cos{(kz-\omega t)}dz$$

Comparing the integrands, we get

$$\lambda = 2\pi \epsilon_0 E_0\cos{(kz-\omega t)}$$

Now here is where I'm confused: why doesn't fully evaluating the integrals work? I mean,

$$\oint\vec{E}\cdot \operatorname{d}\vec{a} = 2\pi\epsilon_0\frac{E_0}{k}\sin{(kz-wt)}$$

$$\int_{0}^{z}\lambda \operatorname{d}z = \lambda z$$

which gives

$$\lambda = 2\pi\epsilon_0\frac{E_0}{kz}\sin{(kz-wt)}$$

which is not the correct answer.

On the other hand, when finding the current, using the integral form of Ampere's law and fully integrating gives the correct answer (although in this case, there is no integration with respect to $z$).

Can someone please explain this to me?? Thanks so much!

Your error is missing that $\lambda$ is a function of $z$, not a constant, so you can't evaluate the integral $$\int_0^z \lambda(z) \operatorname{d}z,$$ because you don't know what functional form $\lambda(z)$ has. You'd have to do the integral on the $\vec{E}$ side, and then take the derivative of both sides to get rid of the integral.