The title says it all. I'm trying to calculate $I(r) := \int_{C[-2i,r]}\frac{dz}{z^2+1}$ for $r\neq 1,3$, but I need some help. So we start by looking at three different cases, namely when $r<1$, $r\in (1,3)$ and $r>3$.
First off, the function $f(z) := \frac{1}{z^2+1}$ is holomorphic in $\mathbb{C}\setminus \{\pm i\}$. If we start by looking at the case when $r<1$, then clearly $C[-2i,r] \sim_{\mathbb{C}\setminus \{\pm i\}} 0$ (i.e. the circle $C[-2i,r]$ is contractible on $\mathbb{C}\setminus \{\pm i\}$), and thus Cauchys theorem gives us that $I(r) = 0$.
The other case when $r>3$ I reason as follows. Set $\gamma = C[-2i,r]$ for simpler notation. ($L$ is length of curve).
$\displaystyle |\int_{\gamma} \frac{dz}{z^2+1}| \leqq \sup_{z\in \gamma} |\frac{1}{z^2+1}|L = \max_{z\in\gamma}|\frac{1}{z^2 +1}| \cdot 2\pi r = \max_{z\in \gamma}|\frac{1}{|z|^2-1}| \cdot 2\pi r = \frac{2\pi r}{r^2-1} \longrightarrow 0$ as $ r\longrightarrow \infty$ and thus for arbitrary large $r$ the integral gets arbitrary close to zero, thus Cauchy's theorem gives $I(r) = 0$ when $r>3$ because of the circles $C[-2i,r]$ being all homotopic for $r>3$.
I get stuck when I try to evaluate $I(r)$ for $r \in (1,3)$. I have up to this point studied Cauchy's theorem (which I use above) and Cauchy's integral formula. So I guess that the problem can be solved using these methods.
Any ideas on what I can do? The answer to the exercise should simply be 0 (for all the cases I suppose). Any help is appreciated!
We have that $$ \frac{1}{z^2+1} = \frac{-i}{z-i} + \frac{i}{z+i}. $$ Then $$ \int_{\gamma} \frac{dz}{z^2+1} = -i\int_{\gamma} \frac{dz}{z-i} + i\int_{\gamma} \frac{dz}{z+i}. $$ If $r \in (1,3)$ then the integral of $\frac{-i}{z-i}$ is zero by Cauchy's theorem. Then $$ \int_{\gamma} \frac{dz}{z^2+1} = i\int_{\gamma} \frac{dz}{z+i} = i 2\pi i = -2\pi. $$ For $r>3$ we have $$ \int_{\gamma} \frac{dz}{z^2+1} = -i\int_{\gamma} \frac{dz}{z-i} + i\int_{\gamma} \frac{dz}{z+i} =-i 2\pi i + i 2\pi i = 0 $$ You can convince yourself using Cauchy's integral formula. $$ \int_{\gamma} \frac{dz}{z\pm i} = 2\pi i f(\pm i) $$ where $f\equiv 1$ is the constant function (and $\gamma$ is appropriate).