Differentiating the spherical coordinate system
gives the orthogonal decomposition
where
Thus the scale factors of orthogonal coordinates are
Since the total differential satisfies
comparison of coefficients gives the gradient