Let $p\in\mathbb{R}^d$ and $A\in \mathbb{R}^{d\times d}$, can the product $Ap$ be the derivative of some function?

In particular given a matrix $A$, how can I construct $H:\mathbb{R}^d\to \mathbb{R}$, such that $\nabla H(p)=Ap$. Note below I can do this for specific $A$ but I want it for general $A$ (say positive semi-definite, but possibly singular).

$\textbf{My Work :}$

  • If $A$ is the identity matrix then we have $\nabla H(p)=\nabla \frac{1}{2}\|p\|^2=p=Ap$.

  • If $A$ can be written as $B^TB$ for some matrix $B\in\mathbb{R}^{d\times d}$, then take $\nabla H(p)=\nabla \frac{1}{2}\|Bp\|^2=B^TBp=Ap$.

What about more general $A$?


If $A$ is symetric you can set $H(p) = \frac{1}{2}p^TAp $.

If you then calculate the derivative using the chain rule you get $\nabla H(p) = Ap$.

If $A$ is not symetric you can't find such a function $H$.

For example let $a_{12} \neq a_{21}$. You can write down the product of $Ap$ and start integrating the first element of the vector with respect to $p_1$:


$H(p) = \frac{1}{2}a_{11}p_1^2 + p_1a_{12}p_2 + p_1a_{13}p_3 +...$

Similarly when you integrate the second element with respect to $p_2$ you get:

$H(p) = p_1a_{21}p_2 + \frac{1}{2}a_{22}p_1^2 +...$

So we get a contradiction. You can do a similar argument for any non symetrical matrix.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.