Having established the magnetic field of the simplest cases, straight wires, we must go through some calculus before analyzing more complex situations. In this section we shall generate an expression for the small contribution of a segment of a wire to the magnetic field at a given point, and then show how to integrate over the whole wire to generate an expression for the total magnetic field at that point.

Contribution to the Magnetic Field by a Small Segment of Wire

Consider a randomly shaped wire, with a current I running through it, as shown below.

Figure %: An odd-shaped wire. We find the magnetic field at point P by summing the contributions to the field of each element dl
We want to find the magnetic field at a given point near the wire. First, we find the individual contributions of very small lengths of the wire, dl. The concept behind this method is that a very small piece of wire, no matter how the whole wire curves and twists, can be considered a straight line. So we sum over an infinite number of straight lines (i.e. integrate) to find the total field of the wire. If the distance between our small segment dl and the point is r, and the unit vector in this radial direction is denoted by , then the contribution by the segment dl is given by:

smallsegment

dB=  
 =  

The derivation of this equation requires the introduction of the concept of vector potential. As this is beyond the scope of this text, we simply state the equation without justification.

Application of the Magnetic Field Equation

This equation is quite complicated, and is difficult to understand on a theoretical level. Thus, to show its applicability, we will use the equation to calculate something we already know: the field from a straight wire. We begin by drawing a diagram showing a straight wire, including an element dl, in relation to a point a distance x from the wire:

Figure %: An element dl on a long wire, contributing to the magnetic field at P, a distance x from the wire
From the figure, we see that the distance between dl and P is . In addition, the angle between and dl is given by sinθ = . Thus we have the necessary values to plug into our equation:

dB = =

Now that we have an expression for the contribution of a small piece, we may sum over the whole wire to find the total magnetic field. We integrate our expression with respect to l, with limits of integration from to - ∞:


B=  
dB=  
 = =  

Since I, x and c are constants, we may remove them from the integral, simplifying the calculus. This integral is still quite complicated, and we must use a table of integration to solve it. It turns out that the integral is equal to . We evaluate this expression using our limits:

B =

When we plug infinity into our expression we find that l, implying that plugging in a value of infinity yields the value 1/x2. When we plug in our negative infinity, we get -1/x2 in a similar manner. Thus:

B = - =

This is the equation we saw earlier for the field of a straight wire, implying that our calculus equation derived earlier is correct. The math that accompanies this kind of calculation is difficult, and rarely used, but it is essential for deriving the formulae we will encounter in the next section.