I am stuck at solving the following derivative
$$\frac{d \mbox{vec} (X^T X)}{d \mbox{vec} (X)}$$
where $X$ is an $m \times n$ matrix and $\mbox{vec}$ is the vector/stack operator. I have tried using $\mbox{vec}$ product identities, but I get stuck at some step eventually.
Thanks
$$\eqalign{ d{\rm vec}(X^TX) &= {\rm vec}(dX^T\,X) + {\rm vec}(X^T\,dX) \cr &= (X^T\otimes I)\,{\rm vec}(dX^T) + (I\otimes X^T)\,{\rm vec}(dX) \cr &= (X^T\otimes I)K\,{\rm vec}(dX) + (I\otimes X^T)\,{\rm vec}(dX) \cr &= ((X^T\otimes I)K + (I\otimes X^T))\,d{\rm vec}(X) \cr\cr \frac{\partial {\rm vec}(X^TX)}{\partial {\rm vec}(X)} &= (X^T\otimes I)K \,+\, (I\otimes X^T)\cr\cr }$$ The matrix $K$ is called the Commutation Matrix.