Sometimes real valued integrals are evaluated by viewing them as a contour integration in the complex plane.

For example, $$I = \int_{-\infty}^{\infty} \frac {dx}{(x^2 + 1)^2}$$

The question was asked here, Real integrals using Complex integration, but there was no attempt an answer.

The question is, why do we think that the contour we evaluate in the complex plane will give us the same answer as the original real integral?


  • $\begingroup$ Necessarily, any integral viewed in the complex plane will likely end up as a complex integral, so I'm not entirely sure what you're looking for. $\endgroup$ Jul 18, 2017 at 16:59
  • $\begingroup$ For example, why, (if this is true) must the contour integral in the complex plain encompass any singularities which show up there? $\endgroup$
    – jaslibra
    Jul 18, 2017 at 17:01
  • $\begingroup$ It is not necessarily the case that your integral should encompass singularities, but when it does, we're usually aiming for an application of the residue theorem. $\endgroup$ Jul 18, 2017 at 17:04

3 Answers 3


There are some basic approaches to choosing a good contour.

You should ask yourself is where the singularities are.

Then you should take a look at your integral domain.

Then look for symmetries (including $\sin(x)=\Im(e^{ix})$ or $f(ix)=\dots$)

Then, you need to check the asymptotes of your integrand as you approach complex infinities (such as $\lim_{x\to i\infty}e^{ix}=e^{i^2\infty}=e^{-\infty}=0$ or $\left|\frac x{(x^2+1)^2}\right|\ll\frac1{x^3}$)

For your example, one might note that:

$$x=\pm i\implies\frac1{(x^2+1)^2}=\frac10\implies\text{singularities}$$

Our integral domain is $(-\infty,\infty)$, so we'll want to check if a semicircle contour works.

In the case that we were integrating on $[0,\infty)$, you would want to note that

$$\int_{-\infty}^\infty\frac1{(x^2+1)^2}~\mathrm dx=2\int_0^\infty\frac1{(x^2+1)^2}~\mathrm dx$$

which follows from the symmetry step.

Assymptotically as $|z|\to\infty$, we can see that


Since this decays faster than $\mathcal O(z^{-1})$, we know that

$$\begin{align}\lim_{R\to\infty}\left|\int_{\{Re^{i\theta}:\theta\in[0,\pi]\}}\frac1{(z^2+1)^2}~\mathrm dz\right|&\le\lim_{R\to\infty}\int_{\{Re^{i\theta}:\theta\in[0,\pi]\}}\left|\frac1{(z^2+1)^2}\right|~\mathrm dz\\&\ll\lim_{R\to\infty}\int_{\{Re^{i\theta}:\theta\in[0,\pi]\}}\left|\frac1{z^3}\right|~\mathrm dz\\&\le\lim_{R\to\infty}\pi R\max_{z\in\{Re^{i\theta}:\theta\in[0,\pi]\}}|z^{-3}|\\&=\lim_{R\to\infty}\frac\pi{R^2}\\&=0\end{align}$$

Thus, we find nicely that

$$\int_{-\infty}^\infty\frac1{(x^2+1)^2}~\mathrm dx=\lim_{z\to\infty}\oint_{\gamma_R}\frac1{(z^2+1)^2}~\mathrm dz$$


And the rest requires the residue theorem.

Of course, not all integrals can be tackled using a semicircle contour. Some other contours you should keep in mind:

Keyhole contour

Rectangular contour

Wedge contour

Circle contour

Each having its own use depending on the integral at hand. For example, if a function has a branch cut along a certain line, try a keyhole contour with the keyhole centered at the branch point and the keyhole along the branch cut. If a keyhole contour doesn't look friendly because there are too many singularities inside it, a wedge contour may be more suited, chosen with an angle so that it only encompasses one singularity. If a function behave peculiarly nicely along $f(x+iy)$, you may be interested in the rectangular contour. A circular contour is especially useful for integrals of the form $\int_0^{2\pi}f(\sin(\theta))~\mathrm d\theta=\int_0^{2\pi}f(\cos(\theta))~\mathrm d\theta$.

  • $\begingroup$ Another contour that we see is $|z|=1$ when evaluating real integrals that involve trigonometric functions. You might consider adding a link that contour. And (+1) $\endgroup$
    – Mark Viola
    Jul 18, 2017 at 18:11
  • $\begingroup$ Yup, added in. $\ddot\smile$ $\endgroup$ Jul 18, 2017 at 18:44

