I noticed that for scalars, Cauchy's integral formula
$$ \oint_{C}dz\frac{f(z)}{z-z_{0}}=2\pi if(z_{0}) $$
requires that $f(z)$ be analytic on and inside the contour $C$ (correct me if I'm wrong).
Now there seems to also be a similar relation that works for matrices, as seen at the top of p. 8 in Higham:
$$ \oint_{C}dzf(z)\left(zI-A\right)^{-1}=2\pi if(A). $$
However, this relation requires that $C$ does enclose all the eigenvalues of $A$. This is perplexing to me, because on one hand you do not want the singularities inside the contour, and on the other, you do. Why are the requirements for the scalar and matrix versions the total opposite of each other?
In both cases you have $$ \oint_C dz (zI -A)^{-1} = 2\pi i \; I$$ when the contour contains all eigenvalues of $A$. This follows e.g. by letting the contour go to infinity. On the other hand, if $f$ is entire then $$ \oint_C dz (f(z)-f(A))(zI -A)^{-1} = 0$$ because the integrand extends analytically. And the result follows. Now, if $f$ is only analytic on a neighborhood of the domain whose boundary is $C$ then you need a priori to define $f(A)$ first (in terms of evals and eigenprojections). A bit more complicated but the conclusion is the same.