11.2 Magnetic Fields by Superposition
11.2.1 Superposition of straight wires
In chapter 10, one of the most important goals was to learn how to calculate the electric field for a given charge distribution. The corresponding problem for magnetism would be to calculate the magnetic field arising from a given set of currents. So far, however, we only know how to calculate the magnetic field of a long, straight wire,
\[\begin{equation*} B = \frac{2kI}{c^2R} , \end{equation*}\]
with the geometry shown in figure a.
Whereas a charge distribution can be broken down into individual point charges, most currents cannot be broken down into a set of straightline currents. Nevertheless, let's see what we can do with the tools that we have.
Example 7: A ground fault interrupter 

Electric current in your home is supposed to flow out of one side of the outlet, through an appliance, and back into the wall through the other side of the outlet. If that's not what happens, then we have a problem  the current must be finding its way to ground through some other path, perhaps through someone's body. If you have outlets in your home that have “test” and “reset” buttons on them, they have a safety device built into them that is meant to protect you in this situation. The ground fault interrupter (GFI) shown in figure b, routes the outgoing and returning currents through two wires that lie very close together. The clockwise and counterclockwise fields created by the two wires combine by vector addition, and normally cancel out almost exactly. However, if current is not coming back through the circuit, a magnetic field is produced. The doughnutshaped collar detects this field (using an effect called induction, to be discussed in section 11.5), and sends a signal to a logic chip, which breaks the circuit within about 25 milliseconds. 
Example 8: An example with vector addition 

