Lecture 22: applications of the residue theorem

Complex analysis, lecture 2
(April 15, 2026)

Today we continue with applications of the residue theorem to real integrals. Last time, we saw how to use it to compute integrals of rational functions over the real line, with the example of

∫−∞∞1x2+1⁢𝑑x=π.

To start with today, let’s complicated this integral a little bit: what about something like

∫−∞∞cos⁡xx2+1⁢𝑑x⁢?

This is no longer amenable to calculus techniques: cos⁡xx2+1 does not have an elementary antiderivative. We can try the residue method from last time: let D be the upper half-disk of radius N, with boundary consisting of the interval [−N,N] and the arc γ from N to −N, of radius N. Then

∫∂Dcos⁡zz2+1⁢𝑑z=∫−NNcos⁡xx2+1⁢𝑑x+∫γcos⁡zz2+1⁢𝑑z.

We can evaluate the integral on the left via the residue theorem; the first integral on the right is the one we want to find, and then we can try to bound the second integral by the ML bound. Here however we encounter a problem: it is not clear that cos⁡z should have a reasonable bound for z∈γ. Indeed, for example at z=N⁢i, which is on γ, we have

cos⁡z=12⁢(ei⁢z+e−i⁢z)=12⁢(e−N+eN),

which for N large becomes extremely large, much larger than the denominator of order N2!

However, there is a trick we can use. For x real, cos⁡x is the real part of ei⁢x. Therefore if we could compute the integral

∫−∞∞ei⁢xx2+1⁢𝑑x,

then we could determine our desired integral by taking the real part.

This is more amenable to our approach above because ei⁢z is actually nicely bounded on D: for z=x+i⁢y∈D∪∂D, we must have y≥0, so ei⁢z=ei⁢x−y=e−y⁢ei⁢x has absolute value e−y≤1. Therefore, since for z on γ we have |z|=N and so |1z2+1|≤1N2 and γ has length π⁢N, by the ML bound we find

|∫γei⁢zz2+1⁢𝑑z|≤π⁢N⋅1N2=πN,

so this integral vanishes as N→∞. Therefore to compute our integral it suffices to evaluate

∫∂Dei⁢zz2+1⁢𝑑z.

Since ei⁢z is entire and nonzero, the only singularity of ei⁢zz2+1 in D is at z=i, where it has residue ei⁢z2⁢z|z=i=12⁢e⁢i. Therefore by the residue theorem the integral is

2⁢π⁢i2⁢e⁢i=πe.

Since this is real, taking the real part gives πe again and so we conclude that

∫−∞∞cos⁡xx2+1⁢𝑑x=πe.

For another example, let’s try to compute an integral only along the positive real axis:

∫0∞xx4+1⁢𝑑x=limN→∞∫0Nxx4+1⁢𝑑x.

To apply the residue theorem, we need to connect N back to 0; let’s do so via a quarter-circle, so we now have three components to the path: the line ℓ0 from 0 to N, the quarter-circle arc γ of radius N from N to i⁢N, and the line ℓ1 from i⁢N back to 0. These together form the boundary of a region D, giving

∫∂Dzz4+1⁢𝑑z=∫ℓ0zz4+1⁢𝑑z+∫γzz4+1⁢𝑑z+∫ℓ1zz4+1⁢𝑑z.

We can compute the left-hand side via the residue formula. The singularities of zz4+1 are at z4=−1, namely at z=eπ⁢i4⁢(2⁢k+1) for integers k; the only one of these which is inside our region D is eπ⁢i/4=12⁢(1+i). The residue at a point z is z+14⁢z3, so at z=eπ⁢i/4 this is

eπ⁢i/44⁢e3⁢π⁢i/4=14⁢i.

Therefore the integral is 2⁢π⁢i⋅14⁢i=π2.

On the other side, the integral of γ will go to zero by the usual ML bound argument: the arc has length π⁢N2, while the absolute value of the integrand is bounded by NN3−1∼1N2, so the product goes to 0. The integral over ℓ0 is what we want to compute; what we’re left with is the integral over ℓ1.

Let’s parametrize. Since ℓ1 is the straight line from i⁢N to 0, we could set z=i⁢t and have t go from N to 0, or multiply by −1 to flip the endpoints. Thus, since d⁢z=i⁢d⁢t,

