# Improper integrals for complex functions

Whilst calculating improper integrals of functions (such as below) why do we always take the upper half circle as the contour in the evaluation of the integral?

So, for the following problem how would you know to take the contour to be the semicircle in the lower half plane? (i.e., $\Im(z)<0$) ?

Show that if $f(z)=P(z)/Q(z)$ is the quotient of two polynomials such that $\deg Q \leq 2+ \deg P$ where $Q$ has no real zeroes, then $$\text{PV} \int_{-\infty}^{\infty}f(x)\, dx = -2 \pi i \sum [ \,\text{Res}(f(z)\, \text{at poles in lower half plane}]$$

• It doesn't matter which one we use; we get the same answer no matter which half of the plane we integrate over, as long as you are careful with which direction you go along the semicircle. – Arthur Nov 28 '16 at 23:21
• how can that be ? because residue of f at z-z1 is not equal to rersidue of f at z=-z1 – kkr Nov 28 '16 at 23:46
• The sum of all residues at all poles is equal to $0$. An intuitive argument for this is that the integral along a very large circle will only see the dominating term in numerator and denominator, so $f$ will look like $\frac{z^m}{z^n}$ with $n\geq m+2$, and this integrates to $0$. – Arthur Nov 29 '16 at 0:44

It always depends on the function that you are integrating. If the integral is $$\int_{-\infty}^\infty \frac{p(x)}{q(x)} \, dx$$ where $p$ and $q$ are real polynomials (real coefficients) and the degree of $q$ is at least two more than $p$, which is the first standard application of residue theory, it does not matter which semicircle you take, although you will get minus signs in the lower one that will cancel out and you'll get the same answer. Since $p$ and $q$ are real, then the singularities are symmetric with respect to the real line and residues will come with a minus sign, so you'll get the same result, and the computation will in fact be almost identical.
The answer is the same even if $p$ and $q$ are not real, although the computation will be different. The main trick is that on the half circle of radius $r$, no matter if it is lower or upper semicircle, the function goes to zero like $\frac{1}{r^2}$, while the length of the semicircle grows like $r$ ($\pi r$ to be exact), so the integral will go to zero.
However an integral like $$\int_{-\infty}^{\infty} f(x) e^{ix} \, dx$$ where $f(x)$ is a proper rational function (degree of numerator smaller than denominator). This can be computed by the upper semicircle, but not using the lower semicircle. The problem is that the integral over the lower semicircle does not go to zero as the radius goes to infinity. Notice that if $z=x+iy$, then $|e^{iz}| = e^{-y}$. So when $y$ is very positive it makes the function small (the upper semicircle), and when $y$ is very negative it makes the function large (the lower semicircle).
The above integral comes up often in slightly different coordinates as computation of inverse Laplace. Then the integral formula is $$f(x) = \frac{1}{2\pi i} \int_{c-i\infty}^{c+i\infty} F(s) e^{-sx} \, ds$$ Which is (when $F$ is proper rational function) computed by a semicircle to the left of the line $\operatorname{Re} s = c$. Again using the other semicircle doesn't work in that case as the integral over that semicircle does not go to zero.