Suppose we are given a vector in $\mathbb{R}^2$, which is $[f(x_1, x_2), g(x_1, x_2)]^T$. We want to know that if this vector is the gradient of any smooth function $H(x_1, x_2)$ i.e. a conservative vector field. Then we know that if second derivatives commute, i.e. $$ \frac{\partial f}{\partial x_2} = \frac{\partial g}{\partial x_1} \quad \textrm{or in other words } \frac{\partial^2 H}{\partial x_1 \partial x_2} = \frac{\partial^2 H}{\partial x_2 \partial x_1} $$ the vector $[f(x_1, x_2), g(x_1, x_2)]^T$ is $\textbf{actually}$ the gradient of a function.
My question is, can we generalize to Hessian matrices? Suppose now we are given a matrix $$ M = \begin{bmatrix} a(x_1, x_2) & b(x_1, x_2)\\ c(x_1, x_2) & d(x_1, x_2) \end{bmatrix} $$ instead of a vector. We want to know if this matrix is the hessian of any smooth function $H(x_1, x_2)$. Can we say that if the third derivatives commute i.e.: $$ \frac{\partial a}{\partial x_2} = \frac{\partial c}{\partial x_1} = \frac{\partial b}{\partial x_1} \quad \textrm{or in other words } \frac{\partial^3 H}{\partial x_1 \partial x_1 \partial x_2} = \frac{\partial^3 H}{\partial x_2 \partial x_1 \partial x_1} = \frac{\partial^3 H}{\partial x_1 \partial x_2 \partial x_1} \\ \frac{\partial b}{\partial x_2} = \frac{\partial d}{\partial x_1} = \frac{\partial c}{\partial x_2} \quad \textrm{or in other words } \frac{\partial^3 H}{\partial x_1 \partial x_2 \partial x_2} = \frac{\partial^3 H}{\partial x_2 \partial x_2 \partial x_1} = \frac{\partial^3 H}{\partial x_2 \partial x_1 \partial x_2} $$ the matrix $M$ is $\textbf{actually}$ the Hessian of a function.
If yes, can you point me some references?