$\sum_{i,j=1}^nx_ix_j\frac{\partial^2f}{\partial x_i\partial x_j}=0$ and $\nabla f(0)=0$ implies constancy of $f$ in $B_1(0)$ Let $B_1(0)$ be the unit ball in $\mathbb R^n$ centered at the origin. Assume that the function $f\in  C^2(B_1(0))$. Prove that
$1)$If $f$ satisfies $$\sum_{i,j=1}^nx_ix_j\frac{\partial^2f}{\partial x_i\partial x_j}=0$$on $B_1(0)$, and $\nabla f(0) = 0$, then $f$ is constant in $B_1(0)$.
$2)$If $f$ satisfies $$x_i\frac{\partial f}{\partial x_j}-x_j\frac{\partial f}{\partial x_i}=0,i,j=1,\cdots,n$$on $B_1(0)$,then $f$ is constant on the sphere $\{x:x\in B_1(0),\vert x\vert=\frac{1}{2}\}$.
My intuition for the first problem is that if letting $L=\sum_{i=1}^{n}x_i\frac{\partial}{\partial x_i}$, then we have $L^2f=Lf$. But I don't know if this will proceed next, I think this maybe associated with the Hessian matrix or the maximum principle, but what property of Hessian matrix should I use here? Also this seems not the exactly the form of maximum principle so I don't know how to extend it. I don't know how to use the condition to proceed. Are there any solutions or suggestions of proceeding? Thanks in advance!
 A: 1)Let $x\in B_1(0)$ and define, for $t\in [0,1]$ :
$$g(t) = f(xt)$$
Then, $g$ is $C^2$ and for all $t\in [0,1]$, we have :
\begin{align}
g'(t) &= \sum_{i=1}^n x_i\frac{\partial f}{\partial x_i}(tx) \\
g''(t) &= \sum_{i,j=1}^n x_i x_j \frac{\partial^2 f}{\partial x_i \partial x_j}(tx) =0
\end{align}
Therefore $g'$ is constant, equal to $g'(0) = 0$. Therefore $g$ is constant and :
$$f(x) = g(1) = g(0) = f(0)$$
This finishes the proof.
2)Let $x,y$ on the sphere of radius $1/2$ and center $0$. Let $\gamma:[0,1] \to \mathbb R^n$ a $C^1$ map taking values on the sphere such that $\gamma(0) = x$ and $\gamma(1) = y$. (It is not hard to show that there is always such a path).
Then, we set $g(t) = f(\gamma(t))$ for each $t\in [0,1]$ and compute :
\begin{align}
g'(t) &= \sum_{i=1}^n \gamma'_i(t) \frac{\partial f}{\partial x_i}(\gamma(t))
\end{align}
On the other hand, we have $\sum_{i=1}^n \gamma_i(t)\gamma_i(t) = 1/2$ and therefore :
$$\forall t\in [0,1],  \sum_{i=1}^n \gamma_i(t) \gamma_i'(t) = 0$$
and :
$$\forall t\in [0,1], \gamma'_i(t) = 2 \sum_{j=1}^n (\gamma'_i(t) \gamma_j(t) - \gamma_i(t) \gamma_j'(t))\gamma_j(t)$$
Inserting this in $g'$, we get :
\begin{align}
\forall t\in [0,1], g'(t) &= 2\sum_{i,j = 1}^n (\gamma'_i(t) \gamma_j(t) - \gamma_i(t) \gamma_j'(t))\gamma_j(t)\frac{\partial f}{\partial x_i}(\gamma(t)) \\ 
&= \sum_{i,j = 1}^n (\gamma'_i(t) \gamma_j(t) - \gamma_i(t) \gamma_j'(t))\Big(\gamma_j(t)\frac{\partial f}{\partial x_i}(\gamma(t)) - \gamma_i(t)\frac{\partial f}{\partial x_j}(\gamma(t))\Big) \\
&= 0
\end{align}
Therefore $g$ is constant, and so is $f$.
