Introduction
In this post, I find an expression for the gradient of a function, in terms of spherical coordinates. This is a continuation of previous posts, such as this one. This post has a lot of symbols, but there is a lot of repetition.
Formalism
Recall that
$ \vec{e}_r = \frac{\partial x(r)}{\partial r}\big|_{r^+} \vec{e}_x + \frac{\partial y(r)}{\partial r}\big|_{r^+} \vec{e}_y + \frac{\partial z(r)}{\partial r}\big|_{r^+} \vec{e}_z $
$ \vec{e}_{\theta} = \frac{1}{r} \frac{\partial x(\theta)}{\partial\theta} \big|_{\theta^+} \vec{e}_x + \frac{1}{r} \frac{\partial y(\theta)}{\partial \theta} \big|_{\theta^+} \vec{e}_y + \frac{1}{r} \frac{\partial z(\theta)}{\partial\theta} \big|_{\theta^+} \vec{e}_z $
$\vec{e}_{\phi} = \frac{1}{r \sin\theta} \frac{\partial x(\phi)}{\partial\phi}\big|_{\phi^+} \vec{e}_x + \frac{1}{r \sin\theta} \frac{\partial y(\phi)}{\partial\phi}\big|_{\phi^+} \vec{e}_{y}$.
Multiply the first equation by $\partial r|_{r^+}$, multiply the second equation by $r \partial\theta |_{\theta^+}$, and multiply the third equation by $ r\sin\theta \partial\phi |_{\phi^+}$.
$ \partial r|_{r^+} \vec{e}_r = {\partial x(r)} |_{r^+} \vec{e}_x + {\partial y(r)} |_{r^+} \vec{e}_y + {\partial z(r)} |_{r^+} \vec{e}_z $
$r \partial\theta |_{\theta^+} \vec{e}_{\theta} = {\partial x(\theta)} |_{\theta^+} \vec{e}_x + {\partial y(\theta)} |_{\theta^+} \vec{e}_y + {\partial z(\theta)} |_{\theta^+} \vec{e}_z $
$r\sin\theta \partial\phi |_{\phi^+} \vec{e}_{\phi} = {\partial x(\phi)} |_{\phi^+} \vec{e}_x + {\partial y(\phi)} |_{\phi^+} \vec{e}_{y}$.
Next, multiply the first equation by $\frac{1}{\partial f|_{r^+}}$, multiply the second equation by $\frac{1}{\partial f |_{\theta^+}}$, and multiply the third equation by $\frac{1}{\partial f|_{\phi^+}}$. Here, $f$ is a function. I use $df$ instead of just $d$ because $df$ is a quantity that can be simply treated as a factor whereas $d$ is an operator.
$\frac{\partial f}{ \partial r }\big|_{r^+} \vec{e}_r = \frac{\partial f}{\partial x(r)} \big|_{r^+} \vec{e}_x + \frac{\partial f}{\partial y(r)} \big|_{r^+} \vec{e}_y + \frac{\partial f}{\partial z(r)} \big|_{r^+} \vec{e}_z $
$\frac{\partial f}{r \partial \theta }\big|_{\theta^+} \vec{e}_{\theta} = \frac{\partial f}{\partial x(\theta)} \big|_{\theta^+} \vec{e}_x + \frac{\partial f}{\partial y(\theta)} \big|_{\theta^+} \vec{e}_y + \frac{\partial f}{\partial z(\theta)} \big|_{\theta^+} \vec{e}_z $
$\frac{\partial f}{r\sin\theta \partial \phi } \big|_{\phi^+} \vec{e}_{\phi} = \frac{\partial f}{\partial x(\phi)} \big|_{\phi^+} \vec{e}_x + \frac{\partial f}{\partial y(\phi)} \big |_{\phi^+} \vec{e}_{y}$.
Simply the left hand sides.
$\frac{\partial f}{ \partial r }\big|_{r^+} \vec{e}_r = \frac{\partial f}{\partial x(r)} \big|_{r^+} \vec{e}_x + \frac{\partial f}{\partial y(r)} \big|_{r^+} \vec{e}_y + \frac{\partial f}{\partial z(r)} \big|_{r^+} \vec{e}_z $
$\frac{1}{r}\frac{\partial f}{ \partial \theta }\big|_{\theta^+} \vec{e}_{\theta} = \frac{\partial f}{\partial x(\theta)} \big|_{\theta^+} \vec{e}_x + \frac{\partial f}{\partial y(\theta)} \big|_{\theta^+} \vec{e}_y + \frac{\partial f}{\partial z(\theta)} \big|_{\theta^+} \vec{e}_z $
$\frac{1}{r\sin\theta}\frac{\partial f}{\partial \phi } \big|_{\phi^+} \vec{e}_{\phi} = \frac{\partial f}{\partial x(\phi)} \big|_{\phi^+} \vec{e}_x + \frac{\partial f}{\partial y(\phi)} \big |_{\phi^+} \vec{e}_{y}$.
On the right sides, the 1st column comprises the variation of $f$ with respect to $x$ in the $\vec{e}_x$-direction, the 2nd column comprises the variation of $f$ with respect to $y$ in the $\vec{e}_y$-direction, and the third column comprises the variation of $f$ with respect to $z$ in the $\vec{e}_z$-direction. Adding all the terms yields
$\frac{\partial f}{ \partial r }\big|_{r^+} \vec{e}_r + \frac{1}{r}\frac{\partial f}{ \partial \theta }\big|_{\theta^+} \vec{e}_{\theta} + \frac{1}{r\sin\theta}\frac{\partial f}{\partial \phi } \big|_{\phi^+} \vec{e}_{\phi} = \frac{\partial f}{\partial x} \vec{e}_x + \frac{\partial f}{\partial y} \vec{e}_y + \frac{\partial f}{\partial z} \vec{e}_z$.
I am not sure whether $\frac{\partial f}{\partial x}$ should be written as $\frac{\partial f}{\partial x} \big|_{x}$ , $\frac{\partial f}{\partial x} \big|_{x^+}$, or $\frac{\partial f}{\partial x} \big|_{x^-}$, so I leave this point ambiguous. Since
$\vec{\nabla} f \equiv \frac{\partial f}{\partial x} \vec{e}_x + \frac{\partial f}{\partial y} \vec{e}_y + \frac{\partial f}{\partial z} \vec{e}_z$,
one has
$ \boxed{ \vec{\nabla} f \equiv \vec{e}_r \frac{\partial f}{ \partial r }\big|_{r^+} + \vec{e}_{\theta} \frac{1}{r}\frac{\partial f}{ \partial \theta }\big|_{\theta^+} + \vec{e}_{\phi} \frac{1}{r\sin\theta}\frac{\partial f}{\partial \phi } \big|_{\phi^+} } $.
This is the gradient of a function, in terms of spherical coordinates.