I want to know if the way I computed this integral is rigorous (and correct):
Compute: $$\oint_{\partial D(0,8)}\frac{1+\cos^2(z)}{z-\pi}dz$$
I'll be using the following corollary of the Cauchy formula/theorem:
The corollary: Consider $f:U\rightarrow\mathbb C$ a holomorphic function and $V\subset U$ such that $\bar V\subset U$ and $\partial V$ is a closed path boundary of a domain. Then $$\forall z\in V:f(z)=\frac{1}{2\pi i}\oint_{\partial V}\frac{f(\zeta)}{\zeta-z}d\zeta$$
My computation:
Consider $f=1+\cos^2(z):D(0,9)\rightarrow\mathbb C$ holomorphic (since it is entire, the restriction is also holomorphic). Now consider $D(0,8)$. One has that $D(0,8)\subset D(0,9)$ and $\operatorname{cl}D(0,8)\subset D(0,9)$, $\partial D(0,8)$ is the boundary of a domain and $\forall z\in D(0,8),\ Ind_z(\partial D(0,8))=1$. Moreover since $\pi \in D(0,8)$: $$2=1+\cos^2(\pi)=\frac{1}{2\pi i}\oint_{\partial D(0,8)}\frac{1+\cos^2(z)}{z-\pi}dz\iff\oint_{\partial D(0,8)}\frac{1+\cos^2(z)}{z-\pi}dz=(1+\cos^2(\pi))2\pi i=4\pi i$$
Thanks in advance.
$$\oint_{\partial D(0,8)}\frac{1+\cos^2(z)}{z-\pi}dz$$
Let $$f(z)=\frac{1+\cos^2(z)}{z-\pi}$$ the only pole of $f(z)$ in $D(0,8)$ is $\pi$ with order $1$ and the $Res(f,\pi)=(1+cos^2(\pi))=2. $
By Residue theorem we have $\oint_{\partial D(0,8)}\frac{1+\cos^2(z)}{z-\pi}dz=2\pi i(Res(f,\pi))=4\pi i$.
What you did it is correct, there is only to use Residue theorem to justify the last 2 equalities.