Divergence Example in 3D Cartesian Coordinates I've just started my Galaxy Dynamics module and we are refreshing ourselves on Divergence and Curl, etc etc. I've come across a divergence example which I can't quite understand how to handle:
So I have a force given by
$$ F = (x^2 + y^2 + z^2)^n(xi+yj+zk)$$
I was wondering how we handle this for divergence...an explanation of the setup would be excellent. 
I'm not sure how to handle the $(xi+yj+zk)$ with respect to $(x^2 + y^2 + z^2)^n$...?  
 A: Hint:
the divergence of a vector filed $\mathbf{F}=A\mathbf{i}+B\mathbf{j}+C\mathbf{k}$ is defines as:
$$
div (\mathbf{F})=\dfrac{\partial A}{\partial x}+\dfrac{\partial B}{\partial y}+\dfrac{\partial C}{\partial z}
$$
in your case:
$$
A=x(x^2+y^2+z^2)^n \quad B=y(x^2+y^2+z^2)^n \quad C=z(x^2+y^2+z^2)^n
$$
A: The product rule essentially gives
$$ \operatorname{div}(f \mathbf{v}) = (\operatorname{grad} f) \cdot \mathbf{v} + f \operatorname{div} \mathbf{v}, $$
so we have
$$ \operatorname{div}( (x^2+y^2+z^2)^n (x \mathbf{e}_1 + y \mathbf{e}_2 + z \mathbf{e}_3 ) ) = (x \mathbf{e}_1 + y \mathbf{e}_2 + z \mathbf{e}_3 ) \cdot \nabla(x^2+y^2+z^2)^n + (x^2+y^2+z^2)^n  ( \frac{\partial}{\partial x} x + \frac{\partial}{\partial y} y  + \frac{\partial}{\partial z} z ) $$
The latter is obviously just $3(x^2+y^2+z^2)^n$. The former derivative is
$$ n(x^2+y^2+z^2)^{n-1} \nabla(x^2+y^2+z^2), $$
and the last derivative here is
$$ 2x \mathbf{e}_1+2y \mathbf{e}_2  + 2z \mathbf{e}_3; $$
dotting gives
$$ 2(x^2+y^2+z^2)n(x^2+y^2+z^2)^{n-1}, $$
and you can carry on from here.
