# Deriving the formula for the magnetic field of a Helmholtz coil by using cylindrical coordinates

I have following problem: I want to calculate the magnetic field inside a Helmholtz coil but instead of using Cartesian coordinates I want use Cylindrical coordinates.
My approach:

The Biot-Savart law states: $$\vec{B}(\vec{r}) = \frac{I}{c} \int \frac{ d\vec{s} \times \vec{r}} {\mid \vec{r} \mid^3}$$

$$\Rightarrow B(r) = \frac{I}{c} \int \frac{ \mid d\vec{s} \times \vec{r} \mid}{\mid \vec{r} \mid^3}$$

Since we are using Cylindrical coordinates:

$$\vec{r} = R \cos( \phi) \vec{e}_x + R \sin(\phi) \vec{e}_y +z \vec{e}_z$$ With $$R$$ being the radius of the coil and $$z$$ being the axis that goes through both the centers of the coils and since $$d \vec{s}$$ points in the direction of the current, we can rewrite it as: $$d\vec{s} = \frac{d \vec{r}}{d \phi} = -R \sin( \phi)\vec{e}_x + R \cos(\phi)\vec{e}_y$$$$\Rightarrow \mid d\vec{s} \times \vec{r} \mid = \sqrt{z^2R^2 + R^4} = R\sqrt{z^2 + R^2}$$ and we also know: $$\mid\vec{r}\mid^3 = (R^2 +z^2)^{\frac{3}{2}}$$

Thus we finally obtain for the first coil at the origin: $$B(z) = \frac{I}{c}\int \frac{R \sqrt{z^2+R^2}}{(R^2 +z^2)^{\frac{3}{2}}} \mid \vec{r} \mid d\phi = \frac{I}{c}\int_0^{2\pi} \frac{R}{\sqrt{R^2 +z^2}} d\phi = \frac{2\pi\ I}{c}\frac{R}{\sqrt{R^2 +z^2}}$$ And for the coil that is positioned at distance $$d$$ we obtain: $$B(z-d) = \frac{2\pi I}{c} \frac{R}{\sqrt{R^2 + (z-d)^2}}$$ We obtain the total magnetic field by adding each magnetic field generated by each coil. $$\Rightarrow B(z)_{total} = \frac{2\pi I}{c} ( \, \frac{R}{\sqrt{R^2 + (z-d)^2}} + \frac{R}{\sqrt{R^2 +z^2}} ) \,$$ However, This result is incorrect.
My best guess is that I missed something while integrating.
Any help is appreciated.

• I think I was missing $\sin( \theta$) the angle between $d\vec{s} \times \vec{r}$, which is equal to $\frac{R}{r}$ – Alessio Popovic Nov 16 '19 at 19:23