# Level sets of function

Let $f$ and $g$ be functions $\mathbf{R}^3\to\mathbf{R}$. Assume $f$ is differentiable and $f'(\mathbf{x})=g(\mathbf{x})\mathbf{x}$. Show that $f$ is constant on spheres centered at the origin. (Different spheres with different constants.) (The opposite direction is well-known, if $f$ is constant on spheres then $f'$ is perpendicular to the surface so that $f'(\mathbf{x})\parallel \mathbf{x}$.)

What I tried: consider the sphere $||\mathbf{x}||=c$. I have to show that $f(\mathbf{x}_1)-f(\mathbf{x}_2)=0$. I tried to estimate this difference by the definition of differential with error term, or Lagrange mean value theorem, but I couldn't prove that it is zero.

-
Consider a curve $\gamma:\ t\mapsto {\bf x}(t)$ lying on a sphere $\|{\bf x}\|=c>0$ and look at the derivative of the auxiliary function $$\phi(t):=f\bigl({\bf x}(t)\bigr)\ .$$ Use the chain rule and what you know about the vectors $\dot{\bf x}(t)$.