# Matrix derivative of transpose

While I am able to see the differentiation of a matrix expression in the matrix cookbook of this form,

$$\frac{\partial \mathbf{b}^T \mathbf{X}^T\mathbf{X}\mathbf{c}}{\partial \mathbf{X}} = \mathbf{X} (\mathbf{b} \mathbf{c}^T + \mathbf{c} \mathbf{b}^T)$$

I am unable to figure out the derivative of the numerator's transpose from the cookbook i.e.

$$\frac{\partial \mathbf{c}^T \mathbf{X}\mathbf{X}^T \mathbf{b}}{\partial \mathbf{X}} = \ ?$$

• Note: $(b^TX^TXc)^T = c^T(b^TX^TX)^T = c^T(X^TX)^Tb = c^T(X^TX)b$ which is not the same as $bXX^Tc^T$ – EDZ Feb 22 '18 at 19:10
• The above can be seen because if $X$ is an $n x m$ matrix, $X^TX$ is an $m x m$ matrix whose transpose is $m x m$ and $XX^T$ is an $n x n$ matrix whose transpose is also an $n x n$ matrix. For an actual example, use: $X = \begin{bmatrix} 3 & 1 \\ -1 & 5\\ 4 & 2 \end{bmatrix}$ – EDZ Feb 22 '18 at 19:23
• If you consider column vectors $b$ and $c$, then $bXX^Tc^T$ is likely not well defined – user251257 Feb 22 '18 at 19:49

For $f(X) = b^T X X^T c$ we have $$Df(X)[H] = b^T H X^T c + b^T X H^T c = tr(X^T cb^T H) + tr(X^Tbc^TH) .$$ So we have $$\frac{\partial f(X)}{\partial X} = (bc^T + cb^T) X .$$