# B-Field inside a Current-Carrying Coil

Our goal is to determine the magnitude of the **magnetic field** \( \class{violet}{B} \) within a coil through which a **current** \( \class{red}{I} \) is flowing. The coil has **length** \(l\) and \(N\) **turns**.

To calculate the magnetic field inside, we use the *fourth Maxwell equation of electrostatics in integral form*:

Here \( \class{red}{I} \) is the current enclosed by any closed oriented path \( \mathcal{S} \). We choose \( \mathcal{S} \) so that the integral 1

is as easy as possible to compute. To do this, we form a *rectangular* loop around the coil as shown in Illustration 2.

The path is oriented counterclockwise and is composed of four straight paths \( \class{gray}{\mathcal{S}_{1}} \), \( \class{brown}{\mathcal{S}_{2}} \), \( \class{gray}{\mathcal{S}_{3}} \) and \( \class{brown}{\mathcal{S}_{4}} \). You put the path \( \class{brown}{\mathcal{S}_{4}} \) so that it is inside the coil and the path \( \class{brown}{\mathcal{S}_{2}} \) outside the coil and thus parallel to \( \class{brown}{\mathcal{S}_{4}} \). Thus the integral to be solved becomes:

&~+~ \int_{\class{gray}{\mathcal{S}_{3}}} \class{violet}{\boldsymbol{B}} \cdot \text{d}\boldsymbol{s}_{3} ~+~ \int_{\class{brown}{\mathcal{S}_{4}}} \class{violet}{\boldsymbol{B}} \cdot \text{d}\boldsymbol{s}_{4} \end{align} $$

The first and the third integral over \( \class{gray}{\mathcal{S}_{1}} \) and \( \class{gray}{\mathcal{S}_{3}} \) are zero, because the magnetic field is perpendicular to the respective path and the scalar product in the integral vanishes. The other two integrals remain:

We choose a rectangular loop such that the paths \( \class{gray}{\mathcal{S}_{1}} \) and \( \class{gray}{\mathcal{S}_{3}} \) are *very long*. Thus the integral over \( \class{brown}{\mathcal{S}_{2}} \) is omitted because it is so far away from the coil that the magnetic field is approximately zero at this distance. What remains is only the integral over the path \( \class{brown}{\mathcal{S}_{4}} \) inside the coil:

Since the coil usually has \( N \) turns, the current "passes through" the loop \( N \)-times. The current contribution \( \class{red}{I} \) is \(N\)-times:

We assume that the magnetic field \( \class{violet}{\boldsymbol{B}} ~=~ \class{violet}{B} \, \boldsymbol{\hat{e}}_{4} \) inside is *constant*. This allows us to pull it out of the integral:

We oriented the coil so that the unit vector \( \boldsymbol{\hat{e}}_{4} \), which specifies the magnetic field direction, is *parallel* to the infinitesimal path \( \text{d}\boldsymbol{s}_{4} = \text{d}s_{4} \, \boldsymbol{\hat{e}}_{4} \). Thus the scalar product between the unit vectors is \( \boldsymbol{\hat{e}}_{4} \cdot \boldsymbol{\hat{e}}_{4} = 1 \):

&~=~ \class{violet}{B} \, l \end{align} $$

Here, in the second step, we exploited the fact that the integration path \( \class{brown}{\mathcal{S}_{4}} \) runs along the coil and thus corresponds to the 7

for the magnetic field magnitude \( \class{violet}{B} \):

With this you can calculate the magnetic field of a long coil (long, so that boundary effects do not play a role) or rearrange the formula and calculate \( N \), \(l\) or \(\class{red}{I}\), depending on what you are looking for.