# Evaluating volume integral for electric potential in an infinite cylinder with uniform charge density

Suppose I have an infinitely long cylinder of radius $$a$$, and uniform volume charge density $$\rho$$. I want to brute force my way through a calculation of the potential on the interior of the cylinder using the relation: $$\Phi(\mathbf{x}) = \frac{1}{4\pi \epsilon_0} \int d^3 x' \frac{\rho(\mathbf{x}')}{|\mathbf{x} - \mathbf{x}'|}$$ To simplify the integral, I place my axes so that $$\mathbf{x}$$ points along the $$x$$-axis. Thus $$\mathbf{x} = x \mathbf{\hat{x}}$$ $$\mathbf{x}' = r' \cos \phi' \mathbf{\hat{x}} + r' \sin \phi' \mathbf{\hat{y}} + z' \mathbf{\hat{z}}$$ $$\rho(\mathbf{x}') = \rho$$ The resulting volume integral is then: $$\Phi(\mathbf{x}) = \frac{\rho}{4 \pi \epsilon_0} \int_{-\infty}^{\infty} dz' \int_0^{2\pi} d\phi' \int_0^a r' dr' \frac{1}{\sqrt{x^2 + r'^2 - 2xr'\cos\phi' + z'^2}}$$ How do I evaluate this integral? I've tried to do some substitutions ($$\mu = \cos \phi'$$, $$z' = \sinh\theta$$), but nothing has given anything workable.

To be clear, I understand that this problem is reasonably easily solvable by first finding the electric field with Gauss's law and then taking the line integral. I would just like to know how to take this integral and, if possible, get some insight into why the integral in this easy problem is stupid hard.

## 2 Answers

I drop the constant and focus on the integral, also the prime sign: $$\Phi(\mathbf{x}) = \int_{-\infty}^{\infty} dz \int_0^{2\pi} d\phi \int_0^a r dr \frac{1}{\sqrt{x^2 + r^2 - 2xr\cos\phi + z^2}}$$

The integral is divergent. To remove the divergence is to change the reference point of the potential from $$x=\infty$$ to $$x=0$$. Thus, I will change the integrand back to an integration form, and change the lower limit, which only change an infinite constant to the potential.

$$\frac{1}{\sqrt{x^2 + r^2 - 2xr\cos\phi + z^2}} =- \int^x_\infty d\xi \frac{\xi - r\cos \phi}{\left(\xi^2 + r^2 - 2\xi r\cos\phi + z^2\right)^{3/2}}\\ \to -\int^x_0 d\xi \frac{\xi - r\cos \phi}{\left(\xi^2 + r^2 - 2\xi r\cos\phi + z^2\right)^{3/2}}$$

The new potential from:

$$\Phi(\mathbf{x}) = -\int^x_0 d\xi \int^{2\pi}_0 d\phi \int_0^a rdr\int_{-\infty}^\infty dz \frac{\xi - r\cos \phi}{\left(\xi^2 + r^2 - 2\xi r\cos\phi + z^2\right)^{3/2}}\\ = -\int^x_0 d\xi \int^{2\pi}_0 d\phi \int_0^a rdr \frac{2(\xi - r\cos \phi)}{\left(\xi^2 + r^2 - 2\xi r\cos\phi\right)} \to I_1 - I_2$$

The integral of $$z$$ can be carried out by triangular substitution. Next, I will try to integrate over $$\phi$$, by complex contour integral in the unit circle. Details refer to the appendixes in the bottom.

$$I_1 = 2\xi \int^{2\pi}_0 d\phi \frac{1}{\left(\xi^2 + r^2 - 2\xi r\cos\phi\right)} = \frac{4\pi\xi}{r_>^2-r_<^2}$$

$$I_2 = 2 r \int^{2\pi}_0 d\phi \frac{\cos\phi}{\left(\xi^2 + r^2 - 2\xi r\cos\phi\right)} =\frac{4\pi r}{r_>^2-r_<^2} \frac{r_<}{r_>}$$

The above integral is done by change $$Z = e^{i\phi}$$ and turn the integral into a closed contour integral on the unit circle. $$r_>$$ is the larger one between $$r$$ and $$\xi$$, $$r_<$$ the smaller one.

