Suppose $f(x,y) = g(x^2 + y^2)$ for some single-variable function $g$. Show that the gradient of $f$ at any point $(x,y)$ is always pointing toward or away from the origin.
To find $\partial_x f$ and $\partial_y f$, we can use the single-variable chain rule: \begin{align} \partial_x f(x,y) &= g'(x^2+y^2) \ 2 x\\ \partial_y f(x,y) &= g'(x^2+y^2) \ 2 y\end{align} where $g'$ is the one-dimensional derivative of $g$.
Thus, the gradient is \begin{align} \nabla f(x,y) &= g'(x^2 + y^2) \ 2 x \ \mathbf{i} + g'(x^2 + y^2) \ 2 y \ \mathbf{j}\\ &= 2 \ g'(x^2 + y^2) \Bigl(x \ \mathbf{i} + y \ \mathbf{j} \Bigr) \end{align}
This vector is a scalar multiple of $x \ \mathbf{i} + y \ \mathbf{j}$, which points from the origin to the point $(x,y)$. If $g' \gt 0$ then, the gradient points away from the origin. If $g' \lt 0$, then the gradient points toward the origin.