# Electric field in a cylinder

We have electric charge density $\rho(r) = kr$ in a cylinder of infinite height and radius $a$.

I'm asked to find the electric field.

I'm doing it using two methods and I don't undesrtand why then don't yield the same result

Method 1

Gauss' theorem applied to a cylindrical surface;

$$E(r) 2\pi rh = \frac{Q}{\epsilon_0}$$

$Q = h\int_A \rho = h\int_A kr$, where A is the unit circle $\Rightarrow Q = h\pi k r^2$

So I find $$E(r) = \frac{kr}{2\epsilon_0}$$

Method 2 Divergence in polar coordinates:

$$\nabla \cdot E (r) = \frac{\rho}{\epsilon_0}$$ $$\nabla \cdot E(r) = \frac{1}{r} \frac{\partial rE(r)}{\partial r} = \frac{1}{r} (\frac{\partial E(r)}{\partial r} + r\frac{\partial E(r)}{\partial r}) = \frac{\partial E(r)}{\partial r} \frac{r+1}{r} = \frac{\rho}{\epsilon_0}$$

$$\frac{\partial E(r)}{\partial r} = \frac{k}{\epsilon_0} \frac{r^2}{1+r}$$ $$\Rightarrow E(r) = \frac{k}{\epsilon_0} (\frac{r^2}{2} + r + \ln{(1+r)})$$

What's wrong with that?

• Because $\partial_r\left(rE_r\right)\neq\partial_rE+r\partial_rE$. – Kyle Kanos Feb 26 '14 at 15:47

You just made some math mistakes. You made a mistake when you did $Q = h\int_A kr$. You got $Q = h\pi k r^2$, but you should have gotten $Q = \frac{2}{3} h\pi k r^3$. Notice how this second expression has units of charge while the first one doesn't.
Another mistake you make is that you say $\frac{1}{r} \frac{\partial rE(r)}{\partial r} = \frac{1}{r} (\frac{\partial E(r)}{\partial r} + r\frac{\partial E(r)}{\partial r})$. This is not proper application of the product rule. If correct these mistake you will get the right answer unless there are other mistakes I didn't find.
• why is that? $$\int_0^R \int_0^{2\pi} kr = 2\pi k |\frac{r^2}{2}| _0^R = k \frac{R^2}{2}$$ Where is the error? For what concern the second one I can actually see I made a mistakes.. – Ant Feb 26 '14 at 14:57