# Where is the error in this calculation of net curl for simple magnetic field?

I wasn't sure whether to post this on MSE, but PSE seems more appropriate.

Let B be a static magnetic field in spherical coordinates, defined as $$B=r\hat{\theta}$$. Then, it's curl is $$\nabla \times B = \frac{1}{r}\frac{\partial}{\partial r}(rB_\theta)\hat{\varphi}=\frac{1}{r}\frac{\partial}{\partial r}(r^2)\hat{\varphi}=\frac{2r}{r}\hat{\varphi}=2\hat{\varphi}.$$

Then, let's calculate the net curl of $$B$$ in a sphere of radius R in two ways.

$$\iiint \nabla \times B \mathrm{d}V=\iint B \times \hat{n}*\mathrm{d}S$$ (Stokes' Thm)

$$2\hat{\varphi}\iiint \mathrm{d}V = \iint r\hat{\theta}\times\hat{r}*r^2\sin\theta \mathrm{d}\theta \mathrm{d}\varphi$$ (Definitions)

$$2\hat{\varphi}*\frac{4\pi}{3}R^3=\int_0^{2\pi}\int_0^\pi R^3\hat{\varphi}\sin\theta \mathrm{d}\theta \mathrm{d}\varphi=(\int_0^{2\pi}\mathrm{d}\varphi)(\int_0^\pi\sin\theta\mathrm{d}\theta)R^3\hat{\varphi}$$

$$\frac{2}{3} 4\pi R^3 \hat{\varphi}=4\pi R^3 \hat{\varphi}$$

I obviously made a mistake somewhere, and I'm pretty unfamiliar with the spherical coordinate system. I know the discrepancy can be resolved if the curl is instead $$\nabla \times B = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2B_\theta)\hat{\varphi}$$, like how the r term appears in the Laplacian in spherical coordinates, but multiple sources say that this is not the case. It might also be with my removal of $$r^3$$ from the integral, but given that $$r=R$$ I felt it was justified.

Can someone please identify the error?

• Stokes' Theorem : \begin{equation} \oint\limits_{C}\mathbf{B}\boldsymbol{\cdot}\mathrm d\boldsymbol{\ell}=\iint\limits_{S}\left(\boldsymbol{\nabla}\boldsymbol{\times}\mathbf{B}\right)\boldsymbol{\cdot}\mathrm d\boldsymbol{S} \tag{01}\label{01} \end{equation} – Frobenius Oct 26 '18 at 7:57

You got Stokes' theorem wrong. The integral on the left hand side should not be a volume integral but a line integral along a curve enclosing the surface of the surface integral on the right hand side. In other words, it should be something like $$\oint_C\mathbf{B}\cdot \mathbf{dl} = \iint_S\nabla\times{}\mathbf{B} \cdot\mathbf{dS} = \iint_S \nabla\times{}\mathbf{B}\cdot\mathbf{n}\ {dS}.$$ Note how both the integrands contain dot products of vector quantities, so that the integrals are scalar quantities.
Another thing that needs attention is that although physicists use $$\theta$$ for the polar angle and $$\phi$$ for the azimuthal one, $$\mathbf{B} = r\hat{\theta}$$ makes sense only if $$\theta$$ is the azimuthal angle, for if it where otherwise, the divergence of $$\mathbf{B}$$ would not be zero at the poles. If you can't see why, visualize the globe and notice how the north and south poles act as source and sink of the meridians. This is what the magnetic field lines for $$\mathbf{B} = r\hat{\theta}$$ would look like if $$\theta$$ was the polar angle and it would be absurd. It seems much more likely that whoever gave you this exercise meant for the magnetic lines to look like the parallels on the globe, so they must be using the mathematicians notation, where $$\theta$$ is the azimuthal angle and $$\phi$$ is the polar one!
So, using the correct notation (or at least what I assume to be the correct one), $$\nabla\times\mathbf{B} = -\frac{1}{r}\frac{\partial}{\partial r}\left( rB_\theta\right) = - 2\hat{\phi}$$.
Third, notice that all integrants are scalars (as products of vectors), so all integrals should be scalars as well. Therefore, if you ever end up with results containing, say unit vectors like $$\hat\phi$$, as you did, this should be a sign that something definitely went wrong. Usually this means that there was somewhere a vector product between unit vectors that you somehow missed.
Even if they where not scalars, say in the case you wanted to calculate the average of a vector field over some area, a unit vector in a curvilinear system is generally different at each point in space and you cannot take it out of the integration. For example $$\hat\phi$$ only has meaning locally so it cannot be part of a non local expression. In such cases, one can write the curvilinear unit vectors as linear combinations of cartesian unit vectors, which are constant and can be taken out of the integration.