\(\triangleright\) Two long, straight wires each carry current \(I\) parallel to the \(y\) axis, but in opposite directions. They are separated by a gap \(2 h\) in the \(x\) direction. Find the magnitude and direction of the magnetic field at a point located at a height \(z\) above the plane of the wires, directly above the center line. \(\triangleright\) The magnetic fields contributed by the two wires add like vectors, which means we can add their \(x\) and \(z\) components. The \(x\) components cancel by symmetry. The magnitudes of the individual fields are equal, \[\begin{equation*} B_1 = B_2 = \frac{2 kI}{ c^2 R} ,\\ \end{equation*}\] so the total field in the \(z\) direction is \[\begin{equation*} B_{z} = 2\frac{2 kI}{ c^2 R}\text{sin}\:\theta ,\\ \end{equation*}\] where \(\theta\) is the angle the field vectors make above the \(x\) axis. The sine of this angle equals \(h/ R\), so \[\begin{equation*} B_{z} = \frac{4 kIh}{ c^2 R^2} .\\ \end{equation*}\] (Putting this explicitly in terms of \(z\) gives the less attractive form \(B_{z}=4 kIh/ c^2( h^2+ z^2)\).) At large distances from the wires, the individual fields are mostly in the \(\pm x\) direction, so most of their strength cancels out. It's not surprising that the fields tend to cancel, since the currents are in opposite directions. What's more interesting is that not only is the field weaker than the field of one wire, it also falls off as \(R^{2}\) rather than \(R^{1}\). If the wires were right on top of each other, their currents would cancel each other out, and the field would be zero. From far away, the wires appear to be almost on top of each other, which is what leads to the more drastic \(R^{2}\) dependence on distance. 
selfcheck:
In example 8, what is the field right between the wires, at \(z=0\), and how does this simpler result follow from vector addition?
(answer in the back of the PDF version of the book)
An alarming infinity
An interesting aspect of the \(R^{2}\) dependence of the field in example 8 is the energy of the field. We've already established on p. 588 that the energy density of the magnetic field must be proportional to the square of the field strength, \(B^2\), the same as for the gravitational and electric fields. Suppose we try to calculate the energy per unit length stored in the field of a single wire. We haven't yet found the proportionality factor that goes in front of the \(B^2\), but that doesn't matter, because the energy per unit length turns out to be infinite! To see this, we can construct concentric cylindrical shells of length \(L\), with each shell extending from \(R\) to \(R+dR\). The volume of the shell equals its circumference times its thickness times its length, \(dv=(2\pi R)(dR)(L)=2\pi LdR\). For a single wire, we have \(B\sim R^{1}\), so the energy density is proportional to \(R^{2}\), and the energy contained in each shell varies as \(R^{2}dv\sim R^{1}dr\). Integrating this gives a logarithm, and as we let \(R\) approach infinity, we get the logarithm of infinity, which is infinite.
Taken at face value, this result would imply that electrical currents could never exist, since establishing one would require an infinite amount of energy per unit length! In reality, however, we would be dealing with an electric circuit, which would be more like the two wires of example 8: current goes out one wire, but comes back through the other. Since the field really falls off as \(R^{2}\), we have an energy density that varies as \(R^{4}\), which does not give infinity when integrated out to infinity. (There is still an infinity at \(R=0\), but this doesn't occur for a real wire, which has a finite diameter.)
Still, one might worry about the physical implications of the singlewire result. For instance, suppose we turn on an electron gun, like the one in a TV tube. It takes perhaps a microsecond for the beam to progress across the tube. After it hits the other side of the tube, a return current is established, but at least for the first microsecond, we have only a single current, not two. Do we have infinite energy in the resulting magnetic field? No. It takes time for electric and magnetic field disturbances to travel outward through space, so during that microsecond, the field spreads only to some finite value of \(R\), not \(R=\infty\).
This reminds us of an important fact about our study of magnetism so far: we have only been considering situations where the currents and magnetic fields are constant over time. The equation \(B = 2kI/c^2R\) was derived under this assumption. This equation is only valid if we assume the current has been established and flowing steadily for a long time, and if we are talking about the field at a point in space at which the field has been established for a long time. The generalization to timevarying fields is nontrivial, and qualitatively new effects will crop up. We have already seen one example of this on page 598, where we inferred that an inductor's timevarying magnetic field creates an electric field  an electric field which is not created by any charges anywhere. Effects like these will be discussed in section 11.5
A sheet of current
There is a saying that in computer science, there are only three nice numbers: zero, one, and however many you please. In other words, computer software shouldn't have arbitrary limitations like a maximum of 16 open files, or 256 email messages per mailbox. When superposing the fields of long, straight wires, the really interesting cases are one wire, two wires, and infinitely many wires. With an infinite number of wires, each carrying an infinitesimal current, we can create sheets of current, as in figure d.
Such a sheet has a certain amount of current per unit length, which we notate \(\eta\) (Greek letter eta). The setup is similar to example 8, except that all the currents are in the same direction, and instead of adding up two fields, we add up an infinite number of them by doing an integral. For the \(y\) component, we have
\[\begin{align*} B_y &= \int \frac{2kdI}{c^2R}\cos\theta \\ &= \int_{a}^{b} \frac{2k\eta dy}{c^2R}\cos\theta \\ &= \frac{2k\eta}{c^2} \int_{a}^{b} \frac{\cos\theta}{R}dy \\ &= \frac{2k\eta}{c^2} \int_{a}^{b}\: \frac{zdy}{y^2+z^2} \\ &= \frac{2k\eta}{c^2} \left(\tan^{1}\frac{b}{z}\tan^{1}\frac{a}{z}\right) \\ &= \frac{2k\eta\gamma}{c^2} , \end{align*}\]
where in the last step we have used the identity \(\tan^{1}(x)=\tan^{1}x\), combined with the relation \(\tan^{1}b/z+\tan^{1}a/z=\gamma\), which can be verified with a little geometry and trigonometry. The calculation of \(B_z\) is left as an exercise (problem 23). More interesting is what happens underneath the sheet: by the righthand rule, all the currents make rightward contributions to the field there, so \(B_y\) abruptly reverses itself as we pass through the sheet.
Close to the sheet, the angle \(\gamma\) approaches \(\pi\), so we have
\[\begin{equation*} B_y = \frac{2\pi k\eta}{c^2} . \end{equation*}\]
Figure e shows the similarity between this result and the result for a sheet of charge. In one case the sources are charges and the field is electric; in the other case we have currents and magnetic fields. In both cases we find that the field changes suddenly when we pass through a sheet of sources, and the amount of this change doesn't depend on the size of the sheet. It was this type of reasoning that eventually led us to Gauss' law in the case of electricity, and in section 11.3 we will see that a similar approach can be used with magnetism. The difference is that, whereas Gauss' law involves the flux, a measure of how much the field spreads out, the corresponding law for magnetism will measure how much the field curls.
Is it just dumb luck that the magneticfield case came out so similar to the electric field case? Not at all. We've already seen that what one observer perceives as an electric field, another observer may perceive as a magnetic field. An observer flying along above a charged sheet will say that the charges are in motion, and will therefore say that it is both a sheet of current and a sheet of charge. Instead of a pure electric field, this observer will experience a combination of an electric field and a magnetic one. (We could also construct an example like the one in figure c on page 648, in which the field was purely magnetic.)
11.2.2 Energy in the magnetic field
In section 10.4, I've already argued that the energy density of the magnetic field must be proportional to \(\mathbf{B}^2\), which we can write as \(B^2\) for convenience. To pin down the constant of proportionality, we now need to do something like the argument on page 582: find one example where we can calculate the mechanical work done by the magnetic field, and equate that to the amount of energy lost by the field itself. The easiest example is two parallel sheets of charge, with their currents in opposite directions. Homework problem 53 is such a calculation, which gives the result
11.2.3 Superposition of dipoles
To understand this subsection, you'll have to have studied section 4.2.4, on iterated integrals.
The distant field of a dipole, in its midplane
Most current distributions cannot be broken down into long, straight wires, and subsection 11.2.1 has exhausted most of the interesting cases we can handle in this way. A much more useful building block is a square current loop. We have already seen how the dipole moment of an irregular current loop can be found by breaking the loop down into square dipoles (figure l on page 654), because the currents in adjoining squares cancel out on their shared edges.
Likewise, as shown in figure f, if we could find the magnetic field of a square dipole, then we could find the field of any planar loop of current by adding the contributions to the field from all the squares.
The field of a squareloop dipole is very complicated close up, but luckily for us, we only need to know the current at distances that are large compared to the size of the loop, because we're free to make the squares on our grid as small as we like. The distant field of a square dipole turns out to be simple, and is no different from the distant field of any other dipole with the same dipole moment. We can also save ourselves some work if we only worry about finding the field of the dipole in its own plane, i.e., the plane perpendicular to its dipole moment. By symmetry, the field in this plane cannot have any component in the radial direction (inward toward the dipole, or outward away from it); it is perpendicular to the plane, and in the opposite direction compared to the dipole vector. (The field inside the loop is in the same direction as the dipole vector, but we're interested in the distant field.) Letting the dipole vector be along the \(z\) axis, we find that the field in the \(xy\) plane is of the form \(B_z=f(r)\), where \(f(r)\) is some function that depends only on \(r\), the distance from the dipole.
We can pin down the result even more without any math. We know that the magnetic field made by a current always contains a factor of \(k/c^2\), which is the coupling constant for magnetism. We also know that the field must be proportional to the dipole moment, \(m=IA\). Fields are always directly proportional to currents, and the proportionality to area follows because dipoles add according to their area. For instance, a square dipole that is 2 micrometers by 2 micrometers in size can be cut up into four dipoles that are 1 micrometer on a side. This tells us that our result must be of the form \(B_z=(k/c^2)(IA)g(r)\). Now if we multiply the quantity \((k/c^2)(IA)\) by the function \(g(r)\), we have to get units of teslas, and this only works out if \(g(r)\) has units of \(\text{m}^{3}\) (homework problem 15), so our result must be of the form
where \(\beta\) is a unitless constant. Thus our only task is to determine \(\beta\), and we will have determined the field of the dipole (in the plane of its current, i.e., the midplane with respect to its dipole moment vector).
If we wanted to, we could simply build a dipole, measure its field, and determine \(\beta\) empirically. Better yet, we can get an exact result if we take a current loop whose field we know exactly, break it down into infinitesimally small squares, integrate to find the total field, set this result equal to the known expression for the field of the loop, and solve for \(\beta\). There's just one problem here. We don't yet know an expression for the field of any current loop of any shape  all we know is the field of a long, straight wire. Are we out of luck?
No, because, as shown in figure g, we can make a long, straight wire by putting together square dipoles! Any square dipole away from the edge has all four of its currents canceled by its neighbors. The only currents that don't cancel are the ones on the edge, so by superimposing all the square dipoles, we get a straightline current.
This might seem strange. If the squares on the interior have all their currents canceled out by their neighbors, why do we even need them? Well, we need the squares on the edge in order to make the straightline current. We need the second row of squares to cancel out the currents at the top of the first row of squares, and so on.
Integrating as shown in figure h, we have
This is the field of a wire, which we already know equals \(2kI/c^2R\), so we have \(\beta\)=1. Remember, the point of this whole calculation was not to find the field of a wire, which we already knew, but to find the unitless constant \(\beta\) in the expression for the field of a dipole. The distant field of a dipole, in its midplane, is therefore \(B_z=\beta kIA/c^2r^3= kIA/c^2r^3\), or, in terms of the dipole moment,
The distant field of a dipole, out of its midplane
What about the field of a magnetic dipole outside of the dipole's midplane? Let's compare with an electric dipole. An electric dipole, unlike a magnetic one, can be built out of two opposite monopoles, i.e., charges, separated by a certain distance, and it is then straightforward to show by vector addition that the field of an electric dipole is
where \(r\) is the distance from the dipole to the point of interest, \(\theta\) is the angle between the dipole vector and the line connecting the dipole to this point, and \(E_z\) and \(E_R\) are, respectively, the components of the field parallel to and perpendicular to the dipole vector.
In the midplane, \(\theta\) equals \(\pi/2\), which produces \(E_z=kDr^{3}\) and \(E_R=0\). This is the same as the field of a magnetic dipole in its midplane, except that the electric coupling constant \(k\) replaces the magnetic version \(k/c^2\), and the electric dipole moment \(D\) is substituted for the magnetic dipole moment \(m\). It is therefore reasonable to conjecture that by using the same prestochangeo recipe we can find the field of a magnetic dipole outside its midplane:
This turns out to be correct. ^{5}
Example 9: Concentric, counterrotating currents 

