I want to calculate the divergence of the vector function $F(r,\theta, \phi)=(r^2, rsin\phi, 0)$. I assumed that in order to do this I could just calculat the divergence in spherical coordinates, which would be: $\nabla F(r,\theta, \phi)=2r$.
However, my textbook shows the result in cartesian coordinates as: $$\nabla F=\frac{1}{r^2sin\theta}[\frac{\delta}{\delta r}(r^2sin \theta F_r) + \frac{\delta}{\delta \theta}(r sin \phi F_\theta) + \frac{\delta}{\delta \phi}(rF_\phi)]$$
I've also seen it be appiled here, but they don't really give any context as to where this formula comes from and it's nowhere in any of my textbooks.
Can anyone explain/point me to a good deriviation of this formula? Also why don't we take the divergent in the same coordinate system as the vector function?
This formula comes from the chain rule, essentially. Suppose $F(r,\theta,\phi) = (F_r,F_\theta,F_\phi)$ is a vector field given in spherical coordinates (I assume this is what you mean by the notations $F_r,F_\theta,F_\phi$).
Vector fields are properly understood as differential operators. When applied to a function $g$, it means the directional derivative: $$ F \cdot g = F_r \frac{\partial g}{\partial r} + F_\theta \frac{\partial g}{\partial \theta} + F_\phi \frac{\partial g}{\partial \phi} \tag{1} $$
If we want to change to Cartesian coordinates and write $F = (F_x,F_y,F_z)$, then this would mean that for any function $g$, $$ F \cdot g = F_x \frac{\partial g}{\partial x} + F_y \frac{\partial g}{\partial y} + F_z \frac{\partial g}{\partial z} \tag{2} $$ You can use the chain rule to relate the two expressions. For instance, $$ \frac{\partial g}{\partial r} = \frac{\partial g}{\partial x} \frac{\partial x}{\partial r} + \frac{\partial g}{\partial y} \frac{\partial y}{\partial r} + \frac{\partial g}{\partial z} \frac{\partial z}{\partial r} $$
Do the same thing for $\frac{\partial g}{\partial \theta}$ and $\frac{\partial g}{\partial \phi}$ and plug into equation (1), regroup the terms, and compare with equation (2), and you'll see:
$$ F_x = F_r \frac{\partial x}{\partial r} + F_\theta \frac{\partial x}{\partial \theta} + F_\phi \frac{\partial x}{\partial \phi}, $$ and similarly for $F_y$ and $F_z$. Using the well-known formulas: $$ \begin {align*} x &= r \sin(\theta) \cos(\phi) \\ y &= r \sin(\theta) \sin(\phi) \\ z &= r \cos(\theta) \end {align*} $$ and taking the partial derivatives, you'll see that
$$ F_x = F_r \sin(\theta) \cos(\phi) + F_\theta r \cos(\theta) \cos(\phi) - F_\phi r \sin(\theta) \sin(\phi) $$ and similarly for $F_y$ and $F_z$. So you have to compute the divergence as: $$ \nabla \cdot F = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z} $$
We've just computed $F_x, F_y, F_z$ in terms of $F_r,F_\theta,F_\phi$. Finally, you should use the chain rule again to evaluate $\frac{\partial F_x}{\partial x}$, etc, in terms of partial derivatives with respect to $r,\theta,\phi$. And you should get the expression you asked about in your post.