Skip to content
Mathematical Methods

Solved residue theorem exercises: real integrals computed in the complex plane

Twelve exercises with solutions and graphs: simple and double poles, Fourier integrals, Jordan's lemma, trigonometric integrals, indentation, keyhole, sector, rectangle, summing a series, choosing the contour.

Exercises on the residue theorem applied to real integrals: one starts from an integral on the real line, moves to the complex plane, uses residues and returns to the real line with the result. They are of the kind set in Mathematical Methods courses, in three levels: basic, with rational functions and the semicircle; intermediate, with Jordan’s lemma, trigonometric integrals and the indented contour; exam, with the keyhole, the sector, the rectangle and the summation of a series. The result is given straight away; the full solution, with the graph of the integrand or the contour, opens with a click. The techniques are proved in the in-depth study linked at the top.

Basic level

Exercise 1. Two simple poles in the upper half-plane

Compute \displaystyle\int_{-\infty}^{\infty}\frac{x^2}{(x^2 + 1)(x^2 + 4)}dx.

Result: \frac{\pi}{3}.

Solution

The denominator has degree 2 more than the numerator: close with the upper semicircle. Poles in the upper half-plane: i and 2i.

\text{Res}_{z = i} = \frac{i^2}{2i(i^2 + 4)} = \frac{-1}{2i\cdot 3} = -\frac{1}{6i}; \text{Res}_{z = 2i} = \frac{(2i)^2}{((2i)^2 + 1)\cdot 4i} = \frac{-4}{-3\cdot 4i} = \frac{1}{3i}.

Sum \frac{1}{6i}; integral 2\pi i\cdot\frac{1}{6i} = \frac{\pi}{3}.

Check with partial fractions: \frac{x^2}{(x^2 + 1)(x^2 + 4)} = -\frac{1}{3}\cdot\frac{1}{x^2 + 1} + \frac{4}{3}\cdot\frac{1}{x^2 + 4}, with integrals -\frac{\pi}{3} + \frac{4}{3}\cdot\frac{\pi}{2} = \frac{\pi}{3}.

The integrand x squared over x squared plus 1 times x squared plus 4
The shaded area under the curve, which rises from zero and tends to zero at infinity like 1 over x squared, equals pi over 3.

Exercise 2. A double pole

Compute \displaystyle\int_{-\infty}^{\infty}\frac{dx}{(x^2 + 1)^2}.

Result: \frac{\pi}{2}.

Solution

At z = i there is a double pole: \frac{1}{(z^2 + 1)^2} = \frac{1}{(z - i)^2(z + i)^2}. The residue of a double pole is the derivative of the rest: \frac{d}{dz}(z + i)^{-2}\Big|_{z = i} = -2(2i)^{-3} = \frac{-2}{-8i} = \frac{1}{4i}.

Integral: 2\pi i\cdot\frac{1}{4i} = \frac{\pi}{2}.

With Calculus 1 one needs the substitution x = \tan t: \int\cos^2t\,dt between -\frac{\pi}{2} and \frac{\pi}{2}, which gives the same \frac{\pi}{2}.

The integrand 1 over x squared plus 1 squared
A bell narrower than that of 1 over 1 plus x squared: the area is pi over 2 instead of pi.

Exercise 3. An irreducible trinomial

Compute \displaystyle\int_{-\infty}^{\infty}\frac{dx}{x^2 + 2x + 2}.

Result: \pi.

Solution

Roots -1 \pm i; in the upper half-plane -1 + i, with residue \frac{1}{2(-1 + i) + 2} = \frac{1}{2i}. Integral: 2\pi i\cdot\frac{1}{2i} = \pi.

As expected: x^2 + 2x + 2 = (x + 1)^2 + 1, and a shift does not change the area of \frac{1}{1 + x^2}.

The integrand 1 over x squared plus 2 x plus 2
The bell is that of 1 over 1 plus x squared shifted by 1 to the left: same area, pi.

Intermediate level

Exercise 4. A Fourier integral

Compute \displaystyle\int_{-\infty}^{\infty}\frac{\cos 2x}{x^2 + 1}dx.

Result: \frac{\pi}{e^2} \approx 0.425.

Solution

