I've done that error so many times myself!
Your poles are outside the contour, because their magnitudes are both greater than pi, which is the radius of the semi-circle.
So, your integral from -pi to pi has become equal to the negative of the integral along the semicircle, since the total integral is, as you've mentioned, zero. So, now you have to compute the negative of the integral along the semicircle. How will you propose to do that?
I think you are making this way too hard and I think the value of your integral is incorrect.
Here is goes First as Olpeg noted is that
Now use the substitution
Note that
Now we sub all of this into the integral to get
Now there is only one pole in the interior of the unit circle
So now by the residue theorem we get
Thanks TheEmptySet. Could you justify the step ? I know that the line integral is worth .
I also don't understand well the method. Why did we choose a circle with radius 1? Why not say with radius 0.1 so that we enclose no pole and the integral is worth 0? I never understood the method of complex analysis to calculate real integrals.
I don't think we are really choosing a contour. Think of it this way. When you have a line integral with respect to z, to evaluate it you choose a contour (if you are not given one) and then do a substitution(say for a circular contour, it is [LaTeX ERROR: Convert failed] ).
However, in this problem you need to go the other way, since you are already given theta. In essence, the contour has already been chosen for you.
Reply to arbolis at post # 19:
Actually, part of what you wrote down is correct. What you're not seeing is that the integral in the middle of your equation is composed of two integrals, which, when summed, add up to an integral that's equal to zero. Let be defined as the segment on the real axis from to . Let be the semicircle path from to all in the upper half plane. Then what you've really got is this:
Now, your original integral is
Hence, from our equation above, we have that
So, in order to finish this problem, you must compute the contour integral on the RHS of this equation. Is this making more sense now?
Incidentally, I think this method of doing the problem is going to end up being about the same amount of work as the other methods described. As a matter of fact, you could use the same substitution Opalg recommended to perform this integral.