Magnetic Field from a Straight Wire

What is the magnetic field at some point a distance a from a straight current-carrying wire? We'll split the wire up into pieces of length dx, figure out the field from each piece, and add them up (i.e., integrate) to find the net field.

Define a coordinate system with +x right, +y up, and +z out of the screen. The current is in the +x direction. Put the origin on the wire such that the point where we're calculating field is on the y-axis.

The magnetic field dB from a representative piece of the wire is:

dB = (mo / 4p ) I dx ´ /r2

What direction is this field?

The nice thing about this situation is that the field from every part of the wire points in the same direction, out of the page. This means that:

dx ´ = dx sin(q)

where q is the angle between the wire and the vector r pointing from ds to the point where we're calculating field.

Our integral for the net field becomes:

B = ( mo I / 4p ) ò dx sin(q) /r2

We have too many variables (x, q, and r) so let's put everything in terms of q.

a = r sin(q), so r = a/sin(q) = a csc(q)

tan(q) = -a/x so x = -a/tan(q) or x = -a cot(q)

This gives dx = a csc2(q) dq

With these substitutions the integral becomes:

B = ( mo I / 4p ) ò a csc2(q) sin(q) dq /[a2 csc2 (q)]

B = ( mo I / 4pa ) ò sin(q) dq

where the limits on the integral run from q1 at the left end of the wire to q2 at the right end.

Integrating sin(q) gives -cos(q), so the result of the integral is:

B = ( mo I / 4pa ) [cos(q1) - cos(q2]