Calculus based proof that If $f$ satisfies $x^TM_1 = f(x) x^T M_2$ then $f$ must be constant I want to prove that if $f$ satisfies $x^TM_1 = f(x) x^T M_2$ for all $x \in \mathbb{R}^d, M_1, M_2 \in \mathbb{R}^{d \times d}\ d \ge 2$ and $M_1 \ne 0$ and $M_2 \ne 0$, then $f$ must be a constant and $M_1$ must be a constant multiple of $M_2$. 
Instead of proving this algebraically, I am trying to solve it through calculus. So I defined $g(x)= 0 = x^TM_1 - f(x) x^T M_2$. By calculating the jacobian of $g$ I can see that $0 = M_1 - (f(x) M_2 + \nabla f (x^TM_2))$. Through left-multiplication with $x^T$ I get that $(x^T \nabla f)(x^TM_2) = 0$. 
So $f$ has the interesting property that gradient at $x$ is orthogonal to $x$. Does this property imply that $f$ must be constant? 
I am now looking for some hints about how to move forward? How can I prove/disprove my  claim even in $\mathbb{R}^2$. If there exists a non-constant $f$ in $\mathbb{R}^2$ that satisfies $(x^T \nabla f) = 0$ then that would mean that that I have to find:
$f(x_1,x_2)$ s.t. 
$\frac{\partial f}{\partial x_1} = -x_2$ and $\frac{\partial f}{\partial x_2} = x_1$
I already tried to compute this in mathematica and although it's able to solve 
DSolve[{D[f[a, b], a] * a + D[f[a, b], b] * b == 0}, f[a, b], {a, b}]

and suggests $f(x_1, x_2) = x_1 / x_2$ but it's not able to solve 
DSolve[{D[f[a, b], a] + b == 0, D[f[a, b], b] - a == 0}, f[a, b], {a, b}]

Does my PDE have no solution? 

It is wrong in general. The function $f$ need not be constant.
Consider 
$$M_1 = M_2 = \begin{bmatrix}1 & 0 \\ 0 & 0 \end{bmatrix}$$
and
$$ f(x) = \begin{cases} 1, & x_1 \ne 0, \\ 0, & x_1 = 0. \end{cases} $$
It follows
$ M_1 - f(x) M_2 = 0 $ for $x_1 \ne 0$
and
$ x^T(M_1 - f(x) M_2) = 0 $ for $x_1 = 0$.
If we may assume that $M_2$ is nonsingular and $f$ is continuous at $0$, then the statement holds.
Let $a\in\mathbb R^d$ be such that $a^T M_2 \ne 0$. Thus, for every $t\in\mathbb R$ it follows
$$ f(ta)(ta)^T M_2 = (ta)^T M_1 = t a^T M_1 = t f(a) a^T M_2. $$
Since $a^T M_2 \ne 0$ we have $f(ta) = f(a)$ for every $t\ne 0$.
Now, if $f$ is continuous at $0$, it follows $f(ta) = f(0)$ for every $t\in\mathbb R$. And if $M_1$ is nonsingular, we have $a^T M_1\ne0$ for every $a\ne0$. Thus, $f$ is constant and $M_1$ is a constant multiple of $M_2$.
Notes: 
$a^T M_1 \ne 0$ implies $a^T M_2\ne 0$ and $f(a)\ne 0$.