∫ℓ1zz4+1⁢𝑑z=−i⁢∫0Ni⁢t(i⁢t)4+1⁢𝑑t=∫0Ntt4+1⁢𝑑t.

But this is exactly the original integral we wanted to compute: that is,

∫ℓ1zz4+1⁢𝑑z=∫ℓ0zz4+1⁢𝑑z=∫0Nxx4+1⁢𝑑x!

Therefore our equation above becomes, in the limit as N→∞,

π2=2⁢∫0Nxx4+1⁢𝑑x,

so the integral is π4.

A different kind of example is for the integration of trigonometric functions. If θ ranges from 0 to 2⁢π (or −π to π, or any other interval of length 2⁢π, then the usual mapping θ↦z=ei⁢θ lets us translated between integrals over θ and integrals around the unit circle. We have often used this method to turn complex line integrals into usual one-variable integrals over θ. Now though we have very powerful tools to evaluate complex line integrals, and we would rather go the other way to use these tools to evaluate real integrals.

The reason this is especially useful for trigonometric functions is that we can naturally write cos⁡θ and sin⁡θ in terms of z: we have z=ei⁢θ=cos⁡θ+i⁢sin⁡θ, and since |z|=1 we also have 1z=e−i⁢θ=cos⁡θ−i⁢sin⁡θ=z¯, so

cos⁡θ=Re⁡(z)=12⁢(z+1/z),sin⁡θ=Im⁡(z)=12⁢i⁢(z−1/z).

Let’s work out an example. Fix a real number a>1, and consider

∫02⁢π1a+cos⁡θ⁢𝑑θ.

Writing z=ei⁢θ, we have d⁢z=i⁢ei⁢θ⁢d⁢θ=i⁢z⁢d⁢θ, so d⁢θ=1i⁢z⁢d⁢z. Combining this with the above, we see that this integral is the same thing as

∫|z|=11a+12⁢(z+1/z)⋅1i⁢z⁢𝑑z=−2⁢i⁢∫|z|=111+2⁢a⁢z+z2⁢𝑑z.

The integrand is a rational function, with poles at the zeros of 1+2⁢a⁢z+z2; by the quadratic formula, these are at z=−a±a2−1. Since a>1, we have a2−1 a positive real number, and −a−a2−1<−1 so it is not contained in the unit circle; however a−1<a2−1<a since a>1, so −1<−a+a2−1<0 and so −a+a2−1 is contained in the unit circle, and the integrand has a simple pole there, with residue

12⁢z+2⁢a|z=−a+a2−1=12⁢a2−1.

Therefore by the residue theorem this is

−2⁢i⋅2⁢π⁢i⋅12⁢a2−1=2⁢πa2−1.

We could consider both sides of the equation

∫02⁢π1a+cos⁡θ⁢𝑑θ=2⁢πa2−1

as a function of the variable a. Above, we have shown that the two sides are equal for a∈(1,∞). If we wanted to take a a complex number, we need to specify a branch of the square root on the right: we take the principal branch. Recall that the function z2−1 can be defined on ℂ∖[−1,1], taking the branch cut from −1 to 1 along the real axis; away from this branch cut, it is continuous, and in fact analytic. This might lead us to guess that the equation above holds for a∈ℂ∖[−1,1]. (If a∈[−1,1], then both sides are ill-defined: on the right because of the branch cut, and on the left because then there exists θ∈[0,2⁢π] with a+cos⁡θ=0.)

Indeed, both sides define an analytic function of a on ℂ∖[−1,1], after fixing the branch on the right as above; and we showed above that these functions agree on (1,∞), a subset containing non-isolated points. Hence they must be equal everywhere on ℂ∖[−1,1].

This brings us to the more general question of applying the residue theorem to functions with branch cuts. As above, one can do this, but we need to be careful not to cross the branch cuts, and to keep track of our branches.

Let −1<a<1 be a real number, and consider the function

f⁢(z)=za(1+z)2.

For nonnegative real numbers z, there is a unique branch of f with positive real values, so we can define the integral

∫0∞xa(1+x)2⁢𝑑x.

To use the residue theorem, though, we will need to specify a branch of f. We take the branch cut along the positive real line, and define f on ℂ∖[0,∞) by

f⁢(r⁢ei⁢θ)=ra⁢ei⁢a⁢θ(1+r⁢ei⁢θ)2

for 0<θ<2⁢π. Note that this has phase factor e2⁢π⁢i⁢a, as can be seen by comparing the value of f at θ=0 and at θ=2⁢π.

Fix real numbers 0<r<R, where we will eventually want to take R→∞ and r→0. Let D be the slit annulus D={z∈ℂ∖[0,∞):r<|z|<R}. We think of the slit in ℂ∖[0,∞) as having a top edge, at θ=0, and a bottom edge, at θ=2⁢π; so the boundary of D consists of a line from r to R along θ=0, on the top edge of the slit, the circle of radius R in the positive direction, the line from R to r along the bottom edge θ=2⁢π, and the circle of radius r in the negative direction. (This is sometimes called the keyhole contour.) We call these pieces respectively ℓ+, γR, ℓ−, and γr. In particular, when we take r→0 and R→∞, the limit of ∫ℓ+f⁢(z)⁢𝑑z will recover our desired real integral.

First, let’s compute the integral

∫∂Df⁢(z)⁢𝑑z

using the residue theorem. The only singularity of f in D is at z=−1, where it has a double pole with residue

dd⁢z⁢(z+1)2⁢f⁢(z)|z=−1=dd⁢z⁢za|z=−1=a⁢(−1)a−1=−a⁢eπ⁢a⁢i.

Therefore by the residue theorem this integral is

−2⁢π⁢i⁢a⁢eπ⁢i⁢a.

Next, we’ll study the components

∫∂Df⁢(z)⁢𝑑z=∫ℓ+f⁢(z)⁢𝑑z+∫γRf⁢(z)⁢𝑑z+∫ℓ−f⁢(z)⁢𝑑z+∫γrf⁢(z)⁢𝑑z.

For the circular integrals, we use the ML bound: on γR, we have L=2⁢π⁢R and |f⁢(z)|≤Ra(R−1)2, so M⁢L=2⁢π⁢Ra+1/(R−1)2∼2⁢π⁢Ra−1, which tends to 0 as R→∞ since a<1, and on γr we have L=2⁢π⁢r and |f⁢(z)|≤ra(r−1)2∼ra, so M⁢L∼2⁢π⁢ra+1→0 as r→0 since a>−1. Therefore both circular integrals vanish in the limit.

For the line integrals, we know that f on ℓ− is e2⁢π⁢i⁢a times the value of f on ℓ+, since this is the definition of the phase factor. In addition, ℓ− is oriented in the opposite direction to ℓ+. Therefore

∫ℓ+f⁢(z)⁢𝑑z+∫ℓ−f⁢(z)⁢𝑑z=(1−e2⁢π⁢i⁢a)⁢∫ℓ+f⁢(z)⁢𝑑z,

which in the limit is then equal to −2⁢π⁢i⁢a⁢eπ⁢i⁢a as above. Therefore for a≠0

limR→∞limr→0∫ℓ+f⁢(z)⁢𝑑z=∫−∞∞xa(1+x)2⁢𝑑x=−2⁢π⁢i⁢a⁢eπ⁢i⁢a1−e2⁢π⁢i⁢a=−2⁢π⁢i⁢ae−π⁢i⁢a−eπ⁢i⁢a=π⁢asin⁡(π⁢a).

(To cover the case a=0 as well, the left-hand side can be seen by direct integration to be 1, and the limit of the right-hand side as a→0 is also 1, so we can say that this holds at a=0 as well after removing a removable singularity.)

We can again extend this to complex values of a as above, but now we have obstructions at a=±1, where both sides now fail to be analytic (the left-hand side diverges and the right-hand side has a zero in the denominator). On the strip −1<Re⁡(a)<1 however both sides are analytic, so since they agree on (−1,1), which contains non-isolated points, it follows that they agree everywhere on the strip.

The right-hand side extends to a∈ℂ∖{…,−3,−2,−1,1,2,3,…}, but the left-hand side does not converge outside this strip. Therefore we could view the right-hand side as providing an analytic continuation of this integral to a meromorphic function on ℂ.