Derivation (magnetic dipole moment of thin wire)

Starting from $$ \begin{align*} \v m = \frac{I}{2}\int_{C} \v x \times \d \v x, \end{align*} $$ for an arbitrary vector $\v a$, apply Stokes' theorem to get $$ \begin{align*} \v m\cdot \v a ={}& \frac{I}{2} \int_{C} \v a\cdot (\v x \times \d \v x) \\ ={}& \frac{I}{2} \int_{C} (\v a\times \v x)\cdot \d \v x \\ ={}& \frac{I}{2} \int_{S} ∇\times (\v a \times \v x)\cdot \d \v S \\ ={}&\frac{I}{2} \int_{S} ((∇\cdot \v x)\v a - (\v a\cdot ∇)\v x) \cdot \d \v S \\ ={}& I \int_{S} \v a \cdot \d \v S. \end{align*} $$ Thus $$ \begin{align*} \v m = I \int_{S} \d \v S. \end{align*} $$