I would like to evaluate the following integral.
\begin{align} \int_0^\infty {\rm Tr}\left( {\bf A}^{-1} (x \,{\bf A}+{\bf I})^{-1} -\frac{1}{2+x} {\bf I} \right) dx \end{align} where ${\bf A} \in \mathbb{R}^{n \times n}$ is a real positive definte matrix and ${\bf I}\in \mathbb{R}^{n \times n}$ is an identity.
Unfortunately, my matrix calculus is very weak. So, any reference where I can look up this would also be great.
For the scalar case, the integral is equal to
\begin{align} \int_0^\infty \frac{\frac{1}{a}}{ax+1}-\frac{1}{2+x} dx=\log(2)-\log(a). \end{align}
Thanks.
Write $D = P AP^{-1}$ where $D = \operatorname{diag}(\lambda_1,\dots,\lambda_n)$ is diagonal with $\lambda_i > 0$. Then
$$ P (A(xA + I))^{-1} P^{-1} = (P A(xA + I) P^{-1})^{-1} = (x PA^2 P^{-1} + PAP^{-1})^{-1} = (xD^2 + D)^{-1}.$$
Using the invariance of trace under conjugation, we have
$$ \operatorname{Tr} \left( (A(xA + I))^{-1} - \frac{I}{2 + x} \right) = \operatorname{Tr} \left( P \left((A(xA + I))^{-1} - \frac{I}{2 + x} \right) P^{-1} \right) =\\ \operatorname{Tr} \left( (xD^2 + D)^{-1} - \frac{I}{2 + x} \right) = \sum_{i=1}^n \frac{1}{x \lambda_i^2 + \lambda_i} - \frac{1}{2 + x} = \sum_{i=1}^n \frac{x(1 - \lambda_i)^2 + 2 - \lambda_i}{(2 + x) \lambda_i(x\lambda_i + 1)}.$$
This is a rational function whose integral you can calculate explicitly.