Tricki
a repository of mathematical know-how

If you are calculating an integral, complex substitutions are not forbidden

Quick description

Sometimes an integral \int_a^bf(x)dx can be made simpler if one makes the substitution u=g(x) for some invertible function g. The new integral is then \int_{g(a)}^{g(b)}f(g(u))(g^{-1})'(u)du. What if g is a complex-valued function, such as g(x)=ix? Then the range of integration seems to be a path in the complex plane, which looks very dodgy. However, substitutions of this kind can sometimes be justified with the help of Cauchy's residue theorem, and they are sometimes very useful. This is one way of looking at some of the real integrals that can be calculated with the help of contour integration.

Prerequisites

Complex analysis up to the residue theorem and contour integration.

Note iconAttention This article is in need of attention. It might be nice to have more examples.

Example 1

Let us try to calculate the integral \int_0^\infty\sin(x^2)dx. Before we do so, let us note that this is an excellent example of an oscillatory integral: although \sin(x^2) does not tend to zero, it remains bounded and oscillates faster and faster, so the corresponding oscillations of the function F(t)=\int_0^t\sin(x^2)dx become smaller and smaller. So we expect this integral to be finite.

The function \sin(x^2) is sufficiently similar to e^{x^2} that we do not expect to be able to find an antiderivative. Does that make our task hopeless? Not quite, because this is a definite integral, and we might remember that there is at least one integral like that that has a nice answer: \int_0^\infty e^{-x^2}dx=\frac 12\sqrt{\pi}. This suggests that we should try to turn our integral into the integral of a Gaussian.

An easy way to involve the exponential function is to use the fact that \sin(x^2) is the imaginary part of e^{ix^2}. So we will be done if we can calculate the integral \int_0^\infty e^{ix^2}dx (which we still expect to be finite, because the same reasoning applies to its real part). And now we might observe that a simple substitution will turn this integral into one of the form we want: we just choose u in such a way that ix^2=-u^2, which tells us that u^2=-ix^2, which we can achieve by taking u=e^{-i\pi/4}x. Here, e^{-i\pi/4} is chosen because it is one of the square roots of -i.

If we make this substitution, then x=e^{i\pi/4}u, so dx=e^{i\pi/4}du, and our integral becomes \int_0^\infty e^{-u^2}e^{i\pi/4}du. Therefore, the answer is \frac {e^{i\pi/4}}2\sqrt{\pi}, which has imaginary part \sqrt{\pi/8}.

But was that a legitimate argument? Isn't there something very fishy about taking the range of integration to be [0,\infty)?

To answer this question, let us try to interpret the integral \int_0^\infty e^{-u^2}e^{i\pi/4}du as a path integral involving the function e^{iz^2}. After a bit of experiment, we find that it is the integral of e^{iz^2} along the line that starts at the origin and slopes upwards at 45 degrees. To see this, write \gamma for this path, and think of it as the function u\mapsto e^{i\pi/4}u defined on [0,\infty). Then the definition of a path integral tells us that \int_\gamma e^{iz^2}dz is indeed precisely \int_0^\infty e^{-u^2}du. So our question now is whether the path integral \int_\gamma e^{iz^2}dz is equal to our original integral \int_0^\infty e^{ix^2}dx, which is the integral of the same function, but along the positive real axis.

We can use standard techniques to prove that the two are equal. Consider a closed curve C that goes from 0 to R, then from R to e^{i\pi/4}R round the circle of radius R about 0, and then back from e^{i\pi/4}R to 0 again. Since the function e^{iz^2} is holomorphic everywhere, its integral round C is zero, so we are done if we can prove that the contribution from the circular arc tends to zero. Since e^{iw} is small when w has a large imaginary part, which it does almost everywhere on this circular arc, this is indeed the case.

General discussion

When presenting a solution to the above problem, it would not be normal practice to discuss integration by substitution. Rather, one would observe that the integral is simpler along a different path and use that as motivation for choosing the contour C. The point of this article is that the way one thinks of a good contour to choose is more or less identical to the way one thinks of a good substitution in an ordinary real integral.

Sometimes, one obtains a path integral that does not give the same answer as the original integral. But if that is merely because there are some residues inside the contour C, then we can still use the transformed integral (together with calculation of the residues) to work out the original one.

