Let $x\_i \in\mathbb{R}^d$ and $a\_i\in [0,1]$ for $i = 1,\dots,k$. How to compute the following derivative?


$$
\frac{d}{da\_j}\log \det\left(\sum\_{i = 1}^k a\_ix\_ix\_i^\top\right).
$$



Derivative of log determinant
\begin{align\*}
&\frac{d}{da\_j}\log \det\left(\sum\_{i = 1}^k a\_ix\_ix\_i^\top\right)
\\ 
&= \frac1{\det\left(\sum\_{i = 1}^k a\_ix\_ix\_i^\top\right)}\det\left(\sum\_{i = 1}^k a\_ix\_ix\_i^\top\right)\operatorname{Tr}\left(\left(\sum\_{i = 1}^k a\_ix\_ix\_i^\top\right)^{-1}x\_jx\_j^\top\right)
\\&=
\operatorname{Tr}\left(\left(\sum\_{i = 1}^k a\_ix\_ix\_i^\top\right)^{-1}x\_jx\_j^\top\right)
\end{align\*}
using $d \det(A)(X) = \operatorname{Tr}(\operatorname{adj}(A)X) = \det(A)\operatorname{Tr}(A^{-1}X)$.


