The vector potential, to first order, for a magnetostatic localized current distribution was found to be

\label{eqn:magneticFieldFromMoment:20}
\BA(\Bx) = \frac{\mu_0}{4 \pi} \frac{\Bm \cross \Bx}{\Abs{\Bx}^3}.

Initially, I tried to calculate the magnetic field from this, but ran into trouble. Here’s a new try.

\label{eqn:magneticFieldFromMoment:40}
\begin{aligned}
\BB
&=
\frac{\mu_0}{4 \pi}
\spacegrad \cross \lr{ \Bm \cross \frac{\Bx}{r^3} } \\
&=
-\frac{\mu_0}{4 \pi}
\spacegrad \cdot \lr{ \Bm \wedge \frac{\Bx}{r^3} } \\
&=
-\frac{\mu_0}{4 \pi}
\lr{
} \\
&=
\frac{\mu_0}{4 \pi}
\lr{
– \lr{ \Bm \cdot \lr{\spacegrad \inv{r^3} }} \Bx
+\Bm \lr{\spacegrad \inv{r^3} } \cdot \Bx
}.
\end{aligned}

Here I’ve used $$\Ba \cross \lr{ \Bb \cross \Bc } = -\Ba \cdot \lr{ \Bb \wedge \Bc }$$, and then expanded that with $$\Ba \cdot \lr{ \Bb \wedge \Bc } = (\Ba \cdot \Bb) \Bc – (\Ba \cdot \Bc) \Bb$$. Since one of these vectors is the gradient, care must be taken to have it operate on the appropriate terms in such an expansion.

Since we have $$\spacegrad \cdot \Bx = 3$$, $$(\Bm \cdot \spacegrad) \Bx = \Bm$$, and $$\spacegrad 1/r^n = -n \Bx/r^{n+2}$$, this reduces to

\label{eqn:magneticFieldFromMoment:60}
\begin{aligned}
\BB
&=
\frac{\mu_0}{4 \pi}
\lr{
– \frac{\Bm}{r^3}
+ 3 \frac{(\Bm \cdot \Bx) \Bx}{r^5} %
+ 3 \Bm \inv{r^3}
-3 \Bm \frac{\Bx}{r^5} \cdot \Bx
} \\
&=
\frac{\mu_0}{4 \pi}
\frac{3 (\Bm \cdot \ncap) \ncap -\Bm}{r^3},
\end{aligned}

which is the desired result.