Let $r = f(\theta, \varphi)$ be a function defined in spherical coordinates, using the convention $x = r \sin \theta \cos \varphi$, $y = r \sin \theta \sin \varphi$, $z = r \cos \theta$. How can I compute the (inward or outward) normal vector on the surface defined by this function?
I tried looking at $G(r, \theta, \varphi) = r - f(\theta, \varphi)$ and computing $$\nabla G = \frac{\partial G}{\partial r}\vec e_r + \frac{1}{r}\frac{\partial G}{\partial\theta}\vec e_\theta + \frac{1}{r\sin\theta}\frac{\partial G}{\partial \varphi} \vec e_\varphi = \vec e_r - \frac{1}{r}\frac{\partial f}{\partial \theta}\vec e_\theta - \frac{1}{r\sin\theta}\frac{\partial f}{\partial \varphi}\vec e_\varphi, $$ working analogously to the case that $z = f(x, y)$ has a normal vector $\vec n = \nabla (z-f(x, y))$, but this doesn't seem to work. I also looked at defining $\vec r = f(\theta, \varphi) \vec e_r$ but also couldn't see the next step from here as I'm unsure how to apply the cross product in this case to compute a normal.