$$\Phi(\mathbf{x}) =- 4 \pi \int^x_0 d\xi \int_0^a rdr \left[ \xi - r\frac{r_<}{r_>} \right] \frac{1}{r_>^2-r_<^2}$$

For $$x < a$$ :

$$\Phi(\mathbf{x}) =- 4 \pi \int^x_0 d\xi \left\{\int_0^\xi rdr \left[ \xi - r\frac{r}{\xi} \right] \frac{1}{\xi^2-r^2} + \int_\xi^a rdr \left[ \xi - r\frac{\xi}{r} \right] \frac{1}{r^2-\xi^2} \right\} \\ =- 4 \pi \int^x_0 d\xi \left\{\int_0^\xi rdr \frac{1}{\xi} + 0 \right\} =- 2 \pi \int^x_0 \xi d \xi = -\pi x^2$$

For $$x > a$$ :

$$\Phi(\mathbf{x}) =- 4 \pi \int^a_0 rdr \left\{\int_0^r d\xi \left[ \xi - r\frac{\xi}{r} \right] \frac{1}{r^2-\xi^2} + \int_r^x d\xi \left[ \xi - r\frac{r}{\xi} \right] \frac{1}{\xi^2-r^2} \right\} \\ =- 4 \pi \int^a_0 rdr \left\{ 0 + \int_r^x d\xi \frac{1}{\xi} \right\}\\ =- \pi a^2 \left( 2 \ln x - 2 \ln a + 1 \right).$$

A first quick check of the result is the continuity of the potential as $$x = a$$, where both forms render $$\Phi(a) = -\pi a^2$$.

Appendix A


For $$0< b < 1$$ the complete integral over angle $$\phi$$: $$I_1 = \int^{2\pi}_0 d\phi \frac{1}{\left(1 + b^2 - 2b \cos\phi\right)} = \frac{2\pi}{1-b^2}$$ Let $$Z = e^{i\phi}$$, hence $$d\phi= -i \frac{dZ}{Z}$$. Write $$I_1$$ as $$I_1 = -i \oint_{unit- circle} \frac{dZ}{Z \left(1 + b^2 \right) - b \left( Z^2 + 1 \right)} = + \frac{i}{b} \oint_{unit- circle} \frac{dZ}{(Z-b)(Z-\frac{1}{b})} \\ = \frac{-2\pi}{b} Res(b) = \frac{-2\pi}{b} \frac{1}{b-\frac{1}{b}} = \frac{2\pi}{1-b^2}$$

Appendix B


For $$0< b < 1$$ the complete integral over angle $$\phi$$: $$I_2 = \int^{2\pi}_0 d\phi \frac{\cos\phi}{\left(1 + b^2 - 2b \cos\phi\right)} = \frac{2\pi b}{1 -b^2}$$ Let $$Z = e^{i\phi}$$: $$I_2 = \frac{i}{2b} \oint_{unit- circle} \frac{Z^2 + 1}{(Z-b)(Z-\frac{1}{b})} \frac{dZ}{Z}\\ = \frac{i}{2b} 2\pi i \left\{ Res(0) + Res(b)\right\} = - \frac{\pi}{b} \left\{ 1 - \frac{1+b^2}{1-b^2}\right\} = \frac{2\pi b}{1 -b^2}$$

• Why is this so stupid hard? First, it is divergent, you cannot integrate directly. Secondly, the cylinder has less symmetry than a sphere. The similar integral of the spherical case is not easy already. Finally, Mr. Gauss indeed did a great job.
– ytlu
Feb 24, 2021 at 7:29

