Chapter 21 - Sources of magnetic field
21.1Overview¶
print("Here is a Python cell")
print("Another code cell with a second optional metadata syntax")
In this chapter, we develop the tools to model the magnetic field that is produced by an electric current. We will introduce the Biot-Savart Law, which is analoguous to Coulomb’s Law in that it can be used to calculate the magnetic field produced by any current. We will also introduce Ampère’s Law, which can be thought of as the analogue to Gauss’ Law, allowing us to easily determine the magnetic field when there is a high degree of symmetry.
21.2The Biot-Savart Law¶
The Biot-Savart law allows us to determine the magnetic field at some position in space that is due to an electric current. More precisely, the Biot-Savart law allows us to calculate the infinitesimal magnetic field, , that is produced by a small section of wire, , carrying a current, , such that is co-linear with the wire and points in the direction of the electric current:
where is the vector from the element of wire, , to the point where we would like to determine the magnetic field, as illustrated in Figure 1. is a constant of proportionality called the “permeability of free space”, and has the value .
The Biot-Savart Law has some similarities with the Coulomb Law to calculate the electric field, as the magnitude of the magnetic field decreases as the inverse of the square distance between the source and the field. However, it can only be expressed in differential form (i.e. as an infinitesimal) and it requires working in three dimensions because of the cross product. It is usually more convenient to use the Biot-Savart Law in the form:
where the unit vector was replaced by .
The procedure for applying the Biot-Savart Law is as follows:
- Make a really good diagram, as you will have to include some 3D aspects.
- Choose an infinitesimal section of wire, .
- Determine the vector .
- Determine the cross-product, , which will point in the direction of the magnetic field from that infinitesimal section of wire.
- Write out the infinitesimal vector , and determine its components.
- Think about symmetry! As you sum the , will some components cancel? If yes, you do not need to do those integrals.
- Determine the total magnetic field, component by component, by summing (integrating) the components of over the wire.
21.2.1Magnetic field from a straight current-carrying wire¶
In this section, we use the Biot-Savart Law to determine the magnetic field a distance, , from the centre of a finite straight wire of length , carrying current , as illustrated in Figure 2.
We start by choosing an infinitesimal element of wire, , a distance above the centre of the wire, as shown (we choose the origin to be located at the centre of the wire). The vector is thus given by:
The vector, , from to the point at which we would like to know the magnetic field is given by:
The cross-product between and is easily found with the right-hand rule to point into the page (corresponding to the negative direction). The magnitude of the cross-product is given by:
where is the angle between and , so that . The cross-product can thus be written in terms of θ as:
Note that we can also determine the cross-product algebraically instead of using the right-hand rule and the magnitude:
The infinitesimal magnetic field element, , is given by:
Any segment along the wire will result in a magnetic field that is into the page (negative direction), thus there will be no cancellations due to any symmetries. We can now proceed to perform the integral.
We can use either θ or to label the wire elements and carry out the integration. We will choose to integrate over θ, requiring us to express and in terms of θ (and constants), as those are the only quantities in that depend on the position of . In order to express in terms of , we first relate θ to , the position of the wire element:
and is given by:
Putting this altogether into :
We define the angle, , to be the maximum amplitude of the angle θ when integrating over the wire (see Figure 2), so that we integrate θ from to :
Using the given dimensions:
Thus, the magnetic field, , a distance, , from the centre of a wire of length, , carrying current, , in the positive direction is given by:
The magnetic field must be rotationally symmetric; that is, if the wire is vertical, the magnetic field at a distance must look the same regardless of the angle from which we view the vertical wire (we should always see the magnetic field going into the page at the point that we use in Figure 2). Thus, the magnetic field lines must form circles around the wire, as illustrated in Figure 3. Note that the direction of the magnetic field is given by the right-hand rule for axial vectors; when you align your thumb with the current, your fingers curl in the direction of the magnetic field.
It is of particular interest to investigate the limiting case of an infinitely long wire, in the limit of , or equivalently, . The latter is easiest to evaluate, since . The magnitude of the magnetic field, , a distance, , from an infinite wire carrying current, , is given by:
One can often make the approximation that the wire is infinite in length, when the distance, , is small compared to the length, , of the wire.
21.2.2Magnetic field from a circular current-carrying wire¶
In this section, we examine the magnetic field that is created by a circular current-carrying loop of wire. We can determine the shape of the magnetic field, by considering small sections as straight wires, with circular magnetic field lines around them. As we move closer to the centre of the ring, those fields sum together, as illustrated in Figure 4. Note that the magnetic field from a loop of current is identical to that from a bar magnet (as a bar magnet is, of course, a collection of current loops).
Below, we use the Biot-Savart Law to derive an expression for the magnitude of the magnetic field at a distance, , from the centre of a ring of radius, , along its axis of symmetry, when there is a current, , in the ring. While the mathematics are much easier than the case for the straight wire, the challenge in this case is to visualize the calculation in three dimensions! Figure 5 shows the loop of current, as well as our choice of coordinate system (with the origin at the centre of the ring). In particular, we wish to calculate the magnetic field at a distance, , along the axis. The axis goes into the page.
In order to apply the Biot-Savart Law, we choose an element, , of wire at the top of the ring, as illustrated. At this position, the element, , points in the positive direction (into the page):
The vector, , from the wire element to the point where we wish to determine the magnetic field is given by:
and the angle θ will be the same for all wire elements along the ring. The cross-product, , can be evaluated algebraically:
so that the element of magnetic field, , corresponding to that choice of , will lie in the plane, as illustrated in Figure 5. Note that the vector is perpendicular to the vector (since it is the cross-product of with another vector). The magnetic field element, , is given by:
As the wire element, , moves around the circle, the tip of the resulting magnetic field vector element traces a circle centred on the axis, as illustrated in Figure 6. Note that, in general, will also have an component (the component was only 0 before because we chose to be at the top of the ring). When we sum together the magnetic field elements, the and components will cancel, so that we are left with the component.
The total magnetic field will be in the negative direction, as anticipated from Figure 4. Summing together the components of the infinitesimal magnetic fields:
Note that in this case, both and θ are constant for all of the , allowing us to take them out of the integral. The integral is then just a sum of the elements, which must add up to the circumference of the ring:
In terms of the variables that we are given:
In this case, the math was relatively straightforward (no substitutions to evaluate the integral), however it is challenging to visualize the problem in three dimensions.
21.3Force between two current-carrying wires¶
Consider two infinite parallel straight wires, a distance apart, carrying upwards currents, and , respectively, as illustrated in Figure 7.
The first wire will create a magnetic field, , in the shape of circles concentric with the wire. At the position of the second wire, the magnetic field is into the page, and has a magnitude:
Since the second wire carries a current, , upwards, it will experience a magnetic force, , from the magnetic field, , that is towards the left (as illustrated in Figure 7 and determined from the right-hand rule). The magnetic force, , exerted on a section of length, , on the second wire has a magnitude given by:
where we used the fact that the angle between and is . We expect, from Newton’s Third Law, that an equal and opposite force should be exerted on the first wire. Indeed, the second wire will create a magnetic field, , that is out of the page at the location of the first wire, with magnitude:
This leads to a magnetic force, , exerted on the first wire, that points to the right (from the right-hand rule). On a section of length, , of the first wire, the magnetic force from the magnetic field, , has magnitude:
which does indeed have the same magnitude as the force exerted on the second wire. Thus, when two parallel wires carry current in the same direction, they exert equal and opposite attractive forces on each other.
The attractive force between two wires used to be the basis for defining the Ampère, the S.I. (base) unit for electric current. Before 2019, the Ampère was defined to be “that constant current which, if maintained in two straight parallel conductors of infinite length, of negligible circular cross-section, and placed one metre apart in vacuum, would produce between these conductors a force equal to per metre of length”. Recently, the definition was updated to be based on defining the Coulomb in such a way that the elementary charge has a numerical value of , and the Ampère corresponds to one Coulomb per second.
The force between two wires is a good system to understand how any physical quantity cannot depend on our choice of the right-hand to define cross-products. As mentioned in the previous chapter, any physical quantity, such as the direction of the force exerted on a wire, will always depend on two successive uses of the right hand. In this system, we first used the right-hand rule for axial vectors to determine the direction of the magnetic field from one of the wires. We then used the right-hand rule to determine the direction of the cross-product to determine the direction of the force on the other wire. You can verify that you get the same answer if you, instead, use your left-hand to define the direction of the magnetic field (which will be in the opposite direction), and then again for the cross-product. This also highlights that the magnetic field (and the electric field) is just a mathematical tool that we use to, ultimately, describe the motion of charges or compass needles.
21.4Ampère’s Law¶
Ampère’s Law is similar to Gauss’ Law, as it allows us to (analytically) determine the magnetic field that is produced by an electric current in configurations that have a high degree of symmetry. Ampère’s Law states:
where the integral on the left is a “path integral”, similar to how we calculate the work done by a force over a particular path. The circle sign on the integral means that this is an integral over a “closed” path; a path where the starting and ending points are the same. is the net current that crosses the surface that is defined by the closed path, often called the “current enclosed” by the path. This is different from Gauss’ Law, where the integral is over a closed surface (not a closed path, as it is here). In the context of Gauss’ Law, we refer to “calculating the flux of the electric field through a closed surface”; in the context of Ampère’s Law, we refer to “calculating the circulation of the magnetic field along a closed path”.
We apply Ampère’s Law in much the same way as we apply Gauss’ Law:
- Make a good diagram, identify symmetries.
- Choose a closed path over which to calculate the circulation of the magnetic field (see below for how to choose the path). The path is often called an “Amperian loop” (think “Gaussian surface”).
- Evaluate the circulation integral.
- Determine how much current is “enclosed” by the Amperian loop.
- Apply Ampère’s Law.
Similarly to Gauss’ Law, we need to choose the path (instead of the surface) over which we will evaluate the integral. The integral will be easy to evaluate if:
- The angle between and is constant along the path, so that:
where θ is the angle between and .
- The magnitude of is constant along the path, so that:
Choosing a path that meets these two conditions is only possible if there is a high degree of symmetry.
Consider an infinitely long straight wire, carrying current, , out of the page, as illustrated in Figure 10. The magnetic field from the wire must look the same regardless of the angle from which we view the wire (“azimuthal symmetry”). Thus, the magnetic field must either form concentric circles around the wire (which we know is the case from the Biot-Savart Law) or it must be in the radial direction (pointing towards or away from the wire). These two possibilities are illustrated in Figure 10, and we will pretend, for now, that we do not know which is correct.
In order to apply Ampère’s Law, we choose an Amperian loop (instead of a “Gaussian surface”). In the case of an infinite current-carrying wire, a circle that is concentric with the wire will meet the properties above, regardless of the two possible configurations of the magnetic field: with a circular Amperian loop, the angle between the magnetic field and the element is constant along the entire loop, and the magnitude of the magnetic field is constant along the loop. Our choice of loop is illustrated in Figure 11, where we have illustrated the magnetic field for the case where it forms concentric circles.
The circulation of the magnetic field along a circular path of radius, , is given by:
where is 1 if the field forms circles (correct) or 0 if the field is radial (incorrect). We can now evaluate the current that is enclosed by the Amperian loop. The current that is enclosed is given by the net current that traverses the surface defined by the Amperian loop (in this case, a circle of radius ). Since the loop encloses the entire wire, the enclosed current is simply . Applying Ampère’s Law:
At this point, it is clear that cannot be zero, since the right-hand side of the equation is not zero. We can thus conclude that the magnetic field must indeed make concentric circles, as we had previously determined. The magnitude of the magnetic field is given by:
as we found previously with the Biot-Savart Law. Again, in analogy with Gauss’ Law, one needs to apply some knowledge of symmetry and argue in which direction the magnetic field should point, in order to use Ampère’s Law effectively.
21.4.1Interpretation of Ampère’s Law and vector calculus¶
In this section, we discuss Ampère’s Law in the context of vector calculus and provide a different perspective, mostly for informational purposes. The integral that appears in Ampère’s Law is called the “circulation” of the vector field, :
The circulation, as its name implies, is a measure of “how much rotation there is in the field”. To visualize this, imagine that the vector field is a velocity field for points in a fluid. Regions of the fluid where there are little whirlpools (so called “eddies”), correspond to regions of the field with non-zero circulation (the sign of the integral tells us the direction of rotation, using the right-hand rule for axial vectors). Examples of field with and without circulation are shown in Figure 14. You will recognize that static electric charges create electric fields with no circulation (right panel), whereas static currents create magnetic fields with circulation.
Ampère’s Law is thus a statement that an electric current will result in a field with a magnitude proportional to the current, that has some degree of rotation to it. The direction of rotation of that field corresponds to the right-hand rule for axial vectors as applied to the current (your thumb points in the direction of the current so that your fingers curl in the direction of the rotation of the associated field).
Circulation, as defined by the integral over a closed loop, is not a local property of the field, since it depends on what the field is doing as a whole over the path of the loop. Just as one can obtain a “local” version of Gauss’ Law, one can also obtain a local version of Ampère’s Law using techniques from advanced vector calculus (that are beyond the scope of this textbook).
Stokes’ theorem allows one to convert the circulation integral (a path integral on a closed loop) into a integral over the (open) surface that is defined by the loop:
where the subscript indicates that the integral is over a one-dimensional path, whereas the subscript indicates that the integral is over a two-dimensional surface. The term, , is called the “curl” of the magnetic field and is a local measure of the amount of rotation in the field. Applying Stokes’ theorem to Ampère’s Law yield:
Note that we can also write the current, , that is enclosed by the loop as the integral of the current density, , over the surface defined by the loop:
Thus, we can write Ampère’s Law with integrals over the same surface on either side of the equation, implying that the integrands must be the same:
This last equation now relates a local property (current density) to the magnetic field at that point, and is the usual form in which Ampère’s Law is presented (the so-called “differential form”, rather than the “integral form”).
The curl of the magnetic field, , is a vector that is given by the following:
and the name “curl” is chosen because this is a measure of the amount of rotation (curl) in the field. In differential form, Ampère’s Law can read as: “a current density will create a (magnetic) field that has non-zero curl”.
Since Ampère’s Law in differential form is a vector equation (both sides are vectors), it really corresponds to three equations in Cartesian coordinates, one per component. For example, the component of the equation is a “partial differential equation” for the and components of the magnetic field:
that is in general difficult to solve without a computer (and all three equations are required, as these are “coupled”, since a given component of the magnetic field appears in two of three equations).
21.5Solenoids and toroids¶
In order to create strong magnetic fields, the most practical method is to combine many loops of current together into a “solenoid” (a coil). Electromagnets function on this principle and are ubiquitous in our lives. Figure 15 shows the magnetic field from a single loop of current.
When several loops of current are brought close together, as in Figure 16, the magnetic field inside the solenoid becomes uniform, and the magnetic field just outside the solenoid approaches zero.
We can use Ampère’s Law to determine the strength of the magnetic field inside of a solenoid, under the assumption that the magnetic field is uniform in the volume of the solenoid and zero just outside. Consider a solenoid with current, , going through it, that contains loops per unit length. In order to determine the magnetic field, , inside of the solenoid, consider the rectangular Amperian loop, , of length, , illustrated in Figure 17.
In order to evaluate the circulation of the magnetic field around the loop, , we divide the loop up into segments, and evaluate the path integral () over each segment, then add those together to obtain the integral over the closed path:
Over each segment, the vector will be parallel to that segment. Only the last term is non-zero. The integrals over the segments and are zero because the magnetic field is perpendicular to over those segments (so the scalar product is zero). The integral over the segment is zero because the magnetic field is zero just outside the solenoid. The integral over the last segment, where and are parallel, is simply given by:
since the length of the segment is , and the magnetic field is constant in magnitude.
In order to apply Ampère’s Law, we must determine the current that is enclosed by our Amperian loop. Since the rectangular loop has a length, , it will enclose loops of current, , since there are loops per unit length. Thus the enclosed current is . Applying Ampère’s Law, we find the magnetic field inside a solenoid:
which does not depend on our (arbitrary) choice of making an Amperian loop with an arbitrary length of . In practice, when solenoids are used as electromagnets, they are typically filled with a ferromagnetic material, which will magnetise when there is a current, resulting in a stronger magnetic field. This is usually done by winding a wire around an iron rod.
Note that if we extend the Amperian loop so that the bottom segment is also outside the solenoid, as in Figure 18, it is easy to show that the magnetic field immediately outside of the solenoid must be zero. Indeed, in this case, there are an equal number of currents coming out of the page as there are going into the page, so that the net current that is enclosed by the Amperian loop (the net current that crosses the plane of the loop) is identically zero, so that the circulation must be zero, implying that the magnetic field is zero just outside the solenoid.
A toroid can be thought of as a solenoid that has been bent into the shape of a circle (or rather, a torus), as illustrated in Figure 19. Inside the toroid, the magnetic field forms concentric circles (not shown).
Again, we can use Ampère’s Law to determine the strength of the magnetic field inside the toroid. Consider the circular Amperian loop of radius that is illustrated in Figure 19. Since the magnetic field is parallel to the Amperian loop everywhere along the loop, and the magnetic field does not change magnitude (by symmetry), the circulation is given by:
If the toroid contains loops of current, then the enclosed current is given by , since the Amperian loop include times the current coming out of the page. Ampère’s Law thus gives the magnitude of the magnetic field as:
which decreases in magnitude with increasing radius, as long as we are inside the toroid. It is easy to show, by using Amperian loops that are either smaller or bigger than the toroid, that the magnetic field everywhere outside of the toroid is exactly zero (as those Amperian loops will enclose no net current). In a toroid, the magnetic field lines form closed circles. For a solenoid, there must exist a magnetic field somewhere outside the solenoid, in order for the field lines inside the solenoid to close. We can usually ignore these if the solenoid is long, as the field outside will be very weak, and very close to zero very close the solenoid (as we showed with Ampère’s Law above).
21.6Summary¶
Magnetic fields are created by moving charges. The Biot-Savart Law allows us to determine the infinitesimal magnetic field, , that is produced by the current, , flowing in an infinitesimal section of wire, :
where is a constant called the permeability of free space. The vector points from the wire element, , to the point at which we want to determine the magnetic field. In order to determine the magnetic field from a finite wire, one must sum (integrate) the contributions that come from each section of wire. It is often easier to work with the Biot-Savart law written without the unit vector, :
The magnetic field at a distance, , from an infinitely long wire carrying current, , is given by:
The magnetic field from a straight current-carrying wire forms concentric circles centred around the wire. The direction of the magnetic field is given by the right-hand rule for axial vectors; with the thumb pointing in the direction of current, the fingers curl in the direction of the magnetic field.
The magnitude of the magnetic field, a distance, , from the centre of a circular loop of wire with radius, , carrying current, , along the axis of symmetry of the loop is given by:
The direction of the magnetic field can also be found using the right-hand rule for axial currents. In this case, if your fingers curl in the direction of the current loop, your thumb points in the same direction as the magnetic field at the centre of the loop.
Two parallel wires carrying currents, and , separated by a distance, , will exert equal and opposite forces on each other with a magnitude:
The force is attractive if the two currents flow in the same direction and repulsive otherwise.
Ampère’s Law is the magnetism analogue to Gauss’ Law. Just like Gauss’ Law, it requires a high degree of symmetry to be applied analytically, although it is always valid. Ampère’s Law relates the circulation of the magnetic field around a closed path to the current enclosed by that path:
In order to apply Ampère’s Law, we must first choose an Amperian loop over which to compute the closed path integral (instead of choosing a Gaussian surface to calculate the flux of the electric field on a closed surface). The circulation integral will be straightforward to evaluate if:
- The angle between and is constant along the path, so that:
where θ is the angle between and .
- The magnitude of is constant along the path, so that:
The current enclosed, , corresponds to the net current that crosses the surface that is defined by the Amperian loop (a closed path always defines a surface).
Ampère’s Law is straightforward to use in situations with a high degree of symmetry, such as infinitely long wires carrying current.
Solenoids are formed by combining many loops of current together, in order to form a strong and uniform magnetic field. The magnetic field inside of a solenoid has a magnitude of:
where, , is the current in the solenoid, and , is the number of loops per unit length in the solenoid. The magnetic field just outside of a solenoid is zero, and generally, the magnetic field is negligible outside of a solenoid.
A toroid is formed by bending a solenoid into a circle to form a torus. The magnetic field lines inside of a toroid form concentric circles. The magnetic field decreases with radius inside of a toroid and is identically zero everywhere outside a toroid.
21.7Thinking about the material¶
21.8Sample problems and solutions¶
21.8.1Problems¶
21.8.2Solutions¶
Solution 21.1
The square loop is simply made of four straight sections of wire of length, . The magnetic field from each section of wire is into the page, which you can easily verify with your right-hand (with your thumb in the direction of current, your fingers curl in the direction of the resulting magnetic field).
The magnetic field at the centre is just four times the magnetic field produced by a single segment, which we determined in this chapter. The magnetic field at the centre of the loop is thus four times the magnetic field at a distance, , from a wire of length, :
Solution 21.2
We know that the magnetic field at a distance, , from the centre of a loop of current, along its axis of symmetry is given by:
For the two coils in the Helmholtz configuration, the magnetic field from each coil will be in the same direction. The centre of the two coils are located at . Thus, if we are located at position, , along the axis, one coil will be at a distance of , and the other at a distance . The total magnetic field as a function of is then given by:
We can plot this function, as well as the two individual terms using python. For information, we show the code below. In order to make the plot, we need to choose some reasonable values for the radius of the coils and the current through the coils, for example:
#Import the modules that we need:
import numpy as np
import matplotlib.pyplot as plt
#Define some constants:
mu0 = 4*np.pi*1e-7 #4 pi
I = 0.5
R = 0.3
#Define the values on the z axis, from -2R to +2R, in 100 increments
z = np.linspace(-2*R,2*R,100)
#Determine the magnetic field from the coils at those values of z
#The coil at z = - R/2:
B1 = (mu0*I)/2 * R**2/((R**2+(z+R/2)**2)**(3/2))
#The coil at z = + R/2:
B2 = (mu0*I)/2 * R**2/((R**2+(z-R/2)**2)**(3/2))
#The sum:
B = B1 + B2
#Make the plot
plt.figure(figsize=(10,6))
plt.plot(z,B1,label='Coil at z=-R/2')
plt.plot(z,B2,label='Coil at z=+R/2')
plt.plot(z,B,label='Total')
plt.legend()
plt.xlabel('z position [m]')
plt.ylabel('Magnetic field [T]')
plt.show()