Computations of derivatives on traces and determinants

102 Views Asked by At

$\newcommand{\tr}{\operatorname{tr}}$I am looking for some indications on how to approach the following derivatives: $$\frac{\partial}{\partial \bf{W}} (\tr(\bf{Y}^T(\bf{WW^T}+\sigma^2 I)^{-1}\bf{Y}))$$

and $$\frac{\partial}{\partial \bf{W}} \log(|\bf{WW^T} + \sigma^2I|)$$

I have been using matrix cookbook

For the first one, using eq.59 from the above document i believe that i have the following

\begin{align} & \frac{\partial}{\partial \bf{W}} (\tr(\bf{Y}^T(\bf{WW^T}+\sigma^2 I)^{-1}\bf{Y})) \\[10pt] = {} & \bf{Y^T}(\bf{WW^T}+\sigma^2 I)^{-1}\frac{\partial (\bf{WW^T}+\sigma^2 I)}{\partial \bf{W}} (\bf{WW^T}+\sigma^2 I)^{-1} \bf{Y} \end{align}

Set $\Sigma = \bf{WW^T}+\sigma^2 I$

And obtain $2\bf{Y^T\Sigma^{-1}W\Sigma^{-1}Y}$, implying that $\bf{W}$ is symmetric thus $\frac{\partial \Sigma}{\partial W}=2\bf{W}$

For the second one, using eq.46, I obtain

$$\frac{1}{|\Sigma|}|\Sigma|\tr\left(\Sigma^{-1}\frac{\partial \Sigma}{\partial \bf{W}}\right) = \tr(\Sigma^{-1}\bf{W})$$

Are these computations correct?

1

There are 1 best solutions below

2
On

For convenience, define a new variable $$\eqalign{ M&=WW^T+\sigma^2I\cr dM&= d(WW^T)\cr &=(dW\,W^T+W\,dW^T)\cr &=2\operatorname{sym}(dW\,W^T)\cr }$$ Use this new variable and the Frobenius Inner Product to rewrite the first function, and find the differential and gradient $$\eqalign{ \tau&=Y:MY=YY^T:M\cr\cr d\tau&=YY^T:dM=YY^T:2\operatorname{sym}(dW\,W^T)\cr &=2\operatorname{sym}(YY^T):dW\,W^T\cr &=2YY^TW:dW\cr\cr \frac{\partial\tau}{\partial W}&=2YY^TW\cr &=2YY^T(WW^T+\sigma^2I)\cr\cr }$$ Now use the new variable in the second function $$\eqalign{ \lambda&=\log(\det(M))\cr\cr d\lambda&=d\log(\det(M))\cr&=d\operatorname{tr}(\log(M))\cr &=M^{-T}:dM\cr &=M^{-T}:2\operatorname{sym}(dW\,W^T)\cr &=2\operatorname{sym}(M^{-T}):dW\,W^T\cr &=2M^{-T}W:dW\cr\cr \frac{\partial\lambda}{\partial W}&=2M^{-T}W\cr &=2(WW^T+\sigma^2I)^{-1}W\cr\cr }$$