\(\triangleright\) Two concentric circular current loops, with radii \(a\) and \(b\), carry the same amount of current \(I\), but in opposite directions. What is the field at the center? \(\triangleright\) We can produce these currents by tiling the region between the circles with square current loops, whose currents all cancel each other except at the inner and outer edges. The flavor of the calculation is the same as the one in which we made a line of current by filling a halfplane with square loops. The main difference is that this geometry has a different symmetry, so it will make more sense to use polar coordinates instead of \(x\) and \(y\). The field at the center is \[\begin{align*} B_{z} &= \int \frac{ kI}{ c^2 r^3}dA \\ &= \int_{ r= a}^{b}\frac{ kI}{ c^2 r^3}\:\cdot2\pi rdr \\ &= \frac{2\pi kI}{ c^2}\:\left(\frac{1}{a}\frac{1}{b}\right) . \end{align*}\] The positive sign indicates that the field is out of the page. 
Example 10: Field at the center of a circular loop 

\(\triangleright\) What is the magnetic field at the center of a circular current loop of radius \(a\), which carries a current \(I\)? \(\triangleright\) This is like example 9, but with the outer loop being very large, and therefore too distant to make a significant field at the center. Taking the limit of that result as \(b\) approaches infinity, we have \[\begin{equation*} B_{z} = \frac{2\pi kI}{ c^2 a} \end{equation*}\] 
Comparing the results of examples 9 and 10, we see that the directions of the fields are both out of the page. In example 9, the outer loop has a current in the opposite direction, so it contributes a field that is into the page. This, however, is weaker than the field due to the inner loop, which dominates because it is less distant.
11.2.4 The BiotSavart law (optional)
In section 11.2.3 we developed a method for finding the field due to a given current distribution by tiling a plane with square dipoles. This method has several disadvantages:
 The currents all have to lie in a single plane, and the point at which we're computing the field must be in that plane as well.
 We need to do integral over an area, which means one integral inside another, e.g., \(\int\int...dxdy\). That can get messy.
 It's physically bizarre to have to construct square dipoles in places where there really aren't any currents.