This method can be viewed as an application of the more general method of contour shifting.

Example 2

Suppose you are asked to calculate the integral \int_{-\infty}^\infty e^{-x^2/2+ax}dx. Given the basic fact that \int_{-\infty}^\infty e^{-x^2/2}dx=\sqrt{2\pi}, it is natural to attack this by completing the square. We note that x^2/2-ax=(x-a)^2/2-a^2/2, which allows us to rewrite our integral as e^{a^2/2}\int_{-\infty}^\infty e^{-(x-a)^2/2}dx. Substituting y=x-a, we see immediately that the answer is \sqrt{2\pi}e^{a^2/2}.

What happens if a is a complex number? Formally, the entire calculation above works in precisely the same way, but now the substitution y=x-a is complex, so we have to worry about whether it is valid. Let us try to find a path integral involving the function e^{-z^2/2+az} that equals e^{a^2/2}\int_{-\infty}^\infty e^{-y^2/2}dy. The one slightly non-obvious decision is whether we should integrate along the path \R+a or \R-a, so let us integrate along \R+b and see what happens. That is, we take the path t\mapsto t+b (a function from \R to \C) and integrate the function e^{-z^2/2+az} to get \int_{-\infty}^\infty e^{-(t+b)^2/2+a(t+b)}dt. Taking b=a gives us \int_{-\infty}^\infty e^{-t^2/2+a^2/2}dt, which is exactly what we wanted.

This strongly suggests that we should try a contour in the shape of a very wide parallelogram, two sides of which are the intervals [-R,R] and [-R+a,R+a]. (The latter is supposed to be a horizontal line segment in the complex plane.) The one remaining point to check is whether the integral is small on the two segments that join R to R+a and -R to -R+a. This is indeed the case, and easy to check: it basically follows from the fact that e^{-R^2} tends to zero much faster than exponentially.

This allows us to show that the original integral is \sqrt{2\pi}e^{a^2/2} even when a is complex. In particular, if a has the form i\alpha for a real number \alpha, then the integral is \sqrt{2\pi}e^{-\alpha^2/2}.

The Fourier transform of the Gaussian function e^{-x^2/2} is defined to be F(\alpha)=\frac 1{\sqrt{2\pi}}\int_{-\infty}^\infty e^{-x^2/2}e^{i\alpha x}dx. We have just shown that F(\alpha)=e^{-\alpha^2/2}. That is, the Fourier transform of the Gaussian is the Gaussian. For good measure, we have calculated the Laplace transform (meaning that we can allow \alpha to take complex values): it is given by the same formula.

General discussion

Once again, integration by substitution is not really recommended for a problem like this. It is just an idea to hold in the back of one's head when trying to think of a suitable contour. Once one is used to this kind of contour integral, a quicker approach is simply to observe that the function e^{-z^2/2+az} is easier to handle on the line \R+a than on the line \R, since if z=t+a then -z^2/2+az=-(t+a)^2/2+a(t+a)=-t^2/2+a^2/2. So if one chooses the above contour, then we can handle one long side and the two short sides tend to zero, so we can work out the integral we are interested in.

Comments

Inline comments

The following comments were made inline in the article. You can click on 'view commented text' to see precisely where they were made.

I don't think this statement

I don't think this statement is true, nor the consequence immediately obvious given it (otherwise we could apply the same sort of argument to \sin(x) for instance).

Parameterizing the arc as Re^{it} for t \in [0, \pi/4], the integral over the arc is \int_0^{\pi/4}e^{iR^2e^{2it}}(iRe^{it}dt).

Expanding with Euler's Formula gives R \int_0^{\pi/4} \left(i \cos(t + R^2 \cos 2t) - \sin(t + R^2 \cos 2t) \right) e^{-R^2 \sin 2t} dt.

Both the real and imaginary integrands are bounded above in absolute value by Re^{-2R^2t}, which means the integrals are bounded above by {(1-e^{\pi R^2/4}) \over 2R} \leq {1 \over 2R} and so the contribution from the arc does vanish at infinity.

Post new comment

(Note: commenting is not possible on this snapshot.)

Before posting from this form, please consider whether it would be more appropriate to make an inline comment using the Turn commenting on link near the bottom of the window. (Simply click the link, move the cursor over the article, and click on the piece of text on which you want to comment.)

snapshot
Notifications