Divergence in Cylindrical Coordinates or Divergence in Spherical Coordinates do not appear inline with normal (Cartesian) Divergence formula. And, it is annoying you, from where those extra terms are appearing.
Don’t worry! This article explains complete step by step derivation for the Divergence of Vector Field in Cylindrical and Spherical Coordinates.
Divergence of a Vector Field
Divergence of a vector field is a measure of the “outgoingness” of the field at that point.
If more and more field lines are sourcing out, coming out of the point then we say that there is a positive divergence.
While if the field lines are sourcing in or contracting at a point then there is a negative divergence. The uniform vector field posses a zero divergence.
4 Ultimate Visual FREE E-Books on Coordinate Systems & Transformations
Must for GATE EE/EC Aspirants
Divergence in Cylindrical Coordinates
The Divergence formula in Cartesian Coordinate System viz. the normal Divergence formula can be derived from the basic definition of the divergence.
As read from previous articles, we can easily derive the divergence formula in Cartesian which is as below.
\nabla\cdot\overrightarrow A=\frac{\partial A_x}{\partial x}+\frac{\partial A_y}{\partial y}+\frac{\partial A_z}{\partial z}Now let me present the same in Cylindrical coordinates.
\nabla\cdot\overrightarrow A=\frac1\rho\frac\partial{\partial\rho}\left(\rho A_\rho\right)+\frac1\rho\frac{\partial A_\phi}{\partial\phi}+\frac{\partial A_z}{\partial z}It is quite obvious to think that why some extra terms like (1/ρ) and ρ are present in first and second terms.
Where do they come from? What is the logic behind them. Because thinking intuitively, one might expect the formula similar to cartesian one.
We know, Cartesian is characterized by x, y and z while Cylindrical is defined by ρ, φ and z.
So one can think of getting partial derivatives w.r.t. ρ, φ and z instead of x, y and z and Aρ, Aφ and Az instead of Ax, Ay and Az. Right?
But it is not like that. The answer for this can be found in the steps of the Divergence in Cylindrical Coordinates Derivation. Actually we can reach up to the result by two approaches.
Two Approaches for the Derivation
In the first approach, you start with the divergence formula in Cartesian then convert each of its element into the cylindrical using proper conversion formulas.
The partial derivatives with respect to x, y and z are converted into the ones with respect to ρ, φ and z.
The x, y and z components of the vector are equivalently written in terms of ρ, φ and z components.
In the second approach, the del operator (∇) is its self written in the Cylindrical Coordinates and dotted with vector represented in Cylindrical System.
We will go with second approach which is quite challenging with reference to first.
4 Ultimate Visual FREE E-Books on Coordinate Systems & Transformations
Must for GATE EE/EC Aspirants
Divergence in Cylindrical Coordinates Derivation
We know that the divergence of the vector field is given as
\nabla\cdot\overrightarrow AHere ∇ is the del operator and A is the vector field.
If I take the del operator in cylindrical and dotted with A written in cylindrical then I would get the divergence formula in cylindrical coordinate system.
In cylindrical coordinates, any vector field is represented as follows:
\overrightarrow A=A_\rho{\overrightarrow a}_\rho+A_\phi{\overrightarrow a}_\phi+A_z{\overrightarrow a}_zThe Cylindrical del operator is as follows
\nabla={\overrightarrow a}_\rho\frac\partial{\partial\rho}+{\overrightarrow a}_\phi\frac1\rho\frac\partial{\partial\phi}+{\overrightarrow a}_z\frac\partial{\partial z}You can read “How to convert the Del operator from Cartesian to Cylindrical?” to get the idea of Cylindrical del operator.
So let’s take the dot product.
\nabla\cdot\overrightarrow A=\left({\overrightarrow a}_\rho\frac\partial{\partial\rho}+{\overrightarrow a}_\phi\frac1\rho\frac\partial{\partial\phi}+{\overrightarrow a}_z\frac\partial{\partial z}\right)\cdot\left(A_\rho{\overrightarrow a}_\rho+A_\phi{\overrightarrow a}_\phi+A_z{\overrightarrow a}_z\right)Be careful. This is not the simple dot product consisting of the multiplication of the respective components.
You have to take an account of the derivative. For example let us consider the first term,
\nabla\cdot\overrightarrow A=\left({\overrightarrow a}_\rho\frac\partial{\partial\rho}\right)\cdot\left(A_\rho{\overrightarrow a}_\rho+A_\phi{\overrightarrow a}_\phi+A_z{\overrightarrow a}_z\right)Let us put dot product outside and consider the derivative first.
\nabla\cdot\overrightarrow A={\overrightarrow a}_\rho\cdot\left[\frac\partial{\partial\rho}\left(A_\rho{\overrightarrow a}_\rho+A_\phi{\overrightarrow a}_\phi+A_z{\overrightarrow a}_z\right)\right]Now consider the first derivative,
\frac\partial{\partial\rho}\left(A_\rho{\overrightarrow a}_\rho\right)It is simplified using the product rule of the derivative.
\frac\partial{\partial\rho}\left(A_\rho{\overrightarrow a}_\rho\right)\;=\frac{\partial A_\rho}{\partial\rho}{\overrightarrow a}_\rho+A_\rho\frac{\partial{\overrightarrow a}_\rho}{\partial\rho}Don’t assume that derivatives of the unit vectors are equal to zero or keep out of the derivation as a constant. No.
Because cylindrical and spherical unit vectors are not universally constant. Though their magnitude is always 1, they can have different directions at different points of consideration.
So unlike the cartesian these unit vectors are not global constants.
Read: Derivatives of the unit vectors in different coordinate systems.
As read from the above article, let us just use their results as follows:
\frac\partial{\partial\rho}\left({\overrightarrow a}_\rho\right)\;=0;\;\frac\partial{\partial\rho}\left({\overrightarrow a}_\phi\right)=0;\;\frac\partial{\partial\rho}\left({\overrightarrow a}_z\right)=0 \frac\partial{\partial\phi}\left({\overrightarrow a}_\rho\right)\;={\overrightarrow a}_\phi;\;\frac\partial{\partial\phi}\left({\overrightarrow a}_\phi\right)=-{\overrightarrow a}_\rho;\;\frac\partial{\partial\phi}\left({\overrightarrow a}_z\right)=0 \frac\partial{\partial z}\left({\overrightarrow a}_\rho\right)\;=0;\;\frac\partial{\partial z}\left({\overrightarrow a}_\phi\right)=0;\;\frac\partial{\partial z}\left({\overrightarrow a}_z\right)=0So let us consider the complete terms together,
\nabla\cdot\overrightarrow A=\left({\overrightarrow a}_\rho\frac\partial{\partial\rho}+{\overrightarrow a}_\phi\frac1\rho\frac\partial{\partial\phi}+{\overrightarrow a}_z\frac\partial{\partial z}\right)\cdot\left(A_\rho{\overrightarrow a}_\rho+A_\phi{\overrightarrow a}_\phi+A_z{\overrightarrow a}_z\right) ={\overrightarrow a}_\rho\cdot\left[\left(A_\rho\frac{\partial{\overrightarrow a}_\rho}{\partial\rho}+{\overrightarrow a}_\rho\frac{\partial A_\rho}{\partial\rho}\right)+\left(A_\phi\frac{\partial{\overrightarrow a}_\phi}{\partial\rho}+{\overrightarrow a}_\phi\frac{\partial A_\phi}{\partial\rho}\right)+\left(A_z\frac{\partial{\overrightarrow a}_z}{\partial\rho}+{\overrightarrow a}_z\frac{\partial A_z}{\partial\rho}\right)\right] +\left(\frac1\rho\right){\overrightarrow a}_\phi\cdot\left[\left(A_\rho\frac{\partial{\overrightarrow a}_\rho}{\partial\phi}+{\overrightarrow a}_\rho\frac{\partial A_\rho}{\partial\phi}\right)+\left(A_\phi\frac{\partial{\overrightarrow a}_\phi}{\partial\phi}+{\overrightarrow a}_\phi\frac{\partial A_\phi}{\partial\phi}\right)+\left(A_z\frac{\partial{\overrightarrow a}_z}{\partial\phi}+{\overrightarrow a}_z\frac{\partial A_z}{\partial\phi}\right)\right] +{\overrightarrow a}_z\cdot\left[\left(A_\rho\frac{\partial{\overrightarrow a}_\rho}{\partial z}+{\overrightarrow a}_\rho\frac{\partial A_\rho}{\partial z}\right)+\left(A_\phi\frac{\partial{\overrightarrow a}_\phi}{\partial z}+{\overrightarrow a}_\phi\frac{\partial A_\phi}{\partial z}\right)+\left(A_z\frac{\partial{\overrightarrow a}_z}{\partial z}+{\overrightarrow a}_z\frac{\partial A_z}{\partial z}\right)\right] ={\overrightarrow a}_\rho\cdot\left[\left(A_\rho(0)+{\overrightarrow a}_\rho\frac{\partial A_\rho}{\partial\rho}\right)+\left(A_\phi(0)+{\overrightarrow a}_\phi\frac{\partial A_\phi}{\partial\rho}\right)+\left(A_z(0)+{\overrightarrow a}_z\frac{\partial A_z}{\partial\rho}\right)\right] +\left(\frac1\rho\right){\overrightarrow a}_\phi\cdot\left[\left(A_\rho({\overrightarrow a}_\phi)+{\overrightarrow a}_\rho\frac{\partial A_\rho}{\partial\phi}\right)+\left(A_\phi(-{\overrightarrow a}_\rho)+{\overrightarrow a}_\phi\frac{\partial A_\phi}{\partial\phi}\right)+\left(A_z(0)+{\overrightarrow a}_z\frac{\partial A_z}{\partial\phi}\right)\right] +{\overrightarrow a}_z\cdot\left[\left(A_\rho(0)+{\overrightarrow a}_\rho\frac{\partial A_\rho}{\partial z}\right)+\left(A_\phi(0)+{\overrightarrow a}_\phi\frac{\partial A_\phi}{\partial z}\right)+\left(A_z(0)+{\overrightarrow a}_z\frac{\partial A_z}{\partial z}\right)\right]Now, we know that,
{\overrightarrow a}_\rho\cdot{\overrightarrow a}_\rho={\overrightarrow a}_\phi\cdot{\overrightarrow a}_\phi={\overrightarrow a}_z\cdot{\overrightarrow a}_z=1 {\overrightarrow a}_\rho\cdot{\overrightarrow a}_\phi={\overrightarrow a}_\phi\cdot{\overrightarrow a}_z={\overrightarrow a}_z\cdot{\overrightarrow a}_\rho=0 \therefore\nabla\cdot\overrightarrow A=\boxed{\frac{\partial A_\rho}{\partial\rho}+\frac{A_\rho}\rho}+\frac1\rho\frac{\partial A_\phi}{\partial\phi}+\frac{\partial A_z}{\partial z}The highlighted terms can be rewritten for consistency as follows
\nabla\cdot\overrightarrow A=\frac1\rho\frac\partial{\partial\rho}\left(\rho A_\rho\right)+\frac1\rho\frac{\partial A_\phi}{\partial\phi}+\frac{\partial A_z}{\partial z}Which is our required cylindrical divergence operator.
4 Ultimate Visual FREE E-Books on Coordinate Systems & Transformations
Must for GATE EE/EC Aspirants
Divergence in Spherical Coordinates
As I explained while deriving the Divergence for Cylindrical Coordinates that formula for the Divergence in Cartesian Coordinates is quite easy and derived as follows:
\nabla\cdot\overrightarrow A=\frac{\partial A_x}{\partial x}+\frac{\partial A_y}{\partial y}+\frac{\partial A_z}{\partial z}And the same Divergence in Spherical Coordinates is as below:
\nabla\cdot\overrightarrow A=\frac1{r^2}\frac\partial{\partial r}\left(r^2A_r\right)+\frac1{r\sin\theta}\frac\partial{\partial\theta}\left(\sin\theta\;A_\theta\right)+\frac1{r\sin\theta}\frac{\partial A_\phi}{\partial\phi}As we have worried about the terms like (1/ρ) and ρ in Cylindrical Divergence, here for Spherical Divergence, it is quite obvious to think about the extra terms r2, rsinθ and sinθ. Isn’t it? Where do they come from? What is the logic behind them?
One can think of getting partial derivatives w.r.t. r, φ and θ instead of x, y and z and Ar, Aφ and Aθ instead of Ax, Ay and Az. Right?
And as we have seen for the Cylindrical Divergence Case, the answer could be found in the steps of derivations for Divergence in Spherical Coordinates.
I have already explained to you that the derivation for the divergence in polar coordinates i.e. Cylindrical or Spherical can be done by two approaches.
Approach:1 Starting with the Divergence formula in Cartesian and then converting each of its element into the Spherical using proper conversion formulas.
The partial derivatives with respect to x, y and z would be converted into the ones with respect to r, φ and θ.
The x, y and z components of the vector are equivalently written in terms of r, φ and θ components.
Approach:2The del operator (∇) is its self written in the Spherical Coordinates and dotted with vector represented in Spherical System.
For deriving Divergence in Cylindrical Coordinate System, we have utilized the second approach.
Now, for deriving the Divergence in Spherical Coordinate System, let us utilize the first approach.
We will start with the Divergence formula in Cartesian and then we’ll convert each of its element into the Spherical using proper conversion formulas.
4 Ultimate Visual FREE E-Books on Coordinate Systems & Transformations
Must for GATE EE/EC Aspirants
Divergence in Spherical Coordinates Derivation
We know that, Divergence of a vector field in Cartesian Coordinate System is,
\nabla\cdot\overrightarrow A=\frac\partial{\partial x}\left(A_x\right)+\frac\partial{\partial y}\left(A_y\right)+\frac\partial{\partial z}\left(A_z\right)So to convert this expression into the Spherical Coordinate System we will need 3 steps.
Firstly, the partial derivatives with respect to x, y and z would be converted into the ones with respect to r, φ and θ.
Then, the x, y and z components of the vector i.e. Ax, Ay and Az are equivalently written in terms of Ar, Aφ and Aθ.
Then, finally perform the derivative operation and collect the terms to get required Divergence in Spherical Coordinates.
Step-1 Obtaining partial derivatives w.r.t. x, y and z in terms of r, θ and φ
\frac\partial{\partial x};\frac\partial{\partial y}\;and\;\frac\partial{\partial z}\Rightarrow in\;terms\;of\;\frac{\displaystyle\partial}{\displaystyle\partial r};\frac{\displaystyle\partial}{\displaystyle\partial\theta}\;and\;\frac{\displaystyle\partial}{\displaystyle\partial\phi}
For that let us apply the basic rule of the differentiation called the chain rule.
\frac\partial{\partial x}=\frac\partial{\partial r}\frac{\partial r}{\partial x}+\frac\partial{\partial\theta}\frac{\partial\theta}{\partial x}+\frac\partial{\partial\phi}\frac{\partial\phi}{\partial x}
\frac\partial{\partial y}=\frac\partial{\partial r}\frac{\partial r}{\partial y}+\frac\partial{\partial\theta}\frac{\partial\theta}{\partial y}+\frac\partial{\partial\phi}\frac{\partial\phi}{\partial y}
\frac\partial{\partial z}=\frac\partial{\partial r}\frac{\partial r}{\partial z}+\frac\partial{\partial\theta}\frac{\partial\theta}{\partial z}+\frac\partial{\partial\phi}\frac{\partial\phi}{\partial z}
So, we will need following derivatives:
\frac{\partial r}{\partial x};\frac{\partial\theta}{\partial x};\frac{\partial\phi}{\partial x};\frac{\partial r}{\partial y};\frac{\partial\theta}{\partial y};\frac{\partial\phi}{\partial y};\frac{\partial r}{\partial z};\frac{\partial\theta}{\partial z}\&\frac{\partial\phi}{\partial z}And for that let us recall the transformation between Spherical and Cartesian Coordinate System. We know the following results:
r=\sqrt{x^2+y^2+z^2} | x=r\;\sin\theta\;\cos\phi |
\theta=\tan^{-1}\left(\frac{\sqrt{x^2+y^2}}z\right)=\cos^{-1}\left(\frac zr\right) | y=r\;\sin\theta\;\sin\phi |
\phi=\tan^{-1}\left(\frac yx\right) | z=r\;\cos\theta |
So let us calculate the required derivatives.
\frac{\partial r}{\partial x}=\frac\partial{\partial x}\sqrt{x^2+y^2+z^2}=\frac{x}{\sqrt{x^2+y^2+z^2}}
\therefore\frac{\partial r}{\partial x}=\frac{r\sin\theta\cos\phi}r=\sin\theta\cos\phi
Note the simplification in the above step. As we are going to convert into the Spherical coordinates from the Cartesian ones, we must simplify to the extent so that to get spherical variables. Similarly,
\frac{\partial\theta}{\partial x}=\frac\partial{\partial x}\tan^{-1}\left(\frac{\sqrt{x^2+y^2}}z\right)=\frac1{1+{\displaystyle\frac{x^2+y^2}{z^2}}}\frac\partial{\partial x}\left(\frac{\displaystyle\sqrt{x^2+y^2}}{\displaystyle z}\right)
=\frac{z^2}{x^2+y^2+z^2}\left(\frac1z\right)\frac x{\sqrt{x^2+y^2}}=\frac{xz}{\left(x^2+y^2+z^2\right){\displaystyle\sqrt{x^2+y^2}}}
\therefore\frac{\partial\theta}{\partial x}=\frac{r\;\sin\theta\;\cos\phi\;r\;\cos\theta}{r^2\sqrt{r^2\sin^2\theta\cos^2\phi+r^2\sin^2\theta\sin^2\phi}}=\frac{\sin\theta\cos\theta\cos\phi}{r\sin\theta}
\therefore\frac{\partial\theta}{\partial x}=\frac{\cos\theta\cos\phi}r
\frac{\partial\phi}{\partial x}=\frac\partial{\partial x}\left(\tan^{-1}\frac yx\right)=\frac1{1+\left({\displaystyle\frac yx}\right)^2}y\left(\frac{-1}{x^2}\right)=\frac{-y}{x^2+y^2}
\therefore\frac{\partial\phi}{\partial x}=-\frac{r\sin\theta\sin\phi}{r^2\sin^2\theta}=-\frac{\sin\phi}{r\sin\theta}
Working on the similar lines, we can get following derivatives,
\frac{\partial r}{\partial y}=\sin\theta\sin\phi;\;\frac{\partial\theta}{\partial y}=\frac{\cos\theta\sin\phi}r;\;\frac{\partial\phi}{\partial y}=\frac{\cos\phi}{r\sin\theta}
\frac{\partial r}{\partial z}=\cos\theta;\;\frac{\partial\theta}{\partial z}=\frac{-\sin\theta}r;\;\frac{\partial\phi}{\partial z}=0
So, now we have all the required derivatives. Let us put these into the expressions before.
\frac\partial{\partial x}=\frac\partial{\partial r}\frac{\partial r}{\partial x}+\frac\partial{\partial\theta}\frac{\partial\theta}{\partial x}+\frac\partial{\partial\phi}\frac{\partial\phi}{\partial x}
\therefore\frac\partial{\partial x}=\left(\frac\partial{\partial r}\right)\left(\sin\theta\cos\phi\right)+\left(\frac\partial{\partial\theta}\right)\left(\frac{\cos\theta\cos\phi}r\right)+\left(\frac\partial{\partial\phi}\right)\left(-\frac{\sin\phi}{r\sin\theta}\right) \therefore\frac\partial{\partial x}=\sin\theta\cos\phi\frac\partial{\partial r}+\frac{\cos\theta\cos\phi}r\frac\partial{\partial\theta}-\frac{\sin\phi}{r\sin\theta}\frac\partial{\partial\phi}Similarly, we can have,
\frac\partial{\partial y}=\frac\partial{\partial r}\frac{\partial r}{\partial y}+\frac\partial{\partial\theta}\frac{\partial\theta}{\partial y}+\frac\partial{\partial\phi}\frac{\partial\phi}{\partial y}
\therefore\frac\partial{\partial y}=\sin\theta\sin\phi\frac\partial{\partial r}+\frac{\cos\theta\sin\phi}r\frac\partial{\partial\theta}+\frac{\cos\phi}{r\sin\theta}\frac\partial{\partial\phi}\frac\partial{\partial z}=\frac\partial{\partial r}\frac{\partial r}{\partial z}+\frac\partial{\partial\theta}\frac{\partial\theta}{\partial z}+\frac\partial{\partial\phi}\frac{\partial\phi}{\partial z}
\therefore\frac\partial{\partial z}=\cos\theta\frac\partial{\partial r}-\frac{\sin\theta}r\frac\partial{\partial\theta}So, we have finished our first step. Let me remind you what we were doing. We wanted to convert following gradient expression from Cartesian to Spherical representation.
\nabla\cdot\overrightarrow A=\frac\partial{\partial x}\left(A_x\right)+\frac\partial{\partial y}\left(A_y\right)+\frac\partial{\partial z}\left(A_z\right)And for that we needed 3 steps.
Step:1 Partial derivatives with respect to x, y and z would be converted into the ones with respect to r, φ and θ.
Step:2 x, y and z components of the vector i.e. Ax, Ay and Az are equivalently written in terms of Ar, Aφ and Aθ.
Step:3 Finally perform the derivative operation and collect the terms to get required Divergence in Spherical Coordinates.
Now, we are done with step 1. So, let’s move to step 2.
Step-2 Representing Ax, Ay and Az in terms of Ar, Aφ and Aθ.
And for that let us recall the transformation between Spherical and Cartesian Coordinate System. To get the components of the vector from the cartesian components we have following result.
Hence we have,
A_x=\sin\theta\cos\phi A_r+\cos\theta\cos\phi A_\theta-\sin\phi A_\phiA_y=sin\theta sin\phi A_r+cos\theta sin\phi A_\theta+cos\phi A_\phiand
A_z=\cos\theta A_r-\sin\theta A_\thetaSo, finally to get divergence in spherical coordinates, let put all the terms together.
\nabla\cdot\overrightarrow A=\frac\partial{\partial x}\left(A_x\right)+\frac\partial{\partial y}\left(A_y\right)+\frac\partial{\partial z}\left(A_z\right) \therefore\nabla\cdot\overrightarrow A= \left(\sin\theta\cos\phi\frac\partial{\partial r}+\frac{\cos\theta\cos\phi}r\frac\partial{\partial\theta}-\frac{\sin\phi}{r\sin\theta}\frac\partial{\partial\phi}\right)\left(\sin\theta\cos\phi A_r+\cos\theta\cos\phi A_\theta-\sin\phi A_\phi\right) +\left(\sin\theta\sin\phi\frac\partial{\partial r}+\frac{\cos\theta\sin\phi}r\frac\partial{\partial\theta}+\frac{\cos\phi}{r\sin\theta}\frac\partial{\partial\phi}\right)\left(sin\theta sin\phi A_r+cos\theta sin\phi A_\theta+cos\phi A_\phi\right) +\left(\cos\theta\frac\partial{\partial r}-\frac{\sin\theta}r\frac\partial{\partial\theta}\right)\left(\cos\theta A_r-\sin\theta A_\theta\right)Now it’s a mechanical work. Just take the proper derivatives, club the terms and simplify. Note that in the following steps, we will use product rule several times.
Step-3 Derivatives and Collecting Terms
\therefore\nabla\cdot\overrightarrow A= \sin\theta\cos\phi\left[\sin\theta\cos\phi\frac{\partial A_r}{\partial r}+\cos\theta\cos\phi\frac{\partial A_\theta}{\partial r}-\sin\phi\frac{\partial A_\phi}{\partial r}\right] +\frac{\cos\theta\cos\phi}r\left[\cos\phi\left(A_r\cos\theta+\sin\theta\frac{\partial A_r}{\partial\theta}\right)+\cos\phi\left(-A_\theta\sin\theta+\cos\theta\frac{\partial A_\theta}{\partial\theta}\right)-\sin\phi\frac{\partial A_\phi}{\partial\theta}\right] -\frac{\sin\phi}{r\sin\theta}\left[\sin\theta\left(-A_r\sin\phi+\cos\phi\frac{\partial A_r}{\partial\phi}\right)+\cos\theta\left(-A_\theta\sin\phi+\cos\phi\frac{\partial A_\theta}{\partial\phi}\right)-\left(\sin\phi\frac{\partial A_\phi}{\partial\phi}+A_\phi\cos\phi\right)\right] +\sin\theta\sin\phi\left[\sin\theta\sin\phi\frac{\displaystyle\partial A_r}{\displaystyle\partial r}+\cos\theta\sin\phi\frac{\displaystyle\partial A_\theta}{\displaystyle\partial r}+\cos\phi\frac{\displaystyle\partial A_\phi}{\displaystyle\partial r}\right] +\frac{\displaystyle\cos\theta\sin\phi}r\left[\sin\phi\left(A_r\cos\theta+\sin\theta\frac{\displaystyle\partial A_r}{\displaystyle\partial\theta}\right)+\sin\phi\left(-A_\theta\sin\theta+\cos\theta\frac{\displaystyle\partial A_\theta}{\displaystyle\partial\theta}\right)+\cos\phi\frac{\displaystyle\partial A_\phi}{\displaystyle\partial\theta}\right] +\frac{\cos{\displaystyle\phi}}{r\sin\theta}\left[\sin\theta\left(A_r\cos\phi+\sin\phi\frac{\displaystyle\partial A_r}{\displaystyle\partial\phi}\right)+\cos\theta\left(A_\theta\cos\phi+\sin\phi\frac{\displaystyle\partial A_\theta}{\displaystyle\partial\phi}\right)+\left(-\sin\phi A_\phi+\cos\phi\frac{\displaystyle\partial A_\phi}{\displaystyle\partial\phi}\right)\right] +\cos\theta\left[\cos\theta\frac{\partial A_r}{\partial r}-\sin\theta\frac{\partial A_\theta}{\partial r}\right] -\frac{\sin\theta}r\left[\left(-A_r\sin\theta+\cos\theta\frac{\partial A_r}{\partial\theta}\right)-\left(A_\theta\cos\theta+\sin\theta\frac{\partial A_\theta}{\partial\theta}\right)\right]Try to simplify by taking similar terms together and use the basic identity, \sin^2\theta+\cos^2\theta=1 or \sin^2\phi+\cos^2\phi=1.
You will come to know, the terms with derivatives \frac{\displaystyle\partial A_\theta}{\displaystyle\partial r},\;\frac{\displaystyle\partial A_\phi}{\displaystyle\partial r},\;\frac{\displaystyle\partial A_r}{\displaystyle\partial\theta},\;\frac{\displaystyle\partial A_\phi}{\displaystyle\partial\theta},\;\frac{\displaystyle\partial A_r}{\displaystyle\partial\phi}\;\&\;\frac{\displaystyle\partial A_\theta}{\displaystyle\partial\phi} are going to vanish.
And it is simplified to,
\nabla\cdot\overrightarrow A=\sin^2\theta\cos^2\phi\frac{\partial A_r}{\partial r}+\sin^2\theta\sin^2\phi\frac{\partial A_r}{\partial r}+\cos^2\theta\frac{\partial A_r}{\partial r} +\frac{\cos^2\theta\cos^2\phi}rA_r+\frac{{\sin^2}{\phi}}rA_r+\frac{{\cos^2}{\theta}{{\sin}^2}{\phi}}rA_r+\frac{\cos^2\phi}rA_r+\frac{\sin^2\theta}rA_r +\frac{\cos^2\theta\cos^2\phi}r\frac{\partial A_\theta}{\partial\theta}+\frac{\cos^2\theta\sin^2\phi}r\frac{\partial A_\theta}{\partial\theta}+\frac{\sin^2\theta}r\frac{\partial A_\theta}{\partial\theta} -\frac{\cos\theta\cos^2\phi}r\sin\theta\;A_\theta+\frac{\sin^2\phi}{r\sin\theta}\cos\theta\;A_\theta-\frac{\cos\theta\sin^2\phi}r\sin\theta\;A_\theta +\frac{\cos^2\phi}{r\sin\theta}\cos\theta\;A_\theta+\frac{\sin\theta}r\cos\theta\;A_\theta +\frac{\sin^2\phi}{r\sin\theta}\frac{\partial A_\phi}{\partial\phi}+\frac{\cos^2\phi}{r\sin\theta}\frac{\partial A_\phi}{\partial\phi}Again simplifying the terms and utilizing, \sin^2\theta+\cos^2\theta=1 or \sin^2\phi+\cos^2\phi=1; we can get as follows.
\nabla\cdot\overrightarrow A=\frac{\partial A_r}{\partial r}+2\frac{A_r}r+\frac1r\frac{\partial A_\theta}{\partial\theta}+\frac{\cos\theta}{r\sin\theta}A_\theta+\frac1{r\sin\theta}\frac{\partial A_\phi}{\partial\phi}But, to have simplicity in the expression, we can rewrite above expression as follows.
\nabla\cdot\overrightarrow A=\frac1{r^2}\frac\partial{\partial r}\left(r^2A_r\right)+\frac1{r\sin\theta}\frac\partial{\partial\theta}\left(A_\theta\sin\theta\right)+\frac1{r\sin\theta}\frac{\partial A_\phi}{\partial\phi}Note that, both the expressions are exactly same. We have rewritten the prior expression, for the sake of simplicity and uniformity in the divergence formulae in all the coordinate systems.
And, this is the expression for divergence in spherical coordinates.
4 Ultimate Visual FREE E-Books on Coordinate Systems & Transformations
Must for GATE EE/EC Aspirants