# How to choose a proper contour for a contour integral?

When analyzing real integrals with contour integrals, how does one choose a proper contour integral?

Many cases can be solved by integrating around the top half of a circle with radius of infinity and then integrating along the entire real line.

I understand how when integrating one would avoid the branch cuts, but how would one know to use a rectangle or a quarter of a circle as a contour?

-
why this question has not received enough attention. its the same thing which I need to know more about it – mhd.math Sep 11 '13 at 1:04
The only guidance I've seen is that it is an art form... Doing/checking many examples helps. – vonbrand Apr 21 '14 at 4:40

In response to the comment, I will do my best to attempt to explain how I choose contours for integration.

I first look at the bounds of integration. If it is over $[0, \infty)$ and even, make it over $(-\infty,\infty)$.

Next, I look at how the function behaves around infinity in the top half of the plane. If it decreases fast enough (e.g. $\frac{\exp(ix)}{x^2+1}$), we can integrate with a semicircle contour. If not, find a value $a$ such that when you integrate a rectangle with vertices at $-R, R, R+ia, -R+ia$ (as $R\to\infty$), the vertical sides disappear and the horizontal integrals are equal when multiplied by a constant.

If the function cannot be made even, there is still some hope left to contour integrate. If the function has a branch cut (e.g. $\frac{\sqrt x}{x^2+1}$), try a keyhole contour if the function decays fast enough around $\infty$. Otherwise, try a rectangle.

Other contours exist and can be used (e.g. the trapezoid contour for integrating the gaussian integral), though I've found the above contours work for most standard integrals.

If the contour travels through a pole, indent it with a semicircle - with a simple pole, $z_0$, the contributed value from that integral equals $i\theta\operatorname*{Res}f_{z=z_0}$ where $\theta$ equals the angle traversed around the pole.

It is often convenient to change $\sin$ or $\cos$ in the numerator to $e^{ix}$ (which is better behaived for integration around the top half of the plane) and take the real or imaginary part after integration - this can even be done if the other part diverges.

-
$+1^{\infty}$ ^_^ .added (the experience ) – mhd.math Sep 11 '13 at 21:50