The integral of $\int_\gamma\frac{1}{z^2+1}dz$ over the semicircle If $\gamma$ is the part of the circle of radius $R$ in the upper half plane of $\mathbb{C}$, I would like to calculate
$$\int_\gamma\frac{1}{z^2+1}dz.$$
Can anybody help me?
I tried to used the parameter representation $R e^{i t}$, but then I got
$$\int_0^\pi\frac{R e^{i t}}{R^2 e^{i 2 t}+1}d t,$$
which is not very useful either. 
 A: Hint. Let $z=Re^{it}$ for $t\in [0,\pi]$ (with $R>0$ and $R\not=1$) and note that $(\arctan z)'=1/(1+z^2)$.
Hence
$$\int_\gamma\frac{1}{z^2+1}dz=\int_0^\pi\frac{iR e^{i t}}{R^2 e^{i 2 t}+1}d t=[\arctan(Re^{it})]_0^{\pi}=?$$
P.S. As pointed out by Daniel Fischer, be careful 
to choose the right branch of the complex function $\arctan(z)$ whether $0<R<1$ or $R>1$. What follows explains the difference between the two cases in an alternative way (we use the Residue Theorem).
If $0<R<1$ then the closed path $\gamma\cup [-R,R]$ does not contain any pole and 
$$\int_\gamma\frac{1}{z^2+1}dz=-\int_{-R}^R\frac{1}{x^2+1}dx=-2\arctan(R).$$
If $R>1$ then the closed path $\gamma\cup [-R,R]$ contains the pole $i$, and
$$\int_\gamma\frac{1}{z^2+1}dz=-\int_{-R}^R\frac{1}{x^2+1}dx
+2\pi i \mbox{Res}\left(\frac{1}{z^2+1},i\right)=-2\arctan(R)+\pi.$$
In both cases $\arctan$ denotes the usual real function.
A: Use your idea:
$$z=Re^{it}\;,\;\;0\le t\le \pi\implies dz=Rie^{it}\implies$$
$$\int_\gamma\frac{dz}{1+z^2}=\int_0^\pi\frac{Rie^{it}}{1+R^2e^{2it}}=\left.\int_0^\pi\frac{d(Re^{it})}{1+(Re^{it})^2}=\arctan Re^{it}\right|_0^\pi=$$
$$=\arctan(-R)-\arctan R=-2\arctan R$$
You may want this for some real integral by means of complex integration: you can see now that
$$\lim_{r\to\infty}-2\arctan R=-\pi$$
