Complex Numbers II: A Guide to Contour Integration (Part 3 of 3)
by greenturtle3141, May 19, 2023, 5:16 AM
Lesson 8: Finally, we can have some fun!
We have been stuck in complex land for 7 (8?) lessons. It's time to wake up and get back to reality.
Example 1
If you've taken calculus, you probably know how to evaluate the integral
by using the fact that
is an antiderivative for the integrand. But what if we didn't know that? It turns out that we can evaluate this integral using the power of complex numbers. Specifically, we will use contour integration. The techniques are difficult to explain without example, so we will walk through how to evaluate this integral so that you learn these techniques along the way.
The first issue we face is that the limits
and
are unwieldy for applying any techniques we've learned. Here is how we fix that.
Key Idea 1: Indefinite integrals are really just limits of definite integrals.
Instead of examining
, we can study
where
is a large number. We'll play with this definite integral, and then eventually we will send
. Sound like a plan?
Great, but how do complex numbers possibly relate to evaluating
?
Key Idea 2: Integrals over the real line are just integrals over the real-axis path!
Aha! We can reinterpret this integral as a path integral
in the complex plane, where
is the straight line segment between
and
.
Why is this ok?
Nice! Now we're kinda in complex land... though, we haven't really used complex numbers yet, we kinda just reframed the problem. What can we use now?
Key Idea 3: Close the loop so that we can apply Cauchy's Theorem and/or the Residue Theorem!
Ah! The path we have right now is just a segment. It's not a loop yet, so we can't apply the powerful theorems we've been learning. So we need to close the loop by drawing a path from
back to
.
What kind of path should we draw? This step is usually the tricky part. It takes some experience and practice to choose the correct contour. Here, it turns out that it doesn't really matter too much, as long as it's reasonable. So we'll chooes the most natural path: A semicircle!
On one hand, this makes the path a loop, and now we can apply the Residue Theorem! Yay! On the other hand, this means that there is another part of the path that we need to integrate over. Wouldn't that mess up our computation? What do semicircles have to do with anything? This should be concerning.
It turns out that the semicircle part of the loop doesn't matter in the long run: It will "vanish" when we send
, which is why this is ok. I'll explain why it vanishes soon, but roughly speaking it vanishes because
gets really small when
is very far away from
, and integrating a smaller and smaller expression gets you a smaller and smaller result.
Enough dilly-dallying! Let's start by writing an expression for the contour integral over this whole loop, which we shall call
.
The first part is the bottom part,
. Well, we already know that
is just equal to
, so that's easy. The second part is the semicircular arc,
. This is paramterized by
for
. Thus
So the integral over the whole loop
can be written as

