Let $X$ be a nonsingular square matrix.

What is

$$

frac{partial text{vec}X}{partialtext{vec}(XX’)},

$$

where the vec operator stacks all columns of a matrix in a single column vector?

It is easy to derive that

$$

frac{partialtext{vec}(XX’)}{partial text{vec}X} = (I + K)(X otimes I),

$$

where $K$ is the commutation matrix that is defined by

$$

text{vec}(X) = Ktext{vec}(X’).

$$

Now $(I + K)(X otimes I)$ is a singular matrix, so that the intuitive solution

$$

frac{partial text{vec}X}{partialtext{vec}(XX’)} = left( frac{partialtext{vec}(XX’)}{partial text{vec}X} right)^{-1}

$$

does not work.

Is the solution simply the Moore-Penrose inverse of $(I + K)(X otimes I)$, or is it more complicated?