Let $A$ and $B$ be two real $n\times n$ matrices, and let $C(x)=B(I-xB)^{-1}$, where $I$ is the identity matrix of order $n$, for any real scalar $x$ such that $I-xB$ is invertible. Denote by $\mathrm{tr}$ the trace operator.
Is it possible to get a closed form solution for
$$\int{\mathrm{tr}}\left( {AC(x)}\right) {\,dx},$$
at least when $B$ is diagonalizable?
What I've done so far:
Assuming $B$ is diagonalizable, $C$ is too, and hence it admits the spectral decomposition
$$ C(x)=\sum_{\lambda\in\mathrm{Sp}(B)}\frac{\lambda}{1-x\lambda}Q_{\lambda}, $$
where $\mathrm{Sp}(B)$ denotes the set of distinct eigenvalues of $B$, and $Q_{\lambda}$ is the projector onto $\mathrm{null}(B-\lambda I)$ along $\mathrm{col}(B-\lambda I)$ ($\mathrm{null}$ and $\mathrm{col}$ stand for the null and the column spaces). Hence
$$ \int{\mathrm{tr}}\left( {AC(x)}\right) {\,dx}=\sum_{\lambda\in \mathrm{Sp}(B)}\mathrm{tr}(AQ_{\lambda})\int\frac{\lambda}{1-x\lambda}\,dx $$
If all the eigenvalues of $B$ are real we obtain
$$ \int{\mathrm{tr}}\left( {AC(x)}\right) {\,dx}=\sum_{\lambda\in \mathrm{Sp}(B)}\mathrm{tr}(AQ_{\lambda})\int\frac{\lambda}{1-x\lambda }\,dx=\sum_{\lambda\in\mathrm{Sp}(B)}\mathrm{ln}(\left\vert 1-x\lambda \right\vert )\mathrm{tr}(AQ_{\lambda}) $$
But what about the case in which not all eigenvalues of $B$ are real? Do we get any simplification from the fact that the eigenvalues of real matrices come in complex conjugate pairs, and the eigenvectors (and hence the projectors $Q_{\lambda}$) associated to complex conjugate eigenvalues are complex conjugates? Can we still use the formula in the last display above for $\int{\mathrm{tr}}\left( {AC(x)}\right) {\,dx}$?
Let $f:x\in I\subset \mathbb{R}\rightarrow -tr(A\log(I-xB)),g(x)=\log(I-xB)$. We assume that $\log(.)$ is the principal log.; thus we assume that, for every eigenvalue $\lambda$ of $B$ and $x\in I$, $1-x\lambda\notin (-\infty,0]$.
When $x$ is small, $g(x)=-xB-(xB)^2/2-(xB)^3/3-\cdots$ and $g'(x)=-B(I+xB+(xB)^2+(xB)^3+\cdots)=-B(I-xB)^{-1}$. By extending the equalities between holomorphic functions, $g'(x)=-B(I-xB)^{-1}$ is valid for any $x\in I$.
Now $f'(x)=-tr(Ag'(x))=tr(AB(I-xB)^{-1})$ and we are done.
EDIT. Answer to mark. 1. $g'(x)$ and $-B(I-xB)^{-1}$ are analytic functions; there are equal in a neighborhood of $0$; then they are equal on whole domain of definition -if it is connected-.