I am studying the convexity of a function with trace. It is described as follows:
$f(X)=tr(X^{-1})$ on $\boldsymbol{dom} ~f=\boldsymbol{S}_{++}^n$
Define $g(t)=f(Z+tV)$, where $Z\succ 0$ and $V \in \boldsymbol{S}^n$.
$g(t)= tr((Z+tV)^{-1}) \\ ~~~~~~= tr(Z^{-1}(I+tZ^{-1/2}VZ^{-1/2})^{-1}) \\ ~~~~~~= tr(Z^{-1}Q(I+t\Lambda)^{-1}Q^T) \\ ~~~~~~= tr(Q^TZ^{-1}Q(I+t\Lambda)^{-1})) \\ ~~~~~~= \sum_{i=1}^{n}(Q^TZ^{-1}Q)_{ii}(1+t\lambda_i)^{-1},$
where $Z^{-1/2}VZ^{-1/2}=Q\Lambda Q^T$ by eigenvalue decomposition.
In this derivation, I cannot understand why the last line $tr(Q^TZ^{-1}Q(I+t\Lambda)^{-1})) = \sum_{i=1}^{n}(Q^TZ^{-1}Q)_{ii}(1+t\lambda_i)^{-1}$ holds. For me, it looks like the result that the trace of a matrix is a sum of its eigenvalues.
Is $Q^TZ^{-1}Q$ a diagonal matrix? If it is true how can we show that it is true. If it is not, how come the last line hold?
I am stuck to this problem for days, your help will be much appreciated.
By the definition of the trace, and then using the fact that $I+t\Lambda$ is diagonal, we get \begin{equation}\begin{aligned} \text{tr}\left(Q^TZ^{-1}Q(I+t\Lambda)\right)&=\sum_{i=1}^n\sum_{j=1}^n\left(Q^TZ^{-1}Q\right)_{ij}\left(I+t\Lambda\right)_{ji}\\ &=\sum_{i=1}^n\sum_{j=1}^n\left(Q^TZ^{-1}Q\right)_{ij}\delta_{ji}\left(1+t\lambda_i\right)\\ &=\sum_{i=1}^n\left(Q^TZ^{-1}Q\right)_{ii}\left(1+t\lambda_i\right) \end{aligned}\end{equation}