Magnetic field by current in an infinite cylinder Let $V\subset\mathbb{R}^3$ be an infinitely high solid cylinder of radius $R$, with its axis coinciding with the $z$ axis, entirely enclosed by the cylinder's lateral surface. Then, for any constant $\mu_0\in\mathbb{R}$ and any point of coordinates $\boldsymbol{r}\notin \bar{V}$ external to the cylinder, $$\frac{\mu_0}{4\pi}\int_V\frac{I\mathbf{k}\times(\boldsymbol{r}-\boldsymbol{x})}{\pi R^2\|\boldsymbol{r}-\boldsymbol{x}\|^3}d^3x=\frac{\mu_0 I \mathbf{k}\times\boldsymbol{r}}{2\pi\|\mathbf{k}\times\boldsymbol{r}\|^2}$$where $\mathbf{k}$ is the unit vector defyning the direction of the $z$ axis, which is the same as$$\frac{1}{2\pi}\int_V\frac{\mathbf{k}\times(\boldsymbol{r}-\boldsymbol{x})}{ R^2\|\boldsymbol{r}-\boldsymbol{x}\|^3}d^3x=\frac{\mathbf{k}\times\boldsymbol{r}}{\|\mathbf{k}\times\boldsymbol{r}\|^2}\quad (1)$$The result is the formula for the magnetic field generated by a steady current parallel to $\mathbf{k}$, having intensity $I$ and flowing through the cylinder.
My textbook, Gettys's Physics, derives the formula by using Ampère's law in the form $\oint_{\partial^+ \Sigma}\left(\frac{\mu_0}{4\pi}\int_{\mathbb{R}^3}\frac{\boldsymbol{J}(\boldsymbol{x})\times(\boldsymbol{r}-\boldsymbol{x})}{\|\boldsymbol{r}-\boldsymbol{x}\|^3}d\mu_{\boldsymbol{x}}\right)\cdot d\boldsymbol{r}=\mu_0\int_\Sigma \boldsymbol{J}\cdot\boldsymbol{N}_e \,d\sigma$, but I would like to understand a way to calculate the integral without using that law, since I have never seen a proof of it for a discontinuous density of current such as $\boldsymbol{J}=\frac{I\chi_V }{\pi R^2}\mathbf{k}$.
How can we proof the identity $(1)$? I have also tried with cylindrical coordinates $(x,y,z)=(r\cos\theta,r\sin\theta,z)$ with $r\in [0,R]$, $\theta\in[0,2\pi)$, $z\in(-\infty,+\infty)$, but I have got serious problem to manipulate the integral I get. I $\infty$-ly thank any answerer...
 A: Fix a point outside the cylinder, without loss of generality at $\mathbf r=(a,0,0)$. By symmetry, the magnetic field at $\mathbf r$ has only a $y$ component, and since $k$ only has a $z$ component, the only relevant component of $\mathbf r-\mathbf x$ is the $x$ component. The $y$ component of the left-hand side is
\begin{align}
\frac1{2\pi R^2}\int_V\frac{a-x}{\|\mathbf r-\mathbf x\|^3}\mathrm d^3x
&=
\frac1{2\pi R^2}\iiint_V\frac{a-r\cos\theta}{\left((a-r\cos\theta)^2+(r\sin\theta)^2+z^2\right)^{3/2}}\,\mathrm dz\,\mathrm d\theta\,r\mathrm dr
\\
&=
\frac1{\pi R^2}\int_0^R\int_0^{2\pi}\frac{a-r\cos\theta}{(a-r\cos\theta)^2+(r\sin\theta)^2}\,\mathrm d\theta\,r\mathrm dr
\\
&=
\frac1{\pi R^2}\int_0^R\int_0^{2\pi}\frac{a-r\cos\theta}{a^2-2ar\cos\theta+r^2}\,\mathrm d\theta\,r\mathrm dr
\\
&=
\frac a{\pi R^2}\int_0^{R/a}\int_0^{2\pi}\frac{1-\rho\cos\theta}{1-2\rho\cos\theta+\rho^2}\,\mathrm d\theta\,\rho\mathrm d\rho
\\
&=
\Re\frac a{\pi R^2}\int_0^{R/a}\int_0^{2\pi}\frac{1-\rho\mathrm e^{\mathrm i\theta}}{\left(1-\rho\mathrm e^{\mathrm i\theta}\right)\left(1-\rho\mathrm e^{-\mathrm i\theta}\right)}\,\mathrm d\theta\,\rho\mathrm d\rho
\\
&=
\Re\frac a{\pi R^2}\int_0^{R/a}\int_0^{2\pi}\frac1{1-\rho\mathrm e^{-\mathrm i\theta}}\,\mathrm d\theta\,\rho\mathrm d\rho
\\
&=
\Re\frac a{\pi R^2}\int_0^{R/a}\oint\frac1{1-\rho/z}\,\frac{\mathrm dz}{\mathrm iz}\,\rho\mathrm d\rho
\\
&=
\Re\frac a{\pi R^2}\int_0^{R/a}\frac1{\mathrm i}\oint\frac1{z-\rho}\,\mathrm dz\,\rho\mathrm d\rho
\\
&=
\Re\frac a{\pi R^2}\int_0^{R/a}2\pi\rho\,\mathrm d\rho
\\
&=
\frac1a\;,
\end{align}
in agreement with the right-hand side. Note that the contour integral is proportional to the residue at the pole because $r\lt a$. A cylindrical shell of current outside the test point does not contribute to the magnetic field; in this case, $r\gt a$, the contour integral vanishes as it doesn't contain the pole.
My $\infty$ pleasure.
