matrix-by-matrix derivative in case of x^Tx

112 Views Asked by At

I've read somewhere on this forum that if we have three matrices $A,X,B$ that are $m\times n$, $n\times k$ and $k\times l$ respectively, that $$\frac{\partial (AXB)}{\partial X}=B^T \otimes A$$ Now if we apply this to product $x^Tx$ where $x=(x_1,x_2,\ldots,x_n)^T$ (so $x$ is $n\times 1$ matrix), we have that $$\frac{\partial (x^tx)}{\partial x}=E(1)^T\otimes x^T=x^T,$$ where $E(1)$ is the identity matrix of dimension 1.

But, $\frac{\partial (x^tx)}{\partial x}$ should be equal to $2x^T$? What is going on?