# For a scalar field $f=f(x,y,z)$, is $\frac{\partial f}{\partial r} = \nabla_\vec{r} f(\vec{x})$?

Given a scalar field $f(\vec{x}) = f(x,y,z)$, I want to evaluate $\frac{\partial f}{\partial r}$ at $\vec{x}$ where r is the spherical coordinate in $(r,\theta,\phi)$. Is this equivalent to evaluating the derivative of $f$ in the direction of $\hat{r}$, $\nabla_{\hat{r}} f(\vec{x}) = \nabla f(\vec{x}) \cdot \hat{r}$? Are there alternative ways of evaluating $\frac{\partial f}{\partial r}$?

In spherical coordinates, we have $$x = r \cos\phi \sin \theta, \quad y = r\sin \phi\sin\theta, \quad z = r \cos \theta,$$ so, by the chain rule \begin{align*} \frac{\partial f}{\partial r} &= \frac{\partial f}{\partial x} \frac{\partial x}{\partial r} + \frac{\partial f}{\partial y} \frac{\partial y}{\partial r} + \frac{\partial f}{\partial z} \frac{\partial z}{\partial r}\\ &= \nabla f \cdot (\cos\phi \sin \theta, \sin \phi \sin \theta, \cos \theta) \end{align*} If now, in your notation $\hat r$ denotes the vector $(\cos\phi \sin \theta, \sin \phi \sin \theta, \cos \theta)$, we have $\frac{\partial f}{\partial r} = \nabla f \cdot \hat r$.