Magnetic traps work by essentially creating a gradient in the magnetic field. As you may know, atoms possesses a magnetic moment. This is why they have a potential energy:
[tex]
U = -\mathbf{\mu} \cdot \mathbf{B}[/tex]
The negative gradient of this potential energy determines the force:
[tex]
\mathbf{F} = -\nabla U = \nabla(\mathbf{\mu} \cdot \mathbf{B}) = \nabla(\mathbf{\mu} \cdot \stackrel{\downarrow}{\mathbf{B}})[/tex]
In the adiabatic approximation, we neglect the possible precession of the magnetic moment of the atoms and assume that they are always aligned along the magnetic field line, i.e.
[tex]
\mathbf{\mu} = \mu \, \hat{\mathbf{b}}[/tex]
However, using:
[tex]
\nabla B = \nabla (B^{2})^{\frac{1}{2}} = \nabla (\mathbf{B} \cdot \mathbf{B})^{\frac{1}{2}} = \frac{1}{2} \, (\mathbf{B} \cdot \mathbf{B})^{-\frac{1}{2}} \nabla (\mathbf{B} \cdot \mathbf{B}) = \frac{1}{B} \nabla (\mathbf{B} \cdot \stackrel{\downarrow}{\mathbf{B}}) = \nabla(\hat{\mathbf{b}} \cdot \stackrel{\downarrow}{\mathbf{B}})[/tex]
we may write the force as:
[tex]
\mathbf{F} = \mu \nabla B[/tex]
If [itex]\mu > 0[/itex], then this force is in the same direction as the gradient of the intensity of the magnetic field. This means it is directed in the direction where the intensity increases. Such atoms are called high-field seekers. On the contrary, atoms with [itex]\mu < 0[/itex] are called low field seekers. This means that atoms can have stable equilibrium in points where the intensity of the magnetic field is maximal or minimal.
There is a theorem in Classical Electrodynamics that states that the magnetic field cannot have a local maximum in intensity in a space with no currents present. Thus, high-field seekers cannot be trapped.
For low-field seekers, we can produce a local minimum if we create a point where [itex]\mathbf{B} = \mathbf{0}[/itex]. This may be achieved by using two anti-Helmholtz coils (the currents are directed in opposite directions, so that the fields cancel in the region between the two). This kind of field configuration is known as a quadrupole magnetic field. Near the point where the field vanishes (assuming axial symmetry), the magnetic field is approximately:
[tex]
\mathbf{B} = B' \left\langle x, y, -2 z \right\rangle[/tex]
and the magnitude then becomes:
[tex]
B = B' \left(x^{2} + y^{2} + 4 z^{2}\right)^{\frac{1}{2}}[/tex]
The potential energy is:
[tex]
U = \mu \, B' \, \left(x^{2} + y^{2} + 4 z^{2}\right)^{\frac{1}{2}}[/tex]