# Is there a matrix that converts the gradient of every possible function to gradient of other function?

I have already asked this question on math.stackexchange.com https://math.stackexchange.com/questions/1789476/is-there-a-matrix-that-converts-the-gradient-of-any-function-to-gradient-of-othe Now I realize that Mathoverflow is probably better suited for this question.

The study of hamiltonian mechanics brought me to the following question.

Let $n$ be a natural number ($n>1$).

Let $A(\mathbf{x})$ be a $n\times n$ matrix consisting of functions $a_{ij}(\mathbf{x})$ ($a_{ij}:\mathbb{R}^n\to\mathbb{R}$): $$A(\mathbf{x})= \begin{pmatrix} a_{11}(\mathbf{x})& \cdots& a_{1n}(\mathbf{x})\\ \vdots&\ddots&\vdots\\ a_{n1}(\mathbf{x})&\cdots& a_{nn}(\mathbf{x}) \end{pmatrix}.$$ Let $A(\mathbf{x})$ be so, that for every possible $F(\mathbf{x})$ ($F:\mathbb{R}^n\to\mathbb{R}$): $$\begin{pmatrix} a_{11}(\mathbf{x})& \cdots& a_{1n}(\mathbf{x})\\ \vdots&\ddots&\vdots\\ a_{n1}(\mathbf{x})&\cdots& a_{nn}(\mathbf{x}) \end{pmatrix} \begin{pmatrix} \frac{\partial F}{\partial x_1}\\ \vdots\\ \frac{\partial F}{\partial x_n} \end{pmatrix} = \begin{pmatrix} g_1(\mathbf{x})\\ \vdots\\ g_n(\mathbf{x}) \end{pmatrix} = \begin{pmatrix} \frac{\partial G}{\partial x_1}\\ \vdots\\ \frac{\partial G}{\partial x_n} \end{pmatrix}$$ for some $G(\mathbf{x})$ ($G:\mathbb{R}^n\to\mathbb{R})$.

In other words, if we multiply fixed $A(\mathbf{x})$ by the gradient of every possible $F(\mathbf{x})$ we necessarily get the gradient of some $G(\mathbf{x})$.

Can we say anything about such $A(\mathbf{x})$? I would be glad if the only opportunity is that $A(\mathbf{x})=cE$, where $E$ is the identity matrix and $c$ is some real number. Is it correct? Is it possible to prove it?

All the functions are considered to be "good enough" ("smooth enough").

IDEA 1. $A(\mathbf{x})$ is an arbitrary constant matrix (?).

Counterexample. $$F(\mathbf{x})=x_1x_2;~A= \begin{pmatrix} 1&0\\ 0&2 \end{pmatrix}$$ $$\frac{\partial F}{\partial x_1}=x_2;~\frac{\partial F}{\partial x_2}=x_1$$ $$A \begin{pmatrix} \frac{\partial F}{\partial x_1}\\ \frac{\partial F}{\partial x_2} \end{pmatrix} = \begin{pmatrix} 1&0\\ 0&2\\ \end{pmatrix} \begin{pmatrix} x_2\\ x_1 \end{pmatrix} = \begin{pmatrix} x_2\\ 2x_1 \end{pmatrix} = \begin{pmatrix} g_1(\mathbf{x})\\ g_2(\mathbf{x}) \end{pmatrix};$$ $$\frac{\partial g_1}{\partial x_2}=1\neq2=\frac{\partial g_2}{\partial x_1}.$$

IDEA 2. Chain rule (?)

Counterexample. $$F(\mathbf{x})=x_1x_2;\\ \mathbf{y}(\mathbf{x}): x_1=y_1;~x_2=2y_2.\\ \begin{pmatrix} \frac{\partial x_1}{\partial y_1}&\frac{\partial x_2}{\partial y_1}\\ \frac{\partial x_1}{\partial y_2}&\frac{\partial x_2}{\partial y_2} \end{pmatrix} \begin{pmatrix} \frac{\partial F}{\partial x_1}\\ \frac{\partial F}{\partial x_2} \end{pmatrix} = \begin{pmatrix} 1&0\\ 0&2 \end{pmatrix} \begin{pmatrix} x_2\\ x_1 \end{pmatrix} = \begin{pmatrix} x_2\\ 2x_1 \end{pmatrix} = \begin{pmatrix} g_1(\mathbf{x})\\ g_2(\mathbf{x}) \end{pmatrix} = \begin{pmatrix} \frac{\partial F}{\partial y_1}\\ \frac{\partial F}{\partial y_2} \end{pmatrix};$$ $$\frac{\partial g_1}{\partial x_2}=1\neq2=\frac{\partial g_2}{\partial x_1}.$$ Of course, $$\frac{\partial^2F}{\partial y_1\partial y_2}=\frac{\partial^2F}{\partial y_2\partial y_1}$$ should be valid, but not $$\frac{\partial^2F}{\partial y_1\partial x_2}\neq\frac{\partial^2F}{\partial y_2\partial x_1}.$$ And, in fact, the latter one is required in the original post.

