# Divergence in spherical coordinates

On the one hand there is an explicit formula for divergence in spherical coordinates, namely:

$$\nabla \cdot \vec{F} = \frac{1}{r^2} \partial_r (r^2 F^r) + \frac{1}{r \sin \theta} \partial_\theta (\sin \theta F^\theta) + \frac{1}{r \sin \theta} \partial_\phi F^\phi$$

On the other hand if I use another definition, I obtain:

$$\nabla \cdot \vec{F} = \frac{1}{\sqrt{g}} \partial_\alpha (\sqrt{g} F^\alpha )$$ In spherical coordinates: $g = r^4 \sin^2 \theta$, hence:

$$\nabla \cdot \vec{F} = \frac{1}{r^2 \sin \theta} \partial_r (r^2 \sin \theta F^r ) + \frac{1}{r^2 \sin \theta} \partial_\theta (r^2 \sin \theta F^\theta ) + \frac{1}{r^2 \sin \theta} \partial_\phi (r^2 \sin \theta F^\phi ) \\ = \frac{1}{r^2} \partial_r (r^2 F^r) + \frac{1}{ \sin \theta} \partial_\theta (\sin \theta F^\theta) + \partial_\phi F^\phi$$

These are two different results. Where am I wrong?

• $F^\theta$ and $F^\phi$ have different meanings in your two results, that's why both are correct – user8268 Oct 13 '13 at 15:36
• @user8268 So if $\vec F$ is defined as: $F^\alpha = \frac{\partial f (u(r, \theta, \phi), \ldots)}{\partial (\nabla_\alpha u)}$ and I compute $\nabla_\alpha u$ as $(\partial_r u, \frac{1}{r} \partial_\theta u, \frac{1}{r \sin \theta} \partial_\phi u)$ than which formula for $\nabla \cdot \vec{F}$ should I use? The first one? – qoqosz Oct 13 '13 at 16:16
• I don't quite follow your notation, but in the 1st case $\vec F=\sum_i F^i \vec e_i$, where $\vec e_i$ is an orthonormal basis, whereas in the 2nd case $\vec F=\sum F^i \vec v_i$, where e.g. $\vec v_\phi=(\partial x/\partial\phi,\partial y/\partial\phi,\partial z/\partial\phi)$ (or just $\partial/\partial\phi$ if you know this notation) – user8268 Oct 13 '13 at 17:47

Let $\pmb{e}_{\mu}$ be an arbitrary basis for three-dimensional Euclidean space. The metric tensor is then $\pmb{e}_{\mu}\cdot\pmb{e}_{\nu}=g_{\mu\nu}$ and if $\pmb V$ is a vector then $\pmb F=F^{\mu}\pmb{e}_{\mu}$ where $F^{\mu}$ are the contravariant components of the vector $\pmb F$.

Let's choose the basis such that $$\pmb{e}_{\mu}\cdot\pmb{e}_{\nu}=g_{\mu\nu}=\begin{pmatrix} 1 & 0 & 0\\ 0 & r^2\sin^2\theta & 0\\ 0 & 0 & r^2 \end{pmatrix}=\begin{pmatrix} g_{rr} & 0 & 0\\ 0 & g_{\phi\phi} & 0\\ 0 & 0 & g_{\theta\theta} \end{pmatrix}$$ with determinant $g=r^4\sin^2\theta$. This leads to the spherical coordinates system $$x^{\mu}=(r,\phi \,r\sin\theta,\theta \,r)=\sqrt{g_{\mu\mu}}\hat{x}^{\mu}$$ where $\hat{x}^{\mu}=(r,\phi,\theta)$.

So the divergence of a vector field $\pmb F=F^{\mu}\pmb{e}_{\mu}$ is $$\nabla\cdot\pmb F=\frac{1}{\sqrt g}\frac{\partial}{\partial x^{\mu}}\left(\sqrt{g} F^{\mu}\right)=\frac{1}{\sqrt g}\frac{\partial}{\partial \hat x^{\mu}}\left(\sqrt{g} \frac{F^{\mu}}{\sqrt{g_{\mu\mu}}}\right)$$ that is \begin{align} \nabla\cdot\pmb F&=\frac{1}{r^2\sin\theta}\left[\frac{\partial}{\partial r}\left(r^2\sin\theta\, F^{r}\right)+\frac{\partial}{\partial (\phi\,r\sin\theta)}\left(r^2\sin\theta\, F^{\phi}\right)+\frac{\partial}{\partial (\theta\,r)}\left(r^2\sin\theta\, F^{\theta}\right)\right]\\ &=\frac{1}{r^2\sin\theta}\left[\frac{\partial}{\partial r}\left(r^2\sin\theta\, \frac{F^{r}}{1}\right)+\frac{\partial}{\partial \phi}\left(r^2\sin\theta\, \frac{F^{\phi}}{r\sin\theta}\right)+\frac{\partial}{\partial \theta}\left(r^2\sin\theta\, \frac{F^{\theta}}{r}\right)\right]\\ &=\frac{1}{r^2}\frac{\partial \left(r^2 F^{r}\right)}{\partial r}+\frac{1}{r\sin\theta}\frac{\partial F^{\phi}}{\partial \phi}+\frac{1}{r\sin\theta}\frac{\partial \left(F^{\theta}\sin\theta \right)}{\partial \theta} \end{align}