A first in Contour Integration

Hello everyone, and welcome to this exciting post! Today, I’ll be showing you how to use contour integration, a very useful technique from complex analysis, to evaluate a certain integral. What’s nice about contour integration is that it allows you to evaluate so many integrals that you could not otherwise, as a lot of integrands have no elementary anti-derivative. Now, the integral we’ll be focusing on today can be computed using real methods, but I wanted to start using contour integration on this blog. And we won’t even be starting with an “easy” example, as this integral will make us discuss branch points, branch cuts and other things like that from complex analysis. But that will only make it more interesting!

\begin{aligned} I(a)=\int_0^\infty \frac{x^{1/a}}{1+x^2}\,dx \end{aligned}

So this is the integral we’ll be investigating. But in order to see why complex integration will be useful to evaluate real integrals, we’re going to discuss a few ideas and an important theorem that we will need.

First of all, what is complex integration? Well, it can be useful to think of it as line integration in the complex plane. Take a function f:\mathbb{C}\to\mathbb{C} and a C^1 curve \gamma [a,b]\to\mathbb{C}. The integral of f(z) along \gamma is denoted as

\begin{aligned} \int_{\gamma} f(z) dz \end{aligned}

But this doesn’t really help us evaluate it, which we will want to do. Choose a parametrization z\mapsto \gamma(t):\mathbb{R}\to\mathbb{C} be a parametrization of \gamma that is consistent with its direction. Then, the same integral can also be defined as

\begin{aligned} \int_a^b f(\gamma(t)) \,\gamma'(t)dt \end{aligned}

Now this definition will be useful to us. Next, we’ll talk about contours. A contour is a sum of piece-wise continuous whose endpoints are connected so that they all point in one direction. Here are some examples of different contours:

Contours

Now you may be asking yourself how a complex line integral will help us evaluate a real integral that we are after. The main tool that will help us is the Residue Theorem:

Let U be a simply connected open subset, and let f(z) be holomorphic in U\setminus \{a_1,a_2,...,a_k\}. Let \gamma be a closed contour contained in U that encircles all the singularities of f(z). Then, the contour integral of f(z) over \gamma is equal to

\begin{aligned} \int_{\gamma} f(z) dz = 2\pi i\sum_{n=1}^k \text{Res}(f,a_n) \end{aligned}

The residue at a pole, or singularity, depends on the pole’s order. If f(z) has a pole at z=a, then the order of the pole is the smallest integer n, such that \lim_{z\to a} (z-a)^n f(z) is finite. If we know the order of the pole, which ususally isn’t too hard to find, we can calculate the Residue of f at that pole using the following formula:

\begin{aligned} \text{Res}(f,a)=\frac{1}{(n-1)!}\lim_{z \to a} \frac{d^{n-1}}{dz^{n-1}} (z-a)^n f(z) \end{aligned}

In our integral today, we’ll be dealing with a simple pole, where n=1. The formula then reduces to

\begin{aligned} \text{Res}(f,a)=\lim_{z \to a} (z-a) f(z) \end{aligned}

Which is much simpler. We are now ready to tackle our integral! Well almost. We have two more things to go over, and those are branch points and branch cuts. Basically, a branch point of a multi-valued function is a point around which the function is discontinuous on a circle enclosing the point. For the complex natural logarithm, \log z, 0 is a branch point. This is because, starting from the point z=r+0i, and going around the circle counterclockwise, the logarithm gains an argument of 2\pi i. There is thus a discontinuity at the point z=r, as \lim_{\epsilon \to 0^+} \log(r+\epsilon i)=\log r, but \lim_{\epsilon \to 0^-} \log(r+\epsilon i) =\log r + 2\pi i. This stems from the fact that the complex log is a multivalued function.

Finally, branch cuts are the points where the single-valued functions come together to make the multi-valued function. For example, going back to the log function, we can define a branch cut on [0,\infty), letting \text{arg}z \in [0,2\pi i), in such a way that the log function is now single-valued and analytic on \mathbb{C} \setminus [0,\infty).

You may think that this multi-valuedness is just going to cause us problems when evaluating integrals in the complex plane, but it will actually help us with a wide range of integrals, as you will see.

We are now ready to compute the integral we started with, using contour integration. The first step is choosing a contour. When I first started, this step was very mysterious to me and I wasn’t exactly sure which contour to choose. That intuition will come with practice and time as you get to better understand contour integration with different integrands. Today, we’ll be using a special contour named a “keyhole contour”, as you may see why:

Keyhole Contour

Because x^{1/a}=e^{(\log x)/a}, we will have to make a branch cut. In thise case, it will be along the real axis. And we’re going to be choosing \text{arg} z \in [0,2\pi). Basically, we’re going have 4 different integrals, one for each segment of the contour. In this case, we will let f(z)=\frac{ z^{1/a}}{1+z^2}.  I’ll parametrize the large circular part by z=Re^{i\theta} for \theta \in [\epsilon, 2\pi - \epsilon]. The smaller circle will be similarly parameterized. Our contour integral is then

\begin{aligned} \int_{\epsilon}^{2\pi - \epsilon} \frac{ R^{1/a} e^{i\theta/a}}{R^2e^{2i\theta}+1}i Re^{i\theta}\,d\theta + \int_{R}^0  \frac{(x-i\epsilon)^{1/a}}{(x-i\epsilon)^2+1}\,dx \\ + \int_{2\pi-\epsilon}^{\epsilon} \frac{ r^{1/a} e^{i\theta/a}}{r^2e^{2i\theta}+1}i re^{i\theta}\,d\theta + \int_{0}^R  \frac{(x+i\epsilon)^{1/a}}{(x+i\epsilon)^2+1}\,dx \end{aligned}

