# Complex Analysis - Contour Integral around $\frac{1}{\sin(z)}$

A function is given:

$$f(z)=\frac{1}{\sin(z)}$$

which has singular points along the real axis at $z=\pi n$ with integer $n$. The residue at $z=\pi n$ is equal to $(-1)^{n}$ as can be computed using an appropriate formula. Thus, the integral $I_n$ of a closed counterclockwise contour around any one of the $z=\pi n$ points should yield $2\pi i (-1)^{n}$ respectively.

Now, for instance we can integrate a closed contour in the following way:

$$I_n=\lim_{\epsilon \to 0}(A(\epsilon)+B(\epsilon)+C(\epsilon)+D(\epsilon))$$

where

$$A(\epsilon)=\int_{-\epsilon}^{\epsilon}\frac{1}{\sin(\pi n +x-i\epsilon)}dx \text{ }\text{ }\text{ }\text{ }\text{ }\text{ }\text{ , }\text{ }\text{ }\text{ }\text{ }\text{ }B(\epsilon)=\int_{-i\epsilon}^{i\epsilon}\frac{1}{\sin(\pi n +y+\epsilon)}dy$$

$$C(\epsilon)=\int_{\epsilon}^{-\epsilon}\frac{1}{\sin(\pi n +x+i\epsilon)}dx\text{ }\text{ }\text{ }\text{ }\text{ }\text{ }\text{ , }\text{ }\text{ }\text{ }\text{ }\text{ }D(\epsilon)=\int_{i\epsilon}^{-i\epsilon}\frac{1}{\sin(\pi n +y-\epsilon)}dy$$

These partial integrals can be done, since we know the primitive:

$$F(z)=\ln\left(\sin\left(\frac{z}{2}\right)\right)-\ln\left(\cos\left(\frac{z}{2}\right)\right)\text{ }\text{ }\text{ }\text{ }\text{ }\text{ }\text{ where }\text{ }\text{ }\text{ }\text{ }\text{ }F'(z)=f(z)$$

However, after A, B, C and D are integrated out, their sum adds to zero, in contradiction to the expected result of $2\pi i (-1)^{n}$. Apparently, the approach above contains some mistake? What would be a correct approach to obtain the right result but integrating an explicit contour?

-
The problem here is $F'(z)=f(z)$ does not hold on the entire contour but must fail at at least one point, and that's all it takes to kill the fundamental theorem of calculus. In fact, as you go around the contour, either ln(sin) or ln(cos) will go through an argument change of $2\pi$ and that accounts for the difference in the answers. – kiwi Sep 3 '12 at 19:21
If you're using the principal branch of $\ln$, the branch cuts in $F$ occur when $\sin(z/2)$ or $\cos(z/2)$ is a negative real. Thus your $F(z)$ has discontinuities along the real line except from $4n\pi$ to $(4n+1)$ for integers $n$. – Robert Israel Sep 3 '12 at 20:20