SOLUTION FOR n=2 @IgorKhavkine helped me a lot.

Proof for $n=2$. All functions below a considered to depend on $\mathbf{x}$.

$$\begin{pmatrix} a_{11}&a_{12}\\ a_{21}&a_{22} \end{pmatrix} \begin{pmatrix} \frac{\partial F}{\partial x_1}\\ \frac{\partial F}{\partial x_2} \end{pmatrix} = \begin{pmatrix} a_{11}\frac{\partial F}{\partial x_1}+a_{12}\frac{\partial F}{\partial x_2}\\ a_{21}\frac{\partial F}{\partial x_1}+a_{22}\frac{\partial F}{\partial x_2} \end{pmatrix} = \begin{pmatrix} g_1\\ g_2 \end{pmatrix}.$$ The condition $\frac{\partial g_1}{\partial x_2}=\frac{\partial g_2}{\partial x_1}$ may be written as: $$\frac{\partial}{\partial x_2}\left(a_{11}\frac{\partial F}{\partial x_1}+a_{12}\frac{\partial F}{\partial x_2}\right)=\frac{\partial}{\partial x_1}\left(a_{21}\frac{\partial F}{\partial x_1}+a_{22}\frac{\partial F}{\partial x_2}\right).$$ If we expand it, we get: $$\frac{\partial a_{11}}{\partial x_2}\frac{\partial F}{\partial x_1}+a_{11}\frac{\partial^2F}{\partial x_2\partial x_1}+\frac{\partial a_{12}}{\partial x_2}\frac{\partial F}{\partial x_2}+a_{12}\frac{\partial^2F}{\partial x_2^2}=\\ =\frac{\partial a_{21}}{\partial x_1}\frac{\partial F}{\partial x_1}+a_{21}\frac{\partial^2F}{\partial x_1^2}+\frac{\partial a_{22}}{\partial x_1}\frac{\partial F}{\partial x_2}+a_{22}\frac{\partial^2F}{\partial x_1\partial x_2}\tag 1$$ We may find $F(\mathbf{x})$ with arbitrary $\frac{\partial F}{\partial x_1}=\beta_1$, $\frac{\partial F}{\partial x_2}=\beta_2$, $\frac{\partial^2F}{\partial x_1^2}=\gamma_{11}$, $\frac{\partial^2F}{\partial x_2^2}=\gamma_{22}$ and $\frac{\partial^2 F}{\partial x_1 \partial x_2}=\frac{\partial^2 F}{\partial x_2 \partial x_1}=\gamma_{12}=\gamma_{21}$ at arbitrary $\mathbf{x}=\mathbf{X}$. $$F(\mathbf{x})=\beta_1(x_1-X_1)+\beta_2(x_2-X_2)+\\ +\frac{\gamma_{11}}{2}(x_1-X_1)^2+\gamma_{21}(x_1-X_1)(x_2-X_2)+\frac{\gamma_{22}}{2}(x_2-X_2)^2$$ is an example of such $F(\mathbf{x}$).

Since that we may independently equal the coefficients at each derivative of $F$ in $(1)$. Now we equal coefficients at second derivatives in $(1)$: $$\frac{\partial^2 F}{\partial x_1^2}: a_{21}=0;\\ \frac{\partial^2 F}{\partial x_2^2}: a_{12}=0;\\ \frac{\partial^2 F}{\partial x_1\partial x_2}: a_{11}=a_{22}.$$ So $A(\mathbf{x})=a(\mathbf{x})E$ (here $a:\mathbb{R}^n\to\mathbb{R}$).

$a_{22}(\mathbf{x})=a_{11}(\mathbf{x})=a(\mathbf{x})$; $a_{12}(\mathbf{x})=a_{21}(\mathbf{x})=0$.

