Show that $f$ is constant on each sphere in $\mathbb{R}^3$ centered at the origin Hi everyone this is a past exam question that I am studying as I go through my class that I am having trouble with, the full question is this:
Let $f:\mathbb{R}^3 \rightarrow \mathbb{R}$ be a differentiable function and suppose that 
$$ \nabla f(\textbf{x}) = g(\textbf{x})\textbf{x} $$ for all $\textbf{x} \in \mathbb{R}^3$ where $g: \mathbb{R}^3 \rightarrow \mathbb{R}$  is a function. Show that $f$ is constant on each sphere in $\mathbb{R}^3$ centered at $(0,0,0)$. i.e. show that if $\textbf{a}$, $\textbf{b}$ $\in \mathbb{R}^3$ and $\|\textbf{a}\| = \|\textbf{b}\|$ then $f(\textbf{a}) = f(\textbf{b})$.
I'm stuck on this question and not sure which direction to take. I'm really just throwing ideas around.
I do know that the gradient vector at $\textbf{a}$ is perpendicular to all the tangent lines to the level set $f^{-1}(c)$ at $\textbf{a}$.
Then letting $\textbf{x} = h(t) = (h_{1}(t), h_{2}(t), h_{3}(t))$ with $h(0)= \textbf{a}$.
I have $f(h(\textbf{0}))=c$. Then taking derivatives:
$$\frac{d}{dt}f(h(\textbf{0})) = \frac{d}{dt} c = 0$$
$$h'(0) \cdot \bigtriangledown f(h(\textbf{0})) = 0$$ 
Substituting in for $f(h(\textbf{0}))$ yields
$$h'(0) \cdot g(\textbf{a})\textbf{a} = 0$$ 
Now i'm really not sure where to go from here, how relate the magnitude of $\textbf{a}$ or $\textbf{b}$ to the question (do i need to parametrise?) I would really appreciate some guidance with this question.
 A: Pick a path $\gamma:[0,1]\to \mathbb{R}^3$ with $\gamma(0) = a$ and $\gamma(1) = b$, and with $|\gamma(t)| = r = |a|=|b|$ for all $t$, i.e.  $\gamma$ lies entirely on the sphere of radius $r= |a|=|b|$ centered at the origin.
I want to show that $(f \circ \gamma): [0,1] \to \mathbb{R}$ is a constant function. One way to do this is to show that its derivative is always $0$.
$\begin{align*}(f \circ \gamma)'(t) &= \nabla f(\gamma(t)) \cdot \gamma'(t) \text{ by the chain rule} \\
&=g(\gamma(t))\gamma(t) \cdot \gamma'(t)\\
&=0
\end{align*}$ 
The last equality follows since $\gamma(t)$ is a radial vector and $\gamma'(t)$ is a tangent vector to the sphere. Another way to see this is to use the chain rule again:
Let $R(x,y,z) = x^2+y^2+z^2$.  Then $R(\gamma(t)) = r$ for all $t \in [0,1]$.  By the chain rule,
$$
\nabla R(\gamma(t))\cdot \gamma'(t) = 0
$$
But by a computation, $\nabla R (x,y,z)= 2\begin{bmatrix}x\\y\\z\end{bmatrix}$.  In other words $\nabla R (v) = 2v$  So we have 
$$
2\gamma(t)\cdot \gamma'(t)=0
$$
Thus $(f \circ \gamma)'(t) = 0$ for all $t \in [0,1]$, so $(f \circ \gamma)$ is constant.  So $f(a) = f(b)$.  Since $a$ and $b$ were arbitrary points on the sphere of radius $r$, we have that $f$ is constant on any sphere centered at the origin.
A: Here is the idea:
If $|\mathbf{a}| = |\mathbf{b}|$, pick a path $\gamma$ lying entirely within the sphere of that common radius connecting $\mathbf{a}$ and $\mathbf{b}$
By the fundamental theorem of calculus,
$\begin{align*}
f(\mathbf{b}) - f(\mathbf{a}) &= \int_\gamma \nabla f \cdot \vec{dr}\\
&=\int_\gamma g(x)\vec{x}\cdot \vec{dr}
\end{align*}$
You need to conclude that this integral is $0$.  Can you see why it is?
