Question about expression in Griffiths So, in Griffiths' E&M book, he comes up with this expression for the magnetic dipole moment, 
$$A_{\text{dip}}(\textbf{r}) = \frac{\mu_{0}I}{4\pi r^{2}} \oint r'\cos(\alpha) 
 \,d\textbf{l}'  =  \frac{\mu_{0}I}{4\pi r^{2}} \oint\left(\hat{\textbf{r}}\cdot\text{r}'\right)d\textbf{l}' $$
He then states the following identity:
$$\oint\left(\hat{\textbf{r}}\cdot\text{r}'\right) d\textbf{l}' = -\hat{\textbf{r}} \times \int d\textbf{a}'$$ 
Can someone tell how this identity is valid? Is there a proof for this? It's possible that is a very simple, standard trick which I'm not getting.
 A: First note that if $\phi$ is a scalar function, $$\oint \phi(\mathbf{r}')\, d\mathbf{l}' = \int d\mathbf{a'} \times \nabla\phi$$ Indeed, if $C$ is an arbitrary vector, $$\mathbf{C}\cdot \oint \phi\, d\mathbf{l}'  = \oint \phi\mathbf{C}\cdot d\mathbf{l}' = \int \nabla \times (\phi \mathbf{C}) \cdot d\mathbf{a}'$$ where the last equality follows from Stokes's theorem. By a vector identity, $$\nabla \times (\phi \mathbf{C}) = \nabla\phi \times \mathbf{C} + \phi(\nabla \times\mathbf{C}) = \nabla\phi \times\mathbf{C}$$ Thus the surface integral becomes $$\int \nabla \phi \times \mathbf{C}\cdot d\mathbf{a}' = \int\mathbf{C}\cdot d\mathbf{a}'\times \nabla \phi = \mathbf{C}\cdot \int d\mathbf{a}' \times \nabla \phi$$ so that $$\mathbf{C}\cdot \oint \phi\, d\mathbf{l}' = \mathbf{C}\cdot \int d\mathbf{a}' \times \nabla \phi$$ Since $\mathbf{C}$ was arbitrary, the claim follows.

Now letting $\phi = \hat{\mathbf{r}}\cdot \mathbf{r}'$ in the above claim, we obtain $\oint\, (\hat{\mathbf{r}}\cdot \mathbf{r}')\, d\mathbf{l}' = \int d\mathbf{a}' \times \nabla(\hat{\mathbf{r}}\cdot \mathbf{r}')$. The vector $\hat{\mathbf{r}}$ is constant in the integral, so $\nabla(\hat{\mathbf{r}}\cdot \mathbf{r'})$ reduces to $\hat{\mathbf{r}}$, making $$\int d\mathbf{a}' \times \nabla(\hat{\mathbf{r}}\cdot\mathbf{r}') = \int d\mathbf{a}' \times \hat{\mathbf{r}} = -\int \hat{\mathbf{r}}\times d\mathbf{a}' = -\hat{\mathbf{r}}\times \int d\mathbf{a}'$$ as desired.