If we equal coefficients at first derivatives in $(1)$: $$\frac{\partial F}{\partial x_1}: \frac{\partial a_{11}}{\partial x_2}=\frac{\partial a_{21}}{\partial x_1}\Rightarrow \frac{\partial a}{\partial x_2}=0\\ \frac{\partial F}{\partial x_2}: \frac{\partial a_{12}}{\partial x_2}=\frac{\partial a_{22}}{\partial x_1}\Rightarrow \frac{\partial a}{\partial x_1}=0$$ Thus $a(\mathbf{x})=\mathrm{const}=c$.

So we obtain $A(\mathbf{x})=cE$ and this is what I wanted to prove from the very beginning.

SHORT FINAL SOLUTION FOR ARBITRARY n>1

See below (courtesy of @IgorKhavkine and @RobertBryant)

• @AlexDegtyarev This is not obvious for me. Constant (non-identity) matrix will mix $\frac{\partial F}{\partial x_i}$ for different $i$. How can we be sure that the resulting $g_i(\mathbf{x})$ will satisfy $\frac{\partial g_i}{\partial x_j}=\frac{\partial g_j}{\partial x_i}$ conditions?
– rtmd
May 19, 2016 at 13:30
• @AlexDegtyarev Thank you for your ideas. I have tested them. But I still disagree :-) See the counterexamples in the original post. Sorry for being careless with contravariant and covariant components.
– rtmd
May 19, 2016 at 15:22
• Yes, you are right. First impression is misleading here :) I'm removing my comments. May 19, 2016 at 20:11
• @AlexDegtyarev I'll leave those two counterexamples there just as a useful illustration. Thank you for discussion.
– rtmd
May 19, 2016 at 20:32

## 1 Answer

The following considerations hold at least locally (in any sufficiently small open coordinate chart). A vector of functions $g_i$ is of the form $g_i = \partial_i G$ for some function $G$ iff $\partial_{[j} g_{i]} = 0$ (Poincaré lemma). A direct calculation gives $$\partial_{[k} g_{j]} = \partial_{[k} (a_{j]}^i \partial_i F) = (\partial_{[k} a_{j]}^i) \partial_i F + (a_{[j}^{(i} \delta_{k]}^{l)}) \partial_l \partial_i F .$$ Of course, I'm using the notation $A_{[ij]} = \frac{1}{2}(A_{ij} - A_{ji})$ and $A_{(ij)} = \frac{1}{2}(A_{ij} + A_{ji})$. At any point, we could always choose a function $F$ such that $\partial_i F$ and $\partial_l \partial_i F$ are independent and arbitrary. Hence, for your desired condition $\partial_{[k} g_{j]} = 0$ to hold at every point, the two coefficients $(\partial_{[k} a_{j]}^i)$ and $(a_{[j}^{(i} \delta_{k]}^{l)})$ must vanish everywhere. In fact, this is both a necessary and sufficient condition on the coefficient matrix $a^i_j$.

• In fact, you haven't answer my question about whether $A(\mathbf{x})=cE$ or not :-) Though you helped me greatly. I have lacked the idea that $\partial_i F$ and $\partial_l\partial_i F$ may be varied independently. Check out my proof in the original post if you wish. I'll accept your answer since it helped me.
– rtmd
May 19, 2016 at 19:43
• Looks reasonable for the $2\times 2$ case. May 19, 2016 at 20:11
• In fact, the condition that $$0 = a_{[j}^{(i} \delta_{k]}^{l)}= a^i_j\delta^l_k+a^l_j\delta^i_k-a^i_k\delta^l_j-a^l_k\delta^i_j$$ everywhere implies, after setting $i=j$ and summing, that $$0 = (a^i_i)\delta^l_k- na^l_k,$$ so that the matrix $a^i_j$ must be a multiple, say, $\lambda$ of the identity. Then the differential equation $0 = \partial_{[k}a^i_{j]}$ immediately implies that $\lambda$ is constant (provided $n>1$). May 20, 2016 at 11:07
• @rtmd: Yes, that argument to that show $\lambda$ is constant is exactly what I had in mind with the last sentence of my previous comment. May 21, 2016 at 21:55
• @rtmd, yes that's right. Because the symmetry of $\partial_i \partial_l F$, in any contraction $b^{il} \partial_i \partial_l F = b^{(il)} \partial_i \partial_l F$, obviously only the symmetric part contributes. May 22, 2016 at 0:42