Solution (source code)

= Solution

Because the <magnetic field> obeys $\nabla\cdot\mathbf B=0$, it can be represented locally as the <curl> of a <magnetic vector potential>:
$$
\boxed{\mathbf B=\nabla\times\mathbf A.}
$$
This automatically enforces the absence of magnetic monopoles. It is also a global representation throughout ordinary all-space problems without monopole singularities. It is not unique: the <gauge transformation>
$$
\mathbf A\longmapsto\mathbf A+\nabla\chi
$$
leaves $\mathbf B$ unchanged because the <curl> of a <gradient> vanishes. In a time-dependent problem,
$$
\mathbf E=-\nabla\phi-\frac{\partial\mathbf A}{\partial t},\qquad
\phi\longmapsto\phi-\frac{\partial\chi}{\partial t}
$$
makes the same transformation leave both physical fields unchanged and automatically satisfies <Faraday's law>.

In vacuum <magnetostatics>, choose the <Coulomb gauge> $\nabla\cdot\mathbf A=0$. Substitution into <Ampère's law> and the identity $\nabla\times(\nabla\times\mathbf A)=\nabla(\nabla\cdot\mathbf A)-\nabla^2\mathbf A$ gives
$$
\nabla^2\mathbf A=-\mu_0\mathbf J,\qquad
\mathbf A(\mathbf r)=\frac{\mu_0}{4\pi}\int\frac{\mathbf J(\mathbf r')}{|\mathbf r-\mathbf r'|}\,d^3r'
$$
for a localized steady <electric current density> and a potential vanishing at infinity. Taking the <curl> recovers the <Biot-Savart law>. The <magnetic vector potential> converts a constrained <vector> field problem into componentwise <Poisson equations> once a gauge is chosen.

For a uniform <magnetic field>, $\mathbf A=\tfrac12\mathbf B\times\mathbf r$ is a convenient choice. For a localized <magnetic dipole moment> $\mathbf m$, the leading far-field potential is
$$
\mathbf A(\mathbf r)=\frac{\mu_0}{4\pi}\frac{\mathbf m\times\mathbf r}{r^3}.
$$
Another useful relation is <Stokes theorem>, which relates a closed-path <integral> to the <magnetic flux> through a spanning surface:
$$
\oint_{\partial S}\mathbf A\cdot d\boldsymbol\ell=\int_S\mathbf B\cdot d\mathbf S.
$$
The units of $\mathbf A$ are $\mathrm{T\,m}$, equivalently $\mathrm{Wb\,m^{-1}}$.