Residue of trace of resolvent I am looking for a way of computing the following integral. Let $A$ be some self-adjoint complex matrix. Let $f(z) = \text{tr} \left( z I - A \right)^{-1} $. Let $\gamma$ be a simple positively-oriented closed curve that goes around some $m$ poles of $f$. The integral is:
$$ J = \oint_{\gamma} f(z) dz $$
I want to show that $J= 2 \pi i m$ somehow by pure complex analysis means without resorting to the spectral theorem, diagonalization or even eigenvalue problem. It is not true in general for the residues of a rational function. 
 A: For a piecewise smooth curve, $\gamma$, defined on $[0,1]$, the following are justified because all of the matrices involved commute:
\begin{align}
  &\frac{d}{dt} \left((\gamma(t)I-A)\exp \left\{ -\int_{0}^{t}(\gamma(s)I-A)^{-1}\gamma'(s)ds\right\}\right) \\
   &= \gamma'(t)\exp \left\{ -\int_{0}^{t}(\gamma(s)I-A)^{-1}\gamma'(s)ds\right\} \\
   &-(\gamma(t)I-A)\exp\left\{-\int_{0}^{t}(\gamma(s)I-A)^{-1}\gamma'(s)ds\right\}
   (\gamma(t)I-A)^{-1}\gamma'(t) \\
  &= 0.
\end{align}
Therefore,
$$
      (\gamma(0)I-A)=(\gamma(1)I-A)\exp\left\{-\int_{0}^{1}(\gamma(s)I-A)^{-1}\gamma'(s)ds\right\}.
$$
Because $\gamma(0)=\gamma(1)$ and $(\gamma(t)I-A)$ is invertible for $0 \le t \le 1$,
$$
          I =\exp\left\{-\int_{\gamma}(zI-A)^{-1}dz\right\}.
$$
It is well known that $\det\{\exp(A)\}=\exp\{\mbox{tr}(A)\}$. Hence, there is an integer $N$ such that
$$
   1 = \det(I)=\exp\left\{-\mbox{tr}\int_{\gamma}(zI-A)^{-1}dz\right\} \\
    \implies \mbox{tr}\int_{\gamma}(zI-A)^{-1}dz = 2\pi i N \\
    \implies \mbox{tr}\frac{1}{2\pi i}\int_{\gamma}(zI-A)^{-1}dz = N.
$$
The Functional Calculus: If $X$ is a finite-dimensional complex normed vector space, and $A$ is a linear operator on $X$, then $(\lambda I-A)^{-1}$ exists for all $\lambda\notin\sigma(A)$ and $\lim_{\lambda}\lambda(\lambda I-A)^{-1}=I$. For this reason, if $C$ is a positively-oriented simple closed rectifiable path enclosing $\sigma(A)$ in its interior, then
$$
         \frac{1}{2\pi i}\oint_{C}(\lambda I-A)^{-1}d\lambda = I.
$$
This last contour integral may be written as a sum of contour integrals around each $\lambda_k \in \sigma(A)$ because each such $\lambda_k$ is an isolated singularity of $(\lambda I-A)^{-1}$ and there are no other singularities. That's complex analysis. The integral around $\lambda_k$, say $P_k$ can be shown to be a projection, i.e., $P_k^2=P_k$. Furthermore, $P_kP_l = P_lP_k = 0$ if $k\ne l$. No diagonalization is needed to prove this. And, because of the above,
$$
          I = P_1 + P_2 + \cdots + P_N
$$
If $X$ is an inner product space and $A$ is Hermitian, then $P_k$ is also Hermitian and you can directly show that
$$
          AP_k = \lambda_k P_k
$$
and you can show that $Ax=\lambda_k x$ iff $P_kx=x$, just from knowing the above properties. So the range of $P_k$ is the eigenspace associated with eigenvalue $\lambda_k$. No basis is required for these facts, and no diagonalization of anything is needed. If you integrate over a simple closed positively oriented contour $C$ in $\mathbb{C}\setminus\sigma(A)$, then complex analysis gives you
$$
          \frac{1}{2\pi i}\oint_{C}(\lambda I-A)^{-1}d\lambda = \sum_{\lambda_k \mbox{ inside } C}P_{\lambda_k}
$$
So far, nothing requires a basis or diagonalization. And, by the way, you get a nice uniform operator norm approximation by integrating over contours that are allowed to enclose multiple eigenvalues. That also can be proved without basis or trace, using projections. You also get the spectral theorem because
$$
                   I = P_{\lambda_1}+P_{\lambda_2}+\cdots+P_{\lambda_k} \\
              P_{\lambda_k}^2=P_{\lambda_k}=P_{\lambda_k}^* \\ P_{\lambda_k}P_{\lambda_J}=0,\;\;\; j\ne k \\
              A = \lambda_1 P_{\lambda_1}+\lambda_2 P_{\lambda_2}+\cdots+\lambda_k P_{\lambda_k}.
$$
If you want to discuss trace, and you're claiming that trace requires using basis, then that's a different issue from the above. Showing $\mbox{tr}(P_{\lambda_k})$ is the rank of the projection $P_{\lambda_k}$ is not needed in the above. If that cannot be shown, then that's not an issue of calculus. What you can now show is
$$
            \mbox{tr}\left(\frac{1}{2\pi i}\oint_C (\lambda I-A)^{-1}d\lambda\right) = \sum_{\lambda_k\mbox{ inside } C} \mbox{tr}(P_{\lambda_{k}})
$$
But if you can use properties of trace, then you know more. However, I cannot play a game to show something about trace when you won't allow me to use basic properties of trace!!! I'll leave it at the level projections, and let you decide if you can know the trace of a projection is an integer. 
