Divergence in spherical coordinates problem I have this formula for the divergence of a vector field:
$$\nabla_m V^m = \frac{1}{\sqrt{|g|}} \frac{\partial (V^m\sqrt{|g|})}{\partial x^m}$$
The metric tensor in spherical coordinates:
$$ g=\begin{pmatrix}
1 & 0 & 0\\ 
0 & r^2\sin^2(\theta) & 0\\ 
0 & 0 & r^2
\end{pmatrix} $$
$$\sqrt{|g|}=r^2\sin(\theta)$$
So the divergence in spherical coordinates should be:
$$\nabla_m V^m =\frac{1}{r^2\sin(\theta)}\frac{\partial}{\partial r}(r^2\sin(\theta)V^r)+\frac{1}{r^2\sin(\theta)}\frac{\partial}{\partial \phi}(r^2\sin(\theta)V^\phi)+\frac{1}{r^2\sin(\theta)}\frac{\partial}{\partial \theta}(r^2\sin(\theta)V^\theta)$$
Some things simplify:
$$\nabla_m V^m =\frac{1}{r^2}\frac{\partial}{\partial r}(r^2V^r)+\frac{\partial V^\phi}{\partial \phi}+\frac{1}{\sin(\theta)}\frac{\partial}{\partial \theta}(\sin(\theta)V^\theta)$$
What am I doing wrong??
 A: 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 V=V^{\mu}\pmb{e}_{\mu}$ where $V^{\mu}$ are the contravariant components of the vector $\pmb V$.
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 V=V^{\mu}\pmb{e}_{\mu}$ is
$$
\nabla\cdot\pmb V=\frac{1}{\sqrt g}\frac{\partial}{\partial x^{\mu}}\left(\sqrt{g} V^{\mu}\right)=\frac{1}{\sqrt g}\frac{\partial}{\partial \hat x^{\mu}}\left(\sqrt{g} \frac{V^{\mu}}{\sqrt{g_{\mu\mu}}}\right)
$$
that is
$$
\begin{align}
\nabla\cdot\pmb V&=\frac{1}{r^2\sin\theta}\left[\frac{\partial}{\partial r}\left(r^2\sin\theta\, V^{r}\right)+\frac{\partial}{\partial (\phi\,r\sin\theta)}\left(r^2\sin\theta\, V^{\phi}\right)+\frac{\partial}{\partial (\theta\,r)}\left(r^2\sin\theta\, V^{\theta}\right)\right]\\
&=\frac{1}{r^2\sin\theta}\left[\frac{\partial}{\partial r}\left(r^2\sin\theta\, \frac{V^{r}}{1}\right)+\frac{\partial}{\partial \phi}\left(r^2\sin\theta\, \frac{V^{\phi}}{r\sin\theta}\right)+\frac{\partial}{\partial \theta}\left(r^2\sin\theta\, \frac{V^{\theta}}{r}\right)\right]\\
&=\frac{1}{r^2}\frac{\partial \left(r^2 V^{r}\right)}{\partial r}+\frac{1}{r\sin\theta}\frac{\partial V^{\phi}}{\partial \phi}+\frac{1}{r\sin\theta}\frac{\partial \left(V^{\theta}\sin\theta \right)}{\partial \theta}
\end{align}
$$
Note that the divergence of a contravariant vector $V^\mu$ is given by
$$
    \nabla\cdot\pmb V=\nabla_\mu V^\mu 
$$
where $\nabla_\mu$ is the covariant derivative.  
A: Well, not sure, but I'm wondering if you might have misinterpreted your first equation.  (Or heck, maybe the person who wrote it misinterpreted it.)  If you interpret $\partial/\partial x^m$ as a derivative over the distance of a change in each coordinate, instead of a derivative over the coordinates directly, then
$\displaystyle
\partial/\partial x^1 \rightarrow \partial/\partial r \\
\partial/\partial x^2 \rightarrow (1/r)\partial/\partial \theta \\
\partial/\partial x^3 \rightarrow (1/r\sin\theta)\partial/\partial \phi
$
and then I think everything works out.
Alternatively, I wonder if there is a confusion here between $x_1$, $x_2$, $x_3$ and $x^1$, $x^2$, $x^3$.  My diff geom is too rusty for me to be sure.
One other thing, there might be a confusion between vector components $V^1$, $V^2$, $V^3$, and $V_1$, $V_2$, $V_3$.  Make sure you aren't confusing your covariant and contravariant components.  Same with coordinates.
