Cauchy Integral Formula for Matrices

Choose the contour $C$ so that $|z| > \|A\|$ for all $z$ in $C$. Then note that $(zI -A)^{-1} = \frac{1}{z}(I-\frac{A}{z})^{-1}$, and for $|z| > \|A\|$, we have $(zI -A)^{-1} = \frac{1}{z} \sum_{k=0}^\infty \frac{A^k}{z^k}$. Since $|z| > \|A\|$ for all $z$ in $C$, the convergence is uniform so we may interchange integration and summation.

Also note that $f$ is analytic on $C$ and the 'inside' of $C$.

This gives \begin{eqnarray} f(A)&=&\frac{1}{2\pi i}\int\limits_Cf(z)(zI-A)^{-1}dz \\ &=& \frac{1}{2\pi i}\int\limits_Cf(z) \frac{1}{z} \sum_{k=0}^\infty \frac{A^k}{z^k} dz \\ &=& \frac{1}{2\pi i} \sum_{k=0}^\infty \left(\int\limits_Cf(z) \frac{1}{z^{k+1}} dz \right) A^k \\ &=& \sum_{k=0}^\infty \left( \frac{1}{2\pi i}\int\limits_Cf(z) \frac{1}{z^{k+1}} dz \right) A^k \\ &=& \sum_{k=0}^\infty \frac{f^{(k)}(0)}{k!} A^k \end{eqnarray}

(The specific value doesn't matter, but it is easy to compute $\|A\|_1 = 24$, so as long as $|z|> 24$ on $C$, the above formula holds.)

It follows that if $f(x) = \sum_{k=0}^n a_k z^k$, then $f(A) = \sum_{k=0}^n a_k A^k$. Hence, in this case, $f(A) = 3 A^2 +I$. Evaluating shows that it equals the answer above.