Poincaré lemma states that a vector $v_i(x)$ defined on a ball in $R^n$ is the gradient of a function if and only if 
\begin{equation}
 \partial_i v_j = \partial_j v_i
\end{equation}
or equivalently if $d(v)=0$, if $v$ is viewed as a one-form and $d$ is its exterior derivative.

The same thing happens for a matrix $V_i^k:B_1(0)\to R^N$. In this case, $V_i^k$ is a Jacobian matrix if and only if the previous condition holds for all of its columns separately.


My question is about a "quadratic version" of this lemma.

In particular, given a symmetric semi-positive matrix $A_{ij}(x)\in R^n\times R^n$ defined for $x\in B_1(0)\subset R^n$, which conditions must $A$ satisfy in such a way that there exists a function $u:B_1(0)\subset R^n \to R^M$ (for some $M$) such that
\begin{equation}
 A= \nabla u (\nabla u)^T \ \ \ \ \ \text{which means:} \ \ \ \ A_{ij}= \sum_{k=1}^M \partial_i u^k \partial_j u^k\, .
\end{equation}

Thanks