Figure k shows the first step in eliminating these defects: instead of spreading our dipoles out in a plane, we bring them out along an axis.
As shown in figure l, this eliminates the restriction to currents that lie in a plane. Now we have to use the general equations for a dipole field from page 668, rather than the simpler expression for the field in the midplane of a dipole. This increase in complication is more than compensated for by a fortunate feature of the new geometry, which is that the infinite tube can be broken down into strips, and we can find the field of such a strip for once and for all. This means that we no longer have to do one integral inside another. The derivation of the most general case is a little messy, so I'll just present the case shown in figure m, where the point of interest is assumed to lie in the \(yz\) plane.
Intuitively, what we're really finding is the field of the short piece of length \(d\ell\) on the end of the U; the two long parallel segments are going to be canceled out by their neighbors when we assemble all the strips to make the tube. We expect that the field of this endpiece will form a pattern that circulates around the \(y\) axis, so at the point of interest, it's really the \(x\) component of the field that we want to compute:
In the more general case, l, the current loop is not planar, the point of interest is not in the endplanes of the U's, and the U shapes have their ends staggered, so the endpiece \(d\ell\) is not the only part of each U whose current is not canceled. Without going into the gory details, the correct general result is as follows:
which is known as the BiotSavart law. (It rhymes with “leo bazaar.” Both t's are silent.)
The distances \(d\ell\) and \( r\) are now defined as vectors, \(d\boldsymbol{\ell}\) and \(\mathbf{r}\), which point, respectively, in the direction of the current in the endpiece and the direction from the endpiece to the point of interest. The new equation looks different, but it is consistent with the old one. The vector cross product \(d\boldsymbol{\ell}\times\mathbf{r}\) has a magnitude \(rd \ell\:\sin\phi\), which cancels one of \(r\)'s in the denominator and makes the \(d \boldsymbol{\ell}\times\mathbf{r}/r^3\) into a vector with magnitude \(d \ell\:\sin\phi/r^2\).
Example 11: The field at the center of a circular loop 

Previously we had to do quite a bit of work (examples 9 and 10), to calculate the field at the center of a circular loop of current of radius \(a\). It's much easier now. Dividing the loop into many short segments, each \(d\boldsymbol{\ell}\) is perpendicular to the \(\mathbf{r}\) vector that goes from it to the center of the circle, and every \(\mathbf{r}\) vector has magnitude \(a\). Therefore every cross product \(d\boldsymbol{\ell}\times\mathbf{r}\) has the same magnitude, \(ad \ell\), as well as the same direction along the axis perpendicular to the loop. The field is \[\begin{align*} B &= \int \frac{ kIad \ell}{ c^2 a^3}\\ &= \frac{ kI}{ c^2 a^2} \int d \ell \\ &= \frac{ kI}{ c^2 a^2} (2\pi a) \\ &= \frac{2\pi kI}{ c^2 a} \\ \end{align*}\] 
Example 12: Outoftheplane field of a circular loop 

\(\triangleright\) What is the magnetic field of a circular loop of current at a point on the axis perpendicular to the loop, lying a distance \(z\) from the loop's center? \(\triangleright\) Again, let's write \(a\) for the loop's radius. The r vector now has magnitude \(\sqrt{ a^2+ z^2}\), but it is still perpendicular to the \(d\boldsymbol{\ell}\) vector. By symmetry, the only nonvanishing component of the field is along the \(z\) axis, \[\begin{align*} B_{z} &= \int d\mathbf{B}\:\text{cos}\:\alpha\\ &= \int \frac{ kI\,r\,d \ell}{ c^2 r^3}\frac{ a}{ r}\\ &= \frac{ kIa}{ c^2 r^3} \int d \ell \\ &= \frac{2\pi kIa^2}{ c^2( a^2+ z^2)^{3/2}} . \end{align*}\]

Is it the field of a particle?
We have a simple equation, based on Coulomb's law, for the electric field surrounding a charged particle. Looking at figure n, we can imagine that if the current segment \(d\ell\) was very short, then it might only contain one electron. It's tempting, then, to interpret the BiotSavart law as a similar equation for the magnetic field surrounding a moving charged particle. Tempting but wrong! Suppose you stand at a certain point in space and watch a charged particle move by. It has an electric field, and since it's moving, you will also detect a magnetic field on top of that. Both of these fields change over time, however. Not only do they change their magnitudes and directions due to your changing geometric relationship to the particle, but they are also timedelayed, because disturbances in the electromagnetic field travel at the speed of light, which is finite. The fields you detect are the ones corresponding to where the particle used to be, not where it is now. Coulomb's law and the BiotSavart law are both false in this situation, since neither equation includes time as a variable. It's valid to think of Coulomb's law as the equation for the field of a stationary charged particle, but not a moving one. The BiotSavart law fails completely as a description of the field of a charged particle, since stationary particles don't make magnetic fields, and the BiotSavart law fails in the case where the particle is moving.
If you look back at the long chain of reasoning that led to the BiotSavart law, it all started from the relativistic arguments at the beginning of this chapter, where we assumed a steady current in an infinitely long wire. Everything that came later was built on this foundation, so all our reasoning depends on the assumption that the currents are steady. In a steady current, any charge that moves away from a certain spot is replaced by more charge coming up behind it, so even though the charges are all moving, the electric and magnetic fields they produce are constant. Problems of this type are called electrostatics and magnetostatics problems, and it is only for these problems that Coulomb's law and the BiotSavart law are valid.
You might think that we could patch up Coulomb's law and the BiotSavart law by inserting the appropriate time delays. However, we've already seen a clear example of a phenomenon that wouldn't be fixed by this patch: on page 598, we found that a changing magnetic field creates an electric field. Induction effects like these also lead to the existence of light, which is a wave disturbance in the electric and magnetic fields. We could try to apply another bandaid fix to Coulomb's law and the BiotSavart law to make them deal with induction, but it won't work.
So what are the fundamental equations that describe how sources give rise to electromagnetic fields? We've already encountered two of them: Gauss' law for electricity and Gauss' law for magnetism. Experiments show that these are valid in all situations, not just static ones. But Gauss' law for magnetism merely says that the magnetic flux through a closed surface is zero. It doesn't tell us how to make magnetic fields using currents. It only tells us that we can't make them using magnetic monopoles. The following section develops a new equation, called Ampère's law, which is equivalent to the BiotSavart law for magnetostatics, but which, unlike the BiotSavart law, can easily be extended to nonstatic situations.
Contributors
 Benjamin Crowell (Fullerton College), Conceptual Physics