I am trying to compute equation $(5.23)$ from here where I replaced the variable $\hat{f}$ by $x$ for ease of notation.
By definition $B(x) := I + W(x)^{1/2}KW(x)^{1/2}$ with $K$ and $W$ symmetric matrices. I would like to show that $$(log |B|)'(x)=tr\left[((K^{-1}+W(x))^{-1}W'(x)\right]$$ where $|\cdot|$ is the determinant of a matrix.
I know that $ (log(B(x)))' = tr(B(x)^{-1}B'(x) $ and using the product rule I can get $$B'(x)=\frac{1}{2}W(x)^{-1/2}W'(x)KW(x)^{1/2}+W(x)^{1/2}K\frac{1}{2}W(x)^{-1/2}W'(x).$$ Now if I can show that the term $B^{-1}=(K^{-1}+W(x))^{-1}$ (is it true though and how to prove it?) I could use that inside the trace, if every matrix is symmetric we can permute them anyway we like and I would have $(log |B|)'(x) = tr\left[K^{-1}+W(x))^{-1}KW'(x)\right]$ and I would have a $K$ too much. I appreciate your help.