# 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
• @mhd.math It's the second thing that shows up on Google when I search "semicircle contour". I think it's getting plenty of attention ;) – Simply Beautiful Art Mar 1 '17 at 1:43
• @SimplyBeautifulArt ^_^ thank you – mhd.math Mar 6 '17 at 8:38

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.

If the integrand can be simplified as $f(x+ia) = g(x)$, where the integral of $g$ is known or is in the form $A f(x)$, it may be able to be exploited using a rectangular contour. For example, a rectangular contour of infinite width and height $a$ along the real line along with the knowledge that $\int_{-\infty}^\infty e^{-x^2}\, dx =\sqrt{\pi}$ can easily demonstrate that $\int_{-\infty}^\infty e^{-(x+a)^2}\, dx =\sqrt{\pi}$.

Wedge contours can be used in situations like the rectangular contours can, but instead of having $f(x+ia)$ being well-behaved, we have $f(e^{i\theta}x)$ being well behaved. For example, taking again $f(x) = e^{-x^2}$, we see that $f(xe^{i\pi/4}) = e^{-ix^2}$. Thus, taking a wedge contour with $\theta=\pi/4$ we can deduce from the integral $\int_{0}^\infty e^{-x^2}\, dx =\sqrt{\pi}/2$ that $\int_{0}^\infty \sin(x^2)\, dx =\int_{0}^\infty \cos(x^2)\, dx =\sqrt{\pi/2}/2$.

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.

When dealing with exponents, use trigonometric identities to reduce the function into an exponential that decays. For example, it is easier to deal with $\Re \left[\frac{1-e^{2ix}}{2}\right] = \sin^2(x)$ instead of just $\sin^2(x)$.

• $+1^{\infty}$ ^_^ .added (the experience ) – mhd.math Sep 11 '13 at 21:50
• Any more additions to this list, since it's been a long time this was last active? – Arkya Chatterjee Sep 2 '16 at 19:05
• @ArkyaChatterjee I added a few more. If I think of more tricks, I will add them. – Argon Sep 4 '16 at 0:35
• @Argon thanks a lot! – Arkya Chatterjee Sep 4 '16 at 3:50
• Wow, the trick to take the real/imaginary part of the result, even when it diverges, is new to me. :D – Simply Beautiful Art Mar 1 '17 at 1:50