Use f(z) = \frac{e^{2iz}}{z^2 + 1}, which is small in the upper half-plane (|e^{2iz}| = e^{-2y}). Residue at i: \frac{e^{2i\cdot i}}{2i} = \frac{e^{-2}}{2i}. Integral of f: 2\pi i\cdot\frac{e^{-2}}{2i} = \pi e^{-2}. The result is real, so it is the integral of the cosine.

Beware: with f = \frac{\cos 2z}{z^2 + 1} it would not work, because \cos 2z = \frac{e^{2iz} + e^{-2iz}}{2} grows exponentially in both directions of the imaginary axis and the arc does not tend to zero.

The integrand cosine of 2 x over x squared plus 1
The curve oscillates with decreasing amplitude; the positive and negative areas partly cancel and the total equals pi over e squared.

Exercise 5. When Jordan’s lemma is needed

Compute \displaystyle\int_{-\infty}^{\infty}\frac{x\sin x}{x^2 + 1}dx.

Result: \frac{\pi}{e} \approx 1.156.

Solution

With f(z) = \frac{z\,e^{iz}}{z^2 + 1}, its imaginary part on the real axis is the integrand. Here \frac{z}{z^2 + 1} decays only like \frac{1}{R}: the ML estimate would give \frac{1}{R}\cdot\pi R = \pi, which does not tend to zero. Jordan’s lemma is needed, with M_R \approx \frac{1}{R} \to 0: the arc tends to zero.

Residue at i: \frac{i\,e^{-1}}{2i} = \frac{1}{2e}. Integral of f: 2\pi i\cdot\frac{1}{2e} = \frac{\pi i}{e}. Imaginary part: \frac{\pi}{e}.

The integral converges only as an improper integral (the integrand decays like \frac{\sin x}{x}, not absolutely): exactly the case in which Jordan is indispensable.

The integrand x times sine of x over x squared plus 1
For large x the curve oscillates like sine of x over x, with positive and negative areas slowly cancelling; the total equals pi over e.

Exercise 6. A trigonometric integral

Compute \displaystyle\int_0^{2\pi}\frac{d\theta}{5 + 4\cos\theta} and, in general, \displaystyle\int_0^{2\pi}\frac{d\theta}{a + \cos\theta} for a \gt  1.

Result: \frac{2\pi}{3}; in general \frac{2\pi}{\sqrt{a^2 - 1}}.

Solution

With z = e^{i\theta}: \int\frac{1}{5 + 2(z + z^{-1})}\cdot\frac{dz}{iz} = \oint\frac{dz}{i(2z^2 + 5z + 2)}. Roots -\frac{1}{2} and -2: inside the circle only -\frac{1}{2}. Residue: \frac{1}{i(4z + 5)}\Big|_{z = -1/2} = \frac{1}{3i}. Integral: 2\pi i\cdot\frac{1}{3i} = \frac{2\pi}{3}.

In general, \frac{1}{a + \cos\theta} becomes \frac{2}{i(z^2 + 2az + 1)}, with roots -a \pm\sqrt{a^2 - 1}, inside only z_1 = -a + \sqrt{a^2 - 1}. Residue \frac{2}{i\cdot 2\sqrt{a^2 - 1}}, integral \frac{2\pi}{\sqrt{a^2 - 1}}. With a = \frac{5}{4} and the factor 4: \frac{1}{4}\cdot\frac{2\pi}{3/4} = \frac{2\pi}{3}, consistent. (The lesson has the example a = 2: \frac{2\pi}{\sqrt 3}.)

The integrand 1 over 5 plus 4 cosine of theta
Over one period the function has its maximum 1 at pi, where the cosine is minus 1, and its minimum one ninth at 0 and 2 pi; the area equals two thirds of pi.

Exercise 7. The squared sine integral

Compute \displaystyle\int_0^{\infty}\frac{\sin^2 x}{x^2}dx.

Result: \frac{\pi}{2}.

Solution

\sin^2 x = \frac{1 - \cos 2x}{2}, so the integral over the whole line is J = \int_{-\infty}^\infty\frac{1 - \cos 2x}{2x^2}dx, the real part of \int f with f(z) = \frac{1 - e^{2iz}}{2z^2}.