I think part of the problem in evaluating the integral by brute force is that it does not converge without some regularization, probably due to the fact that the source is not localized. One way I can think of doing the integral is by using an expression for the empty space Green function of the Poisson equation in cylindrical coordinates. You will find different expressions for this in references, I will use the one from equation $$(167)$$ in link: $$$$\frac{1}{|\mathbf{x}-\mathbf{x'}|} = \sum_{m=-\infty}^{\infty} \int_{0}^{\infty}\mathrm{d}k \, \mathrm{e}^{i m (\phi - \phi')} \mathrm{e}^{- k z_>} \mathrm{e}^{k z_<} J_{|m|}(k \rho) J_{|m|}(k \rho') \,$$$$ where $$z_>$$ is the greater of $$z$$ and $$z'$$, and $$z_<$$ is the lesser of $$z$$ and $$z'$$. Let's use $$\rho_Q$$ for the charge density to distinguish it from the radial coordinates. Then we want to compute $$$$\Phi(\mathbf{x}) = \frac{\rho_Q}{4 \pi \epsilon_0} \int_{\rho'\leq a} \frac{1}{|\mathbf{x}-\mathbf{x'}|} \mathrm{d}^3x' = \frac{\rho_Q}{4 \pi \epsilon_0} \int_{0}^{2 \pi} \mathrm{d} \phi' \int_{0}^{a} \rho' \mathrm{d} \rho' \int_{-\infty}^{\infty} \mathrm{d} z' \, \frac{1}{|\mathbf{x}-\mathbf{x'}|} \,.$$$$ We have chosen brute force so let's just go for it. The angular integral vanishes unless $$m = 0$$. The interal over $$z'$$ can just be split into an integral from $$z' = -\infty$$ to $$z' = z$$ and an integral from $$z' = z$$ to $$z' = \infty$$. And the integral over $$\rho'$$ can just be performed:
$$\begin{eqnarray} \Phi(\mathbf{x}) &=& \frac{\rho_Q}{4 \pi \epsilon_0} \int_{\rho'\leq a} \frac{1}{|\mathbf{x}-\mathbf{x'}|} \mathrm{d}^3x' \\ &=& \frac{\rho_Q}{2 \epsilon_0} \int_{0}^{\infty}\mathrm{d}k \left[ \int_{- \infty}^{z} \mathrm{d} z' \mathrm{e}^{- k z} \mathrm{e}^{k z'} + \int_{z}^{\infty} \mathrm{d} z' \mathrm{e}^{- k z'} \mathrm{e}^{k z} \right] \left[ \int_{0}^{a} \mathrm{d} \rho' \, \rho' J_0 (k \rho') \right] J_0 (k \rho) \\ &=& \frac{\rho_Q}{2 \epsilon_0} \int_{0}^{\infty}\mathrm{d}k \frac{2}{k} \frac{a J_1(k a)}{k} J_0 (k \rho) \\ &=& \frac{a \rho_Q}{\epsilon_0} \int_{0}^{\infty}\mathrm{d}k \frac{1}{k^2} J_1(k a) J_0 (k \rho) \, . \end{eqnarray}$$ Turns out this does not converge, but we can perform the following trick $$\begin{eqnarray} \Phi(\mathbf{x}) &=& \frac{a \rho_Q}{\epsilon_0} \int_{0}^{\infty}\mathrm{d}k \frac{1}{k^2} J_1(k a) \left[J_0 (k \rho) - 1 + 1 \right] \\ &=& \frac{a \rho_Q}{\epsilon_0} \int_{0}^{\infty}\mathrm{d}k \frac{1}{k^2} J_1(k a) \left[J_0 (k \rho) - 1 \right] + \frac{a \rho_Q}{\epsilon_0} \int_{0}^{\infty}\mathrm{d}k \frac{1}{k^2} J_1(k a) \, . \end{eqnarray}$$ Turns out the second term in the previous expression captures the divergence. Let's rescale the potential by dropping that term: $$\begin{eqnarray} \Phi(\mathbf{x}) &=& \frac{a \rho_Q}{\epsilon_0} \int_{0}^{\infty}\mathrm{d}k \frac{1}{k^2} J_1(k a) \left[J_0 (k \rho) - 1 \right] \\ &=& \begin{cases} - \frac{\rho_Q}{\epsilon_0} \frac{\rho^2}{4} &, 0 \leq \rho \leq a \\ -\frac{\rho_Q}{\epsilon_0} \frac{a^2}{2} \left\{ \frac{1}{2} + \log\left[ \frac{\rho}{a} \right] \right\} &, a \leq \rho \end{cases} \, , \end{eqnarray}$$ and presto.

• This is great, thank you. Could you also give a hint as to how you evaluated that last integral? Integral representation of the Bessel functions? Recurrence relation? Feb 22, 2021 at 21:51
• I found it in the Table of Integrals Series and Products book by Gradshteyn and Ryzhik, $7$ed. It's in page $671$, equation $3$ after numeral $6.533$. Feb 22, 2021 at 21:55