# Polar Divergence of a Vector

transmini

## Homework Statement

Find the divergence of the function ##\vec{v} = (rcos\theta)\hat{r}+(rsin\theta)\hat{\theta}+(rsin\theta cos\phi)\hat{\phi}##

## Homework Equations

##\nabla\cdot\vec{v}=\frac{1}{r^2}\frac{\partial}{\partial r}(r^2v_r)+\frac{1}{r sin\theta}\frac{\partial}{\partial \theta}(sin\theta v_\theta) + \frac{1}{r sin\theta} \frac{\partial v_\phi}{\partial\phi}##

## The Attempt at a Solution

##\nabla\cdot\vec{v}=\frac{1}{r^2}\frac{\partial}{\partial r}(r^3 cos\theta)+\frac{1}{r sin\theta}\frac{\partial}{\partial \theta}(rsin^2\theta) + \frac{1}{r sin\theta} \frac{\partial}{\partial\phi}(rsin\theta cos\phi)##
##\nabla\cdot\vec{v}=\frac{1}{r^2}(3r^2cos\theta)+\frac{1}{r sin\theta}(2rsin\theta cos\theta) + \frac{1}{r sin\theta} (-rsin\theta sin\phi)##
##\nabla\cdot\vec{v}=3cos\theta+2cos\theta-sin\phi##
##\nabla\cdot\vec{v}=5cos\theta-sin\phi##

Except, the answer shouldn't have the second term in it at all and should just be ##5cos\theta## (I don't know 100% certain what the answer is, just the wolfram alpha gives ##5cos\theta## and that the Divergence Theorem doesn't hold with the second term and would hold if that term were gone like in wolfram's answer)

Where did I make a mistake here? Thanks in advance

Edit: Okay I spoke too soon on the Divergence Theorem not holding, as it appears to hold now that I double checked that problem's work. So is there just a problem with wolfram's answer?