f has a simple pole at 0 (1 - e^{2iz} = -2iz + \dots, so f \approx \frac{-2iz}{2z^2} = \frac{-i}{z}), with residue -i. Indented contour (in-depth study): no poles inside, the large arc tends to zero (Jordan, with \frac{1}{2z^2} and \frac{e^{2iz}}{2z^2}), the small semicircle gives -i\pi\cdot(-i) = -\pi. So the integral on the real stretches tends to \pi, and J = \pi.

By symmetry \int_0^\infty\frac{\sin^2 x}{x^2}dx = \frac{\pi}{2}. The same result follows from Parseval’s theorem (Fourier transform exercises).

The integrand sine squared of x over x squared
The function is 1 at zero, always positive and has lower and lower lobes; the area over the whole line equals pi.
The indented contour
The small semicircle around the origin gives the contribution minus i pi times the residue.

Exam level

Exercise 8. The keyhole with a equal to one third

Compute \displaystyle\int_0^\infty\frac{dx}{x^{2/3}(1 + x)}.

Result: \frac{2\pi}{\sqrt 3} \approx 3.628.

Solution

It is the formula of the in-depth study \int_0^\infty\frac{x^{a-1}}{1 + x}dx = \frac{\pi}{\sin\pi a} with a - 1 = -\frac{2}{3}, i.e. a = \frac{1}{3}: \frac{\pi}{\sin(\pi/3)} = \frac{\pi}{\sqrt 3/2} = \frac{2\pi}{\sqrt 3}.

Redoing the computation: on the lower edge of the cut z^{-2/3} = e^{-4\pi i/3}x^{-2/3}; residue at -1 = e^{i\pi}: e^{-2\pi i/3}. So I(1 - e^{-4\pi i/3}) = 2\pi i\,e^{-2\pi i/3}, I = \frac{2\pi i}{e^{2\pi i/3} - e^{-2\pi i/3}} = \frac{2\pi i}{2i\sin(2\pi/3)} = \frac{\pi}{\sqrt 3/2}. ✓

The circles do not contribute because 0 \lt  a \lt  1: the integrand is integrable both near 0 (x^{-2/3}) and at infinity (x^{-5/3}).

The integrand x to the minus two thirds over 1 plus x
The function diverges at zero, but integrably, and decays like x to the minus five thirds; the area equals 2 pi over root 3.
The keyhole contour
The cut along the positive half-axis separates two determinations of the power, which differ by a phase factor.

Exercise 9. The sector for the fourth power

Compute \displaystyle\int_0^\infty\frac{dx}{1 + x^4} with a sector of opening \frac{\pi}{2}.

Result: \frac{\pi}{2\sqrt 2} \approx 1.111.

Solution

Rotating by \frac{\pi}{2}, z^4 does not change: on the ray z = ir we have z^4 = r^4 and dz = i\,dr, so that piece, traversed towards the origin, equals -iI. The arc tends to zero (ML). Inside the sector there is a single pole, p = e^{i\pi/4}, with residue \frac{1}{4p^3} = -\frac{p}{4}.

(1 - i)I = 2\pi i\cdot\left(-\frac{e^{i\pi/4}}{4}\right). With 1 - i = \sqrt 2\,e^{-i\pi/4} and i = e^{i\pi/2}: I = -\frac{\pi}{2\sqrt 2}e^{i\pi/2 + i\pi/4 + i\pi/4} = -\frac{\pi}{2\sqrt 2}e^{i\pi} = \frac{\pi}{2\sqrt 2}.

It is half of the integral over the whole line, \frac{\pi}{\sqrt 2}, computed in the in-depth study with the semicircle: two different contours, same result.

The integrand 1 over 1 plus x to the fourth on the positive half-line
The curve starts at 1 with a horizontal tangent and decays like 1 over x to the fourth; the area equals pi over 2 root 2.

Exercise 10. A modulated Gaussian

Compute \displaystyle\int_{-\infty}^{\infty}e^{-x^2}\cos 2x\,dx.

Result: \sqrt\pi\,e^{-1} \approx 0.652.

Solution