As wel let R\to\infty and r \to 0, the first and third integrals vanish, leaving us with only the second and fourth. And as we let \epsilon \to 0, our second integral will gain a factor of e^{2\pi i/a}, as the logarithm from the function z^{1/a}=e^{(\log z)/a} has gained an argument of 2\pi i as it circle back to the real axis. Our contour integral is now

\begin{aligned} \left(1-e^{2\pi i/a}\right)\int_0^\infty \frac{x^{1/a}}{x^2+1}\,dx \end{aligned}

Which is very close to our desired integral! Now, you may see the purpose of the keyhole contour. It takes advantage of the fact that the logarithm is multivalued in order to let us compute our integral, as if the log did not gain that argument of 2\pi i, our desired integral would simply vanish from the overall contour integral. We can now use the Residue Theorem to finish the computation. We know that there are two poles at z=\pm i. Summing the Residues and muptiplying them by 2\pi i, we obtain

\begin{aligned} \left(1-e^{2\pi i/a}\right)\int_0^\infty \frac{x^{1/a}}{x^2+1}\,dx=\pi\left(e^{i\pi/2a}+e^{3\pi i/2a}\right) \end{aligned}

After some compuations, we obtain

\begin{aligned} \int_0^\infty \frac{x^{1/a}}{x^2+1}\,dx &= \pi \frac{\sin \left(\frac{\pi}{2a}\right)}{\sin \left(\frac{\pi}{a}\right)} \\ &=\frac{\pi}{2} \sec\left(\frac{\pi}{2a}\right) \end{aligned}

What a beautiful result! This really shows the power of contour integration, and although it can be long to arrive at the result, it is a very useful technique.

Another round of Schwinger parametrization–simpler this time

Hello integral enthusiasts! Today’s we’ll be computing a pretty hard integral using a similar technique to the one used last time. However, we’re going to use the simplified Schwinger parametrization.

Remember that

\begin{aligned} \frac{1}{A(x)^p}=\frac{1}{\Gamma(p)} \int_0^\infty u^{p-1} e^{-u A(x)}\,du \end{aligned}

And choosing p=1, we find that

\begin{aligned} \frac{1}{A(x)}= \int_0^\infty e^{-u A(x)}\,du \end{aligned}

We’ll be using this equality for our integral today, which is…

\begin{aligned} I_a^b=\int_{-\infty}^\infty \frac{e^{-ax^2}}{x^2+b^2}\,dx \end{aligned}

This is a pretty daunting integral, as it’s not easy to integrate a combination of inverse polynomials and gaussian functions. But this is where our parametrization comes in! Choosing A(x)=x^2+b^2, we can show that

\begin{aligned} I_a^b&=\int_{-\infty}^\infty \frac{e^{-ax^2}}{x^2+b^2}\,dx \\ &=\int_{-\infty}^\infty e^{-ax^2}\int_0^\infty e^{-u(x^2+b^2)}\,dudx \end{aligned}

And thanks to absolute convergence of our integrals, we can switch the order of integration,

\begin{aligned} I_a^b&= \int_{-\infty}^\infty e^{-ax^2}\int_0^\infty e^{-u(x^2+b^2)}\,dudx \\ &=\int_0^\infty e^{-ub^2}\int_{-\infty}^\infty e^{-x^2(a+u)}\,dxdu \\ &=\sqrt{\pi}\int_0^\infty \frac{e^{-ub^2}}{\sqrt{a+u}}\,du \\ &= \sqrt{\pi}\int_a^\infty \frac{e^{-(\nu-a)b^2}}{\sqrt{\nu}}\,d\nu \\ &= \sqrt{\pi}e^{ab^2} \int_a^\infty \nu^{-1/2} e^{-\nu b^2}\,d\nu \quad \quad \nu=s^2 \\  &=2\sqrt{\pi}e^{ab^2}\int_{\sqrt{a}}^\infty e^{-s^2 b^2}\,ds \end{aligned}

We’ll now substitute s=\lambda/b:

\begin{aligned} I_a^b&= 2\sqrt{\pi}e^{ab^2}\int_{\sqrt{a}}^\infty e^{-s^2 b^2}\,ds \\ &=2\frac{\sqrt{\pi}}{b}e^{a b^2}\int_{b\sqrt{a}}^\infty e^{-\lambda^2}\,d\lambda \end{aligned}

And we can now use the definition of the complementary error function to finish off this integral:

\begin{aligned} \text{erfc}(x)&=1-\text{erf}(x) \\ &= \frac{2}{\sqrt{\pi}} \int_x^\infty e^{-t^2}\,dt \end{aligned}

And using this interesting function, our integral can now be expressed as

\begin{aligned} I_a^b&=2\frac{\sqrt{\pi}}{b}e^{a b^2}\int_{b\sqrt{a}}^\infty e^{-\lambda^2}\,d\lambda \\ &=\frac{\pi}{b} e^{ab^2} \text{erfc}(b\sqrt{a}) \end{aligned}

This means we have the nice result that

\begin{aligned} \int_{-\infty}^\infty \frac{e^{-ax^2}}{x^2+b^2}\,dx=\frac{\pi}{b} e^{ab^2} \text{erfc}(b\sqrt{a}) \end{aligned}

And although the error function is technically not elementary, it is still nice to be able to use it in cases like this one.