A wire carrying a current I runs from the origin to the point (0, d ), shown
below. What is the strength of the magnetic field at the point (r, 0)?
Recall that when we derived the field of an infinite straight wire we evaluated
an integral from negative infinity to infinity. We are still dealing with a
straight wire here; we must simply change our limits of integration. Recall
that:
B =
for an infinite wire. For our wire, we simply integrate from 0 to d:
B
=
=

=

This answer is complicated, but is a general answer for this kind of situation.
Problem :
What is the magnitude and direction of the magnetic field at the center of a
square wire with sides of length d and current I?
We begin by drawing a diagram:
Using our second right hand rule, we can see that the contributions of each side
will point out of the page and, due to symmetry, they must all be the same
value. Thus we simply need to calculate the field from one side, and multiply
it by four. Since we are still dealing with straight wires, we can simply
change the limits of integration of the equation we derived (like we did in the
last problem), substituting in d /2 for r, and changing our limits to d /2 and
 d /2:
B
=
=
+
=
=
=
Recall that this is only for one segment. Thus the total magnetic field at the
center of the square is:
B =
Again, the direction of the field is out of the page.