Q:

Show relation and linearity related to differentiable functions

I have problems solving the following exercise:

(a) Let $n\in \mathbb N$, $a\in \mathbb R$ and $f:\mathbb R^n \backslash \{ 0 \} \to \mathbb R$ $\mathbb R$-differentiable. Show that the relation $$\langle\nabla f(x),x\rangle = a\,f(x) \quad \forall x\in \mathbb R^n \backslash\{0\}$$
  holds, if, and only if, $$f(tx) = t^af(x) \quad \forall t>0 \text{ and } x\in \mathbb R^n\backslash \{0\}.$$
  (b) Let $n\in \mathbb N$ and $g:\mathbb R^n \to \mathbb R$ $\mathbb R$-differentiable and $$g(tx) = tg(x) \quad \forall t\in \mathbb R \text{ and } x\in\mathbb R^n.$$
  Show that g is linear.  

My thought is that I have to somehow use the chain rule for multidimensional functions, but I don't really know how to apply it. Maybe someone of you can help.

A:

For (a), the direction ($\Leftarrow$) can be shown by differentiate $f(tx)=t^{a}f(x)$ with respect to $t$ and put $t=1$. For the opposite direction, put $g(x)=|x|^{-a}f(x)$ where $|x|=\sqrt{x_{1}^{2}+\cdots+x_{n}^{2}}$ is standard euclidean norm. By using product rule and given relation $\langle \nabla f(x), x\rangle=af(x)$, we can prove
\begin{align}
\nabla f(x)=-a|x|^{-a-2}f(x)x+|x|^{-a}\nabla f(x)\Rightarrow \langle \nabla g(x),x\rangle=0.
\end{align}
Fix $x\in\mathbb{R}^{n}-\{0\}$ and let $h(t)=g(tx)$ for $t>0$. Then $h'(t)=\langle \nabla g(tx),x\rangle=\frac{1}{t}\langle \nabla g(tx), tx\rangle=0$, so $h$ is constant function and $g(tx)=g(x)\Leftrightarrow f(tx)=t^{a}f(x)$. 
For (b), just differentiate both side of $g(tx)=tg(x)$ with respect to $t$, then 
\begin{align}
\langle x, \nabla g(tx)\rangle=g(x).
\end{align}
Insert $t=0$, then $g(x)=\langle x, \nabla g(0)\rangle$ which is linear. 