With the rectangle of the in-depth study and b = 2: the height is i\frac{b}{2} = i, and on the upper side e^{-(x + i)^2} = e^{-x^2}e^{1}e^{-2ix}. Cauchy’s theorem (no poles) and the vertical sides tending to zero give e\int e^{-x^2}e^{-2ix}dx = \sqrt\pi, i.e. \int e^{-x^2}\cos 2x\,dx = \sqrt\pi\,e^{-1} (the sine part vanishes by symmetry).

General formula: \sqrt\pi\,e^{-b^2/4}. With b = 0 one gets back the Gaussian integral \sqrt\pi.

The Gaussian modulated by a cosine
The curve e to the minus x squared times cosine of 2 x has a positive central lobe and two small negative lobes; the total area equals root pi over e.
The rectangle contour
Shifting the integration path upwards gives the Gaussian a phase factor that produces the cosine.

Exercise 11. Summing a series with the hyperbolic cotangent

Compute \displaystyle\sum_{n=-\infty}^{\infty}\frac{1}{n^2 + 1}.

Result: \pi\coth\pi \approx 3.153.

Solution

As in the in-depth study, use f(z) = \frac{\pi\cot\pi z}{z^2 + 1}: at every integer n it has residue \frac{1}{n^2 + 1}. The other poles are \pm i:

    \[ \text{Res}_{z = \pm i} = \frac{\pi\cot(\pm\pi i)}{\pm 2i} \]

With \cot(i\pi) = \frac{\cos i\pi}{\sin i\pi} = \frac{\cosh\pi}{i\sinh\pi} = -i\coth\pi and \cot odd: both residues equal \frac{\pi(-i\coth\pi)}{2i} = -\frac{\pi}{2}\coth\pi, in total -\pi\coth\pi.

On the square C_N the integral tends to 0, so the sum of all residues is 0: \sum_n\frac{1}{n^2 + 1} = \pi\coth\pi = 3.1533. Removing n = 0 and dividing by 2: \sum_{n \ge 1}\frac{1}{n^2 + 1} = \frac{\pi\coth\pi - 1}{2} = 1.0767.

The terms of the series
The dots are the values 1 over n squared plus 1 for integer n, under the dashed curve 1 over x squared plus 1; their sum equals pi times the hyperbolic cotangent of pi, slightly more than the area under the curve, which equals pi.
The square contour
Enlarging the square between the integers, the integral tends to zero and the residues cancel.

Exercise 12. Summary: which contour?

For each of the following integrals state the complex function and the contour to use, without computing them: (a) \int_{-\infty}^\infty\frac{dx}{x^6 + 1}; (b) \int_{-\infty}^\infty\frac{\sin 3x}{x(x^2 + 1)}dx; (c) \int_0^\infty\frac{\sqrt x}{x^2 + 1}dx; (d) \int_0^{2\pi}\frac{d\theta}{(2 + \sin\theta)^2}; (e) \int_0^\infty\frac{dx}{1 + x^5}.

Result: (a) semicircle; (b) \frac{e^{3iz}}{z(z^2 + 1)} with indentation and Jordan; (c) keyhole; (d) unit circle with z = e^{i\theta}; (e) sector of opening \frac{2\pi}{5}.

Solution

(a) Rational function with denominator 6 degrees higher: semicircle, poles e^{i\pi/6}, i, e^{5i\pi/6}. Result \frac{2\pi}{3}.

(b) Simple pole on the real axis (at 0) and slow decay: use \frac{e^{3iz}}{z(z^2 + 1)}, indented contour around 0, Jordan for the large arc, pole i inside. Result \pi(1 - e^{-3}).

(c) Non-integer power: cut along the positive half-axis, keyhole (or the formula for \frac{x^{a-1}}{1 + x^2}). Result \frac{\pi}{\sqrt 2}.

(d) Trigonometric integral over one period: z = e^{i\theta}, \sin\theta = \frac{z - z^{-1}}{2i}; it becomes a double pole inside the circle. Result \frac{4\pi}{3\sqrt 3}.

(e) z^5 is invariant under rotations by \frac{2\pi}{5}: a sector with that opening, a single pole e^{i\pi/5}. Result \frac{\pi/5}{\sin(\pi/5)} = 1.069.

Choosing the contour is half the exercise: it depends on where the poles are, on how the integrand decays and on the symmetries.

An example of a sector
When the integrand contains a power of z, a sector with the right opening maps the integral onto itself.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x