In the simplest case, for $$ J = \int_{-\infty}^\infty f(x)\; dx$$ we take a contour that goes from $-R$ to $R$ on the real axis and then returns by a semicircle in either the upper or lower half plane. As $R \to \infty$, the limit (if it exists) of the integral from $-R$ to $R$ will be $J$. We want the integral over the semicircle to go to $0$: for example, it will do so if $f$ is a rational function where the degree of the denominator is greater than that of the numerator by at least $2$. Then the contour integral can be evaluated using the residue theorem, and its limit will be $J$.

  • $\begingroup$ What's the motivation for the semi-circle? $\endgroup$
    – jaslibra
    Jul 18, 2017 at 17:21
  • $\begingroup$ @jaslibra What are the reasons for using a semicircle in upper half plane of $\mathbb C$ $\endgroup$ Jul 18, 2017 at 17:23
  • $\begingroup$ @jaslibra the residue theorem needs a closed contour. The semi-circular shape of the top is chosen for convenience. $\endgroup$ Jul 18, 2017 at 17:26
  • $\begingroup$ Robert, I realize that this question is extremely open-ended, but enclosure by a semi-circle is not always best or even useful/applicable. As an example, in evaluating the Fresnel integrals $\int_{-\infty}^\infty \sin(x^2)\,dx$ and $\int_{-\infty}^\infty \cos(x^2)\,dx$, the enclosure is a "wedge." $\endgroup$
    – Mark Viola
    Jul 18, 2017 at 17:28
  • $\begingroup$ @MarkViola As I wrote, this is the "simplest case". There are several others. $\endgroup$ Jul 18, 2017 at 18:05

I think you can do it, if the Cauchy principal value of the integral is equal to the integral. The integral is equal to its Cauchy principal value if it converges.

So suppose you have an integral $$\int_{-\infty}^{\infty}f(x) dx.$$ If it converges you can say that $$ \int_{-\infty}^{\infty}f(x) dx=\lim_{a\rightarrow\infty}\int_{-a}^{a}f(x)dx. $$ Now you need to find a closed path $\gamma\subset\mathbb{C}$ that includes the interval $(-a,a)$. To clarify that $\gamma$ depends on $a$, I will denote it as $\gamma(a)$. Finally you can take advantage of complex integration and its beautiful theorems. Say you look at the closed path integral $$\oint_{\gamma(a)}f(z)dz.$$ Linearity of integration gives you $$\oint_{\gamma(a)}f(z)dz=\int_{\gamma'(a)}f(z)dz+\int_{-a}^af(x)dx.$$ Here $\gamma'=\gamma/(-a,a).$ Taking the $\lim_{a\rightarrow\infty}$ will give you the integral you are looking for on the right side. You have to make sure that the integral over $\gamma'(a)\rightarrow 0$ as $a\rightarrow\infty$. The closed path integral you can hopefully calculate with the residue theorem. To be a little more clear: Let $f$ be analytic in $G\subset \mathbb{C}$ except for some points $z_1,...z_n,...z_{p}\in G$. Let $\gamma\subset G$ be a simple closed path and positively oriented, then $$\oint_{\gamma(a)}f(z)dz=2\pi i \sum_{k=1}^n Res(f,z_k).$$ Where $n$ is the number of poles inside $\gamma(a)$ and $$Res(f,z_k)=\lim_{z\rightarrow z_k}\frac{1}{(m-1)!}\frac{d^{m-1}}{dz^{m-1}}\left((z-z_k)^m f(z)\right).$$ $m$ is the order of the pole of $f$ for the point $z_k$. Calculating all these residues will give you the closed path integral, which will be the same as the real integral.

  • $\begingroup$ thanks @ty. great answer. I'm just wondering, in general what happens when we construct our contour to avoid a pole or singularity? $\endgroup$
    – jaslibra
    Jul 20, 2017 at 1:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .