Gradient of a radial function (source code)

= Gradient of a radial function
{title2=$\nabla g(r)=g'(r)\mathbf r/r$}

For $r=\sqrt{x_1^2+\cdots+x_d^2}>0$, the <multivariable chain rule> gives
$$
\nabla g(r)=g'(r)\frac{(x_1,\ldots,x_d)}r.
$$
Indeed, $\partial r/\partial x_j=x_j/r$. Thus the <gradient> points radially outward when $g'(r)>0$, inward when it is negative, and vanishes when it is zero.

At the origin the displayed quotient does not apply. If $g$ has a finite right <derivative> at zero, the radial function is differentiable there exactly when $g'(0^+)=0$, in which case its <gradient> is zero. Necessity follows by comparing opposite directional difference quotients: their linear parts cannot both equal a common nonzero radial slope. Sufficiency follows from $g(r)-g(0)=o(r)$, the definition of differentiability with zero linear part.