# Magnetic field of square loop

Find the exact magnetic files in a distance $z$ above the center of a square loop of side $a$ carrying a current $I$. Show that if $z>>a$, it reduces to the field of a dipole.

First we deduce the magnetic field at a point $P$ in space above a finite wire carrying a current $I$. The figure is below.  The field of an element

$d L$ from the wire having distance $r$ to point $P$ is (Biot Savart)

$dB(r)= frac{mu}{4pi}*frac{I(dLtimes r)}{r^3} =frac{mu I*d L*sintheta}{4pi*r^2}=frac{mu I*d L*singamma}{4pi*r^2}=frac{mu I}{4pi}*d x*frac{R}{r^3}$

$B= frac{mu Ir}{4pi} int_{-a/2}^{a/2} frac{d x}{(x^2+R^2)^{3/2}} =frac{mu I r}{4pi}frac{x}{R^2(x^2+R^2)^{1/2}}|_{-a/2}^{a/2}$

$B=frac{mu I}{4pi R}(cos gamma_1-cosgamma_2)$

Since $R=sqrt{z^2+frac{a^2}{4}}$  and

$cosgamma_1=cosgamma_2=frac{a/2}{sqrt{R^2+a^2/4}}=frac{a}{2sqrt{z^2+a^2/2}}$

so that

$B=frac{mu I}{4pi R} frac{a}{sqrt{z^2+a^2/2}}$

The rectangle has 4 sides and the total field along z axis is

$B_{tot}=4B*sinbeta=4frac{mu I}{4pi R}*frac{a}{sqrt{z^2+a^2/2}}*frac{a}{2R}=frac{mu I}{2pi R^2}frac{a^2}{sqrt{z^2+a^2/2}}$

If $z>>a$ one has $R=z$ and

$B_{tot}=frac{mu I}{2pi z^2}frac{a^2}{z}=frac{mu (Ia^2)}{2pi z^3}= frac{mu m}{2pi z^3}$

The magnetic filed of a dipole  $m=I*a^2=I*S$   is
$B(z) =frac{mu}{4pi}*frac{2m}{z^3}$