Now we apply the Residue Theorem to set this equal to a nice number. To apply the Residue Theorem, we need to study the integrand
. Well, it's certainly holomorphic (meromorphic), but it's not defined everywhere. It explodes (it has poles) at
and
. Let's mark that on our diagram.
We only care about when
is big... and when
is big, the pole
is always contained inside the loop! (And
is always outside, so we don't care about it.) Thus, the contour integral around the loop will only pick up the residue at
. Let's calculate that residue. We can write
Then we hope to get rid of the singularity by multiplying by a single factor of
. This results in
, and indeed we have removed the singularity, so the residue is given by evaluating this new expression at
, which is
. By the Residue Theorem, we now have that

You might recognize that
should be the answer to the integral! We're getting closer now. All we have to do now is send
. This gives us that

If you only care about getting the answer (because you're like in an integration bee or something), you can stop now and say "clearly the limit
is
" by waving your hands. That's ok. But if you are curious about why this vanishes, I'll give you two options.
Option 1: Intuitive Reasoning
Option 2: Rigorous Reasoning
Whatever you do, we finally have ended up with
and so we are done!
The next example shows that sometimes, the given integrand is not necessarily the thing we would like to integrate.
Example 2
Let us evaluate the integral
We will use the same exact approach, but the cosine here is annoying to deal with. One way to deal with it is to use the fact that
, because
is easier to deal with. However, a much easier approach is to realize that
is just the real part of
!
Key Idea 4: If there is a sine or cosine, consider replacing it with
. Under suitable conditions, the real/imaginary part of the new integral will be exactly the original integral.
So we can instead think about the integral
Once we evaluate this, we take the real part of the answer, and this will be the answer to the integral
.
Let's run the process again! We use the same contour as before. I'm going to go a bit faster now and explain the steps a little less than before.
The integral over the bottom is just
, which will be what we want when we send
.
The integral over the semicircular arc will be
The residue of
at
is simply
evaluated at
, which is
. Thus, by the Residue Theorem, we have
Sending
, we have
The integral in the middle vanishes


Now use the fact that
over the domain of integration.
, and so therefore
The original integral,
, is thus the real part of
... which is just
. We conclude that

This next example shows that the "arcs" we draw aren't always negligible. They might actually be useful.
Example 3
Let us evaluate the improper Riemann integral

Why do I specify Riemann?
Firstly, instead of looking at
, we will look at
. So we will take the imaginary part of the answer to the integral
.
Now we choose the contour.
Key Idea 4: The contour you choose needs to dodge singularities (while also sticking to the real line as much as it can).
We're temped to pick the same semi-circular contour, but there is a problem: The semicircle crosses
, where
is not defined. We must "dodge" this singularity with... another semi-circular arc.
So, in addition to having a bit
for the big circular arc, we will also need a small
that controls the radius of a small semi-circular arc that serves to dodge this singularity. In all, the contour we choose will have four parts.
The integrals over the two straight-segment parts are simply
and
. When we add these together and send
and
, that will give us
, the integral we need to study.
The integral over the larger semicircular arc is
The integral over the smaller semicircular arc is
(The integral is negated because the contour is going clockwise, not counter-clockwise!)
By Cauchy's Theorem (there are no singularities inside the loop!), the integral over the entire contour is
. That is,

When we send
, the third term vanishes

If you know what "dominated convergence" is, you can now win easily, because the integrand goes to
as
and the integrand is dominated by a the constant function
, which has a finite integral, so
.
Otherwise, here is an alternative: Use the fact that
is symmetric about
to set this equal to
Now, use the fact that the line segment between
and
lies under the graph of
. This tells us that
, which implies that
Hence we may go up with:

, so

Now we need to send
...
...but that last term isn't going to vanish! It will have an actual limit.
I don't want to make this post any longer so I'm going to be extremely not rigorous. We write

More Rigor
Therefore,
The original integral,
, is just the imaginary part of
... which is
. Thus

Our last example uses contour integration in a "backwards" way.
Example 4
Let us evaluate the integral
Two problems: (1) I don't like trig functions. (2) I like complex numbers. Both of these problems are easily solved using the following formulas:

Let's replace the cosines and sines with these guys and see what happens!

Hm, since
appears so much, this kinda looks like the integral we would get if we were integrating some function over the contour
... right? Could we do something with this?
Key Idea 5: Sometimes, you can manipulate the integrand so that it becomes the formula for a contour integral.
Remember that if we paramterize
by
, then the integral
is given by
So... what this means is that if we manipulate our integrand to look like
, then we can apply this formula backwards to write the integral as a contour integral!
The extra factor we need is
... so let's just force it in!
Voila! By applying the formula for contour integrals in reverse, this is just the contour integral


We now apply the Residue Theorem! The integrand explodes at three points:
,
and
. Only
and
are inside the circle. Calculating the residue at
is pretty easy, but
is more annoying because it is a second-order pole, so using the easy method I outlined doesn't really work. There are two ways to proceed.
Method 1: The Ugly Formula
Method 2: Partial Fractions
Either way, we got the answer of
. Whew!
Your Turn
The way to master this method is by practicing! I have provided a number of practice problems that are in no particular order. If you need them, the hints will basically remove any guesswork you need to do by telling you what contour to take and/or what methodologies to use. And, just in case you want more guidance, I've written out the solution to two of these problems.
Happy integrating!
We have been stuck in complex land for 7 (8?) lessons. It's time to wake up and get back to reality.
Example 1
If you've taken calculus, you probably know how to evaluate the integral


The first issue we face is that the limits


Key Idea 1: Indefinite integrals are really just limits of definite integrals.
Instead of examining




Great, but how do complex numbers possibly relate to evaluating

Key Idea 2: Integrals over the real line are just integrals over the real-axis path!
Aha! We can reinterpret this integral as a path integral




![[asy]
size(7cm);
draw((-2,0)--(2,0),p=linewidth(1.5),arrow=Arrows(5));
draw((0,-2)--(0,2),p=linewidth(1.5),arrow=Arrows(5));
draw((-1.5,0)--(1.5,0),p=linewidth(1.75)+red,arrow=MidArrow(5));
dot("$-R$",(-1.5,0),S,p=red+linewidth(1.75));
dot("$R$",(1.5,0),S,p=red+linewidth(1.75));
label("$\gamma_1$",(.5,-.5),p=red);
[/asy]](http://latex.artofproblemsolving.com/5/3/e/53e25e6461ecd12f76b1ad20e82bae9224b2980c.png)
Why is this ok?
This path is parametrized by
where
). Then, by definition of integrating over paths, we have:
which is exactly the integral we are trying to study!



Nice! Now we're kinda in complex land... though, we haven't really used complex numbers yet, we kinda just reframed the problem. What can we use now?
Key Idea 3: Close the loop so that we can apply Cauchy's Theorem and/or the Residue Theorem!
Ah! The path we have right now is just a segment. It's not a loop yet, so we can't apply the powerful theorems we've been learning. So we need to close the loop by drawing a path from


What kind of path should we draw? This step is usually the tricky part. It takes some experience and practice to choose the correct contour. Here, it turns out that it doesn't really matter too much, as long as it's reasonable. So we'll chooes the most natural path: A semicircle!
![[asy]
size(7cm);
draw((-2,0)--(2,0),p=linewidth(1.5),arrow=Arrows(5));
draw((0,-2)--(0,2),p=linewidth(1.5),arrow=Arrows(5));
draw((-1.5,0)--(1.5,0),p=linewidth(1.75)+red,arrow=MidArrow(5));
draw(arc((0,0),1.5,0,180,CCW),p=linewidth(1.75)+purple,arrow=MidArrow(5));
dot("$-R$",(-1.5,0),S,p=red+linewidth(1.75));
dot("$R$",(1.5,0),S,p=red+linewidth(1.75));
label("$\gamma_1$",(.5,-.5),p=red);
label("$\gamma_2$",(-1,1.5),p=purple);
[/asy]](http://latex.artofproblemsolving.com/c/4/d/c4d1f451c0d1887a53192245c09aabe1f876f712.png)
On one hand, this makes the path a loop, and now we can apply the Residue Theorem! Yay! On the other hand, this means that there is another part of the path that we need to integrate over. Wouldn't that mess up our computation? What do semicircles have to do with anything? This should be concerning.
It turns out that the semicircle part of the loop doesn't matter in the long run: It will "vanish" when we send




Enough dilly-dallying! Let's start by writing an expression for the contour integral over this whole loop, which we shall call

The first part is the bottom part,









Now we apply the Residue Theorem to set this equal to a nice number. To apply the Residue Theorem, we need to study the integrand



![[asy]
void pole(pair z){
draw(z+(.1,.1)--z+(-.1,-.1),p=linewidth(1.5));
draw(z+(.1,-.1)--z+(-.1,.1),p=linewidth(1.5));
}
size(7cm);
draw((-2,0)--(2,0),p=linewidth(1.5),arrow=Arrows(5));
draw((0,-2)--(0,2),p=linewidth(1.5),arrow=Arrows(5));
draw((-1.5,0)--(1.5,0),p=linewidth(1.75)+red,arrow=MidArrow(5));
draw(arc((0,0),1.5,0,180,CCW),p=linewidth(1.75)+purple,arrow=MidArrow(5));
dot("$-R$",(-1.5,0),S,p=red+linewidth(1.75));
dot("$R$",(1.5,0),S,p=red+linewidth(1.75));
label("$\gamma_1$",(.5,-.5),p=red);
label("$\gamma_2$",(-1,1.5),p=purple);
pole((0,1));
pole((0,-1));
[/asy]](http://latex.artofproblemsolving.com/1/1/3/11310aaf3b8bf29f48a240709910f32ca239cd51.png)
We only care about when















If you only care about getting the answer (because you're like in an integration bee or something), you can stop now and say "clearly the limit


Option 1: Intuitive Reasoning
The integrand has one
on top and an
on the bottom, so as
gets huge, the magnitude of the integrand should be asymptotically
. This goes to
as
.






Option 2: Rigorous Reasoning
Key Idea 3.5: Write a chain of inequalities that ends with an expression in terms of
that clearly goes to
.
To show that the integral goes to
, we're really trying to show that it's absolute value goes to
. That is, we want to prove that
as
.
Here's the general idea: If, for example, we can show an inequality that looks like
then we would win because
as
, and that must mean that the integral we're looking at also has to go to
!
In other words, our goal is to get an upper bound that goes to
as
.
To do this, we need a few tools.
First, we apply the integral triangle inequality to shove the absolute value bars inside.
Next, we manipulate this expression using absolute value properties.

The numerator simplified nicely, but the bottom needs to be tamed still. To continue, we use the triangle inequality, which tells us that
, which rearranges to the lower bound
. You might be thinking that this is the wrong way, but actually, since we're in the denominator, we need a lower bound in order to write an upper bound on the whole fraction. That is, since
, we have that
. So we can continue "going up"!
Wait a second,
doesn't appear anymore! So we can evaluate this upper bound.
This is an upper bound that goes to
as
! That's exactly what we needed, therefore we can conclude that



To show that the integral goes to




Here's the general idea: If, for example, we can show an inequality that looks like




In other words, our goal is to get an upper bound that goes to


To do this, we need a few tools.
- (Triangle Inequality)
for all
.
- (Integral Triangle Inequality)
, always!
First, we apply the integral triangle inequality to shove the absolute value bars inside.













Whatever you do, we finally have ended up with

The next example shows that sometimes, the given integrand is not necessarily the thing we would like to integrate.
Example 2
Let us evaluate the integral





Key Idea 4: If there is a sine or cosine, consider replacing it with

So we can instead think about the integral


Let's run the process again! We use the same contour as before. I'm going to go a bit faster now and explain the steps a little less than before.
![[asy]
void pole(pair z){
draw(z+(.1,.1)--z+(-.1,-.1),p=linewidth(1.5));
draw(z+(.1,-.1)--z+(-.1,.1),p=linewidth(1.5));
}
size(7cm);
draw((-2,0)--(2,0),p=linewidth(1.5),arrow=Arrows(5));
draw((0,-2)--(0,2),p=linewidth(1.5),arrow=Arrows(5));
draw((-1.5,0)--(1.5,0),p=linewidth(1.75)+red,arrow=MidArrow(5));
draw(arc((0,0),1.5,0,180,CCW),p=linewidth(1.75)+purple,arrow=MidArrow(5));
dot("$-R$",(-1.5,0),S,p=red+linewidth(1.75));
dot("$R$",(1.5,0),S,p=red+linewidth(1.75));
label("$\gamma_1$",(.5,-.5),p=red);
label("$\gamma_2$",(-1,1.5),p=purple);
pole((0,1));
pole((0,-1));
[/asy]](http://latex.artofproblemsolving.com/1/1/3/11310aaf3b8bf29f48a240709910f32ca239cd51.png)
The integral over the bottom is just


The integral over the semicircular arc will be




















This next example shows that the "arcs" we draw aren't always negligible. They might actually be useful.
Example 3
Let us evaluate the improper Riemann integral

Why do I specify Riemann?
There are two types of integrals: Riemann and Lebesgue. Although these two types of integrals give the same answer in almost all cases, most mathematicans use Lebesgue integrals because they have nicer properties and are so much easier to work with.
is an example of a function where the two types of integrals differ. It is Riemann-integrable (in an improper sense), whereas in the Lebesgue sense it is not integrable!

Firstly, instead of looking at



Now we choose the contour.
Key Idea 4: The contour you choose needs to dodge singularities (while also sticking to the real line as much as it can).
We're temped to pick the same semi-circular contour, but there is a problem: The semicircle crosses


So, in addition to having a bit


![[asy]
void pole(pair z){
draw(z+(.1,.1)--z+(-.1,-.1),p=linewidth(1.5));
draw(z+(.1,-.1)--z+(-.1,.1),p=linewidth(1.5));
}
size(7cm);
draw((-2,0)--(2,0),p=linewidth(1.5),arrow=Arrows(5));
draw((0,-2)--(0,2),p=linewidth(1.5),arrow=Arrows(5));
draw((-1.5,0)--(-.3,0),p=linewidth(1.75)+rgb(0.8,0.18,0),arrow=MidArrow(5));
draw(arc((0,0),0.3,180,0,CW),p=linewidth(1.75)+rgb(0.93,0.46,0.15),arrow=MidArrow(5));
draw((.3,0)--(1.5,0),p=linewidth(1.75)+rgb(0.71,0.34,0.56),arrow=MidArrow(5));
draw(arc((0,0),1.5,0,180,CCW),p=linewidth(1.75)+rgb(0.64,0,0.38),arrow=MidArrow(5));
dot("$-R$",(-1.5,0),S,p=linewidth(1.75));
dot("$R$",(1.5,0),S,p=linewidth(1.75));
dot("$-\varepsilon$",(-.3,0),S,p=linewidth(1.75));
dot("$\varepsilon$",(.3,0),S,p=linewidth(1.75));
pole((0,0));
[/asy]](http://latex.artofproblemsolving.com/4/3/1/4315b3fd90ece213016da64e29b6ab461386b21c.png)
The integrals over the two straight-segment parts are simply





The integral over the larger semicircular arc is


By Cauchy's Theorem (there are no singularities inside the loop!), the integral over the entire contour is


When we send








Otherwise, here is an alternative: Use the fact that











Now we need to send


I don't want to make this post any longer so I'm going to be extremely not rigorous. We write


The issue is swapping the limit and integral. You cannot do that in general. Here is more or less how you go about doing it right: You have to use something called the (Lebesgue) Dominated Convergence Theorem. This needs two ingredients.
Ingredient 1: Pointwise Convergence
What this means is that the integrand has a limit basically everywhere. Here, we see that the limit
always exists (and is equal to
) no matter what
is.
Ingredient 2: Domination
What this means is that you can find an integrable upper bound for the absolute value of the integrand that does NOT depend on the limit variable (which, here, would be
). Integrable means "has finite integral".
Here, I can write

is a valid dominator because it does not depend on
and it is integrable (i.e.
).
With these two ingredients, we are allowed to switch the limit and the integral.
Ingredient 1: Pointwise Convergence
What this means is that the integrand has a limit basically everywhere. Here, we see that the limit



Ingredient 2: Domination
What this means is that you can find an integrable upper bound for the absolute value of the integrand that does NOT depend on the limit variable (which, here, would be

Here, I can write




With these two ingredients, we are allowed to switch the limit and the integral.
Therefore,





Our last example uses contour integration in a "backwards" way.
Example 4
Let us evaluate the integral







Key Idea 5: Sometimes, you can manipulate the integrand so that it becomes the formula for a contour integral.
Remember that if we paramterize





The extra factor we need is












Method 1: The Ugly Formula
If you read about the ugly formula back in Lesson 6, you know the steps to actually find the residue at
.
First, we need to find the first power of
that will get rid of the singularity. Obviously, it's
.
Now, we multiply by that to get rid of the singularity. This leaves us with
.
Now, we differentiate this
times. By the quotient rule, this gives
Finally, we plug in
into this to get
. This is the residue!
As for the residue at
, we multiply by
to leave us with
(note the extra factor of 2), and now when we plug in
, that's just
.
Altogether, we conclude that
![$$\frac1{-4i}\int_{\partial D} \frac{(z^2-1)^2}{z^2(2z+1)(z+2)}\,dz = \frac{1}{-4i} \cdot 2\pi i\left[\frac{-5}{4} + \frac34\right] = \boxed{\frac{\pi}{4}}.$$](//latex.artofproblemsolving.com/f/8/c/f8c2dacdc79793ca854dc5ec914a8c254c635df3.png)

First, we need to find the first power of


Now, we multiply by that to get rid of the singularity. This leaves us with

Now, we differentiate this




As for the residue at





Altogether, we conclude that
![$$\frac1{-4i}\int_{\partial D} \frac{(z^2-1)^2}{z^2(2z+1)(z+2)}\,dz = \frac{1}{-4i} \cdot 2\pi i\left[\frac{-5}{4} + \frac34\right] = \boxed{\frac{\pi}{4}}.$$](http://latex.artofproblemsolving.com/f/8/c/f8c2dacdc79793ca854dc5ec914a8c254c635df3.png)
Method 2: Partial Fractions
This is a very simple workaround, but it might be a tad more tedious. If we use "Heaviside cover-up partial fraction decomposition", we can find that
So the integral we need to evaluate is just
So we can just go term by term!
Therefore,



- We have
, if you plug in a paramterization and do it manually.
by Cauchy's Theorem.
by the Residue Theorem.
by the Residue Theoerm.
by Cauchy's Theorem.
Therefore,

Either way, we got the answer of

Your Turn
The way to master this method is by practicing! I have provided a number of practice problems that are in no particular order. If you need them, the hints will basically remove any guesswork you need to do by telling you what contour to take and/or what methodologies to use. And, just in case you want more guidance, I've written out the solution to two of these problems.
Happy integrating!
- Evaluate
. Hint
You can use a circle contour, and the symmetry of the integrand. The two residues you need to deal with are atAnswer.
Alternatively, use this:SolutionLet's use the quarter arc contour given in the hint. The integral over this contour is
(Note that we used the fact that
for the second term.) Let's use the Residue Theorem to evaluate this. The only residue inside the quarter arc is the one at
. The residue at this singularity is
It follows by the Residue Theorem that
Sending
, we get
because the third term vanishes (and this is not hard to show and/or intuit). Dividing by
, we end up with
- Evaluate
. Small Hint
We can't use a semicircle here either, because it would cross the negative real line, andBig Hintisn't defined there. Well, we still want to draw a loop that goes from
to
in a straight line and then gets back to
. What's a natural way to go from
to
?
Also, to evaluate principle logs, keep in mind thatwhere
and
is such that
.
Use this:Answer - (*) Evaluate
. Subtle Hint
The semicircle contour doesn't work here either. Think about what went wrong. Then, think of a better way to make a path fromBig Hintback to
.
Use this:Answer - (*) Can you find a formula for
for postive integers
?
- Evaluate
. Hint 1
ReplaceHint 2with
.
Turn it into a contour integral onHint 3. Except... the parametrization is going to be different if you want a full loop, since the upper bound is
, not
. Hmm... look at what terms you have in your integrand, any nice ideas pop up?
Write the integrand in the formAnswer.
SolutionUse the "backwards" trick, like in Example 4.
The only singularity that lies inside the unit circle is
. The residue at this singularity is
evaluated at
, or
. So by the Residue Theorem,
- Evaluate
. Answer
- Evaluate
. Hint 1
Instead integrateHint 2and take its real part.
Use a semi-circular contour that dodgesAnswer.
- (*) Evaluate
. Hint 1
The best integrand to look at isHint 2. You want to use the Gaussian integral.
This contour was hard to come up. Use this:Answer