= Solution
For a localized steady current, define
$$
\mathbf m=\frac12\int\mathbf r\times\mathbf J(\mathbf r)\,dV.
$$
Assume the external field varies negligibly across the current distribution. Expanding it to first order, the uniform term gives no net force because $\int\mathbf J\,dV=0$. Using the supplied integral identity and $\nabla\cdot\mathbf B=0$, the first-order term in $\int\mathbf J\times\mathbf B\,dV$ reduces to
$$
\mathbf F=\nabla(\mathbf m\cdot\mathbf B).
$$
Since $\mathbf F=-\nabla U$, the <magnetic dipole potential energy> is
$$
\boxed{U=-\mathbf m\cdot\mathbf B.}
$$
Here
$$
|\mathbf B|=\sqrt{B_0^2+B_1^2(x^2+y^2)}
$$
increases away from the $z$-axis. A dipole parallel to $\mathbf B$ has energy $-m|\mathbf B|$ and is drawn toward stronger field, hence outward from the axis. An antiparallel dipole has energy $+m|\mathbf B|$ and is driven toward the weak-field axis. The field therefore spatially separates the two orientations.
Back to article page