## The Gradient in Spherical Polar Coordinates

With respect to orthonormal Cartesian and spherical polar basis vectors
$( \mathbf{i} , \mathbf{j} , \mathbf{k} )$
and
$( \mathbf{e_r} , \mathbf{e_{\theta}} , \mathbf{e_\phi} )$
we can express the vector
$\mathbf{a}$
as
$\mathbf{a} =a_1 \mathbf{i} +a_2 \mathbf{j} +a_3 \mathbf{k} = b_1 \mathbf{e_r} , b_2 \mathbf{e_{\theta}} + b_3 \mathbf{e_\phi}$

We can take the dot product of
$\mathbf{a}$
with each of the cylindrical basis vectors gives
$\mathbf{a} \cdot \mathbf{e_r} = b_1$

$\mathbf{a} \cdot \mathbf{e_\theta} = b_2$

$\mathbf{a} \cdot \mathbf{e_\phi} = b_3$

Hence
$\mathbf{a} = (\mathbf{a} \cdot \mathbf{e_r}) \mathbf{e_r} + (\mathbf{a} \cdot \mathbf{e_{\theta}}) \mathbf{e_{\theta}} + (\mathbf{a} \cdot \mathbf{e_\phi}) \mathbf{e_\phi}$

Let
$\mathbf{a} = \mathbf{\nabla} f$
then
$\mathbf{{\nabla}} = (\mathbf{{\nabla}} \cdot \mathbf{e_r}) \mathbf{e_r} + (\mathbf{{\nabla}} \cdot \mathbf{e_{\theta}}) \mathbf{e_{\theta}} + (\mathbf{{\nabla}} \cdot \mathbf{e_\phi}) \mathbf{e_\phi}$

Now
$(ds)^2 = \sqrt{(dr)^2 + r^2 ( d \theta )^2 + r^2 sin^2 \theta(d \phi)^2} \rightarrow \frac{\partial r}{\partial s}=1, \: \frac{\partial s}{\partial \theta} = r \rightarrow \frac{\partial \theta}{\partial s}= \frac{1}{r} , \: \frac{\partial s}{\partial \phi } = r sin \theta \rightarrow \frac{\partial \phi}{\partial s}= \frac{1}{r sin \theta}$

$\mathbf{e_r} \cdot (\mathbf{\nabla} f) = \frac{\partial f}{\partial s}|_{\theta , \phi = constant} = \frac{\partial r}{\partial s} \frac{\partial f}{\partial r} = \frac{\partial f}{\partial r}$

$\mathbf{e_\theta} \cdot (\mathbf{\nabla} f) = \frac{\partial f}{\partial s}|_{r , \phi = constant} = \frac{\partial \theta}{\partial s} \frac{\partial f}{\partial \theta} =\frac{1}{r} \frac{\partial f}{\partial \theta}$

$\mathbf{e_\phi} \cdot (\mathbf{\nabla} f) = \frac{\partial f}{\partial \phi}|_{r, \theta = constant} = \frac{\partial \phi}{\partial s} \frac{\partial f}{\partial \phi} = \frac{1}{r sin \theta} \frac{\partial f}{\partial \phi}$

Hence
$\mathbf{\nabla} f = \frac{\partial f}{\partial r} \mathbf{e_r} _+ \frac{1}{r} \frac{\partial f}{\partial \theta} \mathbf{e_\theta}+ \frac{1}{r sin \theta} \frac{\partial f}{\partial \phi} \mathbf{e_\phi}$