TITLE: Complex integral $1/(z^2+1)$ along circle $|z|=2$
QUESTION [6 upvotes]: I want to compute the complex integral $$\int_{|z|=2}\frac{1}{z^2+1}dz$$
I write it as a partial fraction $\dfrac12i\int_{|z|=2}\dfrac{1}{z+i}dz-\dfrac12i\int_{|z|=2}\dfrac{1}{z-i}dz.$
Let $f(z)=1$. Then by Cauchy's formula, the first integral is $2\pi if(-i)=2\pi i$. Similarly, the second integral is $2\pi i$, so the whole thing is $0$.
Is this correct, and what would be other (quicker) ways to do it?

REPLY [3 votes]: Two quicker ways to do the same: 

Apply the residue theorem on the exterior domain $|z|>2$. The residue at $\infty$ is defined as $-c_{-1}$ where $c_{-1}$ is the coefficient of $z^{-1}$ in the Laurent expension about $\infty$. Since $zf(z)\to 0$ as $z\to\infty$, the residue is $0$. There are no poles in the exterior domain, either. 
Go from basic principles: the integral stays the same (Cauchy's theorem) if the contour of integration is changed to $|z|=R$, for any $R>1$. Since $f(z)=O(1/R^2)$ on this circle, the integral is $O(1/R)$. Being independent of $R$, it must be $0$.