I got a request from an old friend whom I didn’t even know existed. He is the son of my grand-advisor, if that makes any sense. He teaches, among others, a course in Real Analysis at a university in Australia. I know I must like this guy because he says stuff like this:

Currently, within the School of Mathematical Sciences, there is something of a debate about our lack of incorporation of modern technology into our teaching, particularly at Level 1. Some say that with the ubiquity and ease of modern tools (Alpha, Matlab and such like), why should we continue to teach the old methods of techniques of integration? After all, do we teach students how to use slide rules these days?

You can probably predict what my view is on this debate: If you don’t understand those methods, you are completely dependent on someone else’s ideas and machines, and you’ll never be able to improve on what already exists. Whether you are going to be an engineer, a physicist, an economist, a financial analyst, a mathematician or anything else, you will always be better at whatever you are doing if you genuinely understand what lies beneath. Today,

knowledge is dirt cheap, but understanding is much harder to obtain.

(The **emphasis** is mine.)

Surprise surprise, he is a reader of this blog. Anyway, he posed a problem for his students: how would one go about evaluating the following integral:

$$\int_0^2 \frac{dx}{\sqrt{1+x^4}} $$

Understand that his students are people that have gone through at least an introductory course in integral calculus, and their sights set on bigger and better things. They don’t really think about *computation* all that much. My friend wrote up a very long document containing his very interesting thoughts about different approaches (e.g., Taylor series, Simpson’s method, and so on).

Being a professor, my friend is obviously wise enough to transform the integral into something more amenable to, er…interesting methods, viz.:

$$\int_0^{\infty} \frac{dx}{\sqrt{1+x^4}} – \int_2^{\infty} \frac{dx}{\sqrt{1+x^4}} = \int_0^{\infty} \frac{dx}{\sqrt{1+x^4}} – \int_0^{1/2} \frac{dx}{\sqrt{1+x^4}} $$

Aha! I know what your are saying. We can use a contour integral for the first integral, and use a Taylor expansion for the second.

Let’s get the second integral out of the way. As we said, Taylor expansion using

$$(1-y)^{-1/2} = \sum_{k=0}^{\infty} \frac1{2^{2 k}} \binom{2 k}{k} y^k $$

Then by reversing the order of summation and integration, we get

$$\int_0^{1/2} \frac{dx}{\sqrt{1+x^4}} = \sum_{k=0}^{\infty} \frac1{2^{6 k+1}} \binom{2 k}{k} \frac1{4 k+1}$$

We will discuss the numerical evaluation of this sum below. But first let’s evaluate the first integral. Consider the following contour integral:

$$\oint_C \frac{dz}{\sqrt{1+z^4}} $$

where $C$ is the following contour:

The idea is to avoid the branch points. Thus, I made $C$ a semicircle in the upper half place of radius $R$, with circular detours about the branch points at $z=e^{i \pi/4}$ and $z=e^{i 3 \pi/4}$. The contour integral is then equal to

$$\int_{-R}^R \frac{dx}{\sqrt{1+x^4}} + i R \int_0^{\pi} d\theta \, \frac{e^{i \theta}}{\sqrt{1+R^4 e^{i 4 \theta}}} \\ + e^{i \pi/4} \int_R^{1+\epsilon} \frac{dt}{\sqrt[+]{1-t^4}} + i \epsilon \int_{\pi/4}^{9 \pi/4} d\phi \, \frac{e^{i \phi}}{\sqrt{1+\epsilon^4 e^{i 4 \phi}}} \\ + e^{i \pi/4} \int_{1+\epsilon}^R \frac{dt}{\sqrt[-]{1-t^4}} + e^{i 3 \pi/4} \int_R^{1+\epsilon} \frac{dt}{\sqrt[+]{1-t^4}} \\ + i \epsilon \int_{3 \pi/4}^{11 \pi/4} d\phi \, \frac{e^{i \phi}}{\sqrt{1+\epsilon^4 e^{i 4 \phi}}} + e^{i 3 \pi/4} \int_{1+\epsilon}^R \frac{dt}{\sqrt[-]{1-t^4}}$$

Note that $\sqrt[+]{1-t^4} = i \sqrt{t^4-1}$ represents the positive branch of the square root, while $\sqrt[-]{1-t^4} = -i \sqrt{t^4-1}$ represents the negative branch of the square root.

To recover the real integral we want, we take the limits as $R \to \infty$ and $\epsilon \to 0$. In this limit, the second, fourth, and seventh integrals vanish. (This is straightforward to verify in this case and I will not work that out here.) We are left with, as the contour integral in these limits:

$$\int_{-\infty}^{\infty} \frac{dx}{\sqrt{1+x^4}} +i 2 \left (e^{i \pi/4} + e^{i 3 \pi/4} \right ) \int_1^{\infty} \frac{dt}{\sqrt{t^4-1}} $$

Now, this is where I will strike at a misconception: we do not use the residue theorem here. The reason is that there are no poles enclosed within the contour $C$. Rather, we use Cauchy’s theorem (of which the residue theorem is a special case), which states that the contour integral is zero because the integrand is analytic within the contour $C$. Now, using the fact that $e^{i \pi/4} + e^{i 3 \pi/4} = i \sqrt{2}$ and using the symmetry of the integrand, we get the following:

$$\int_{0}^{\infty} \frac{dx}{\sqrt{1+x^4}} = \sqrt{2} \int_1^{\infty} \frac{dt}{\sqrt{t^4-1}} $$

So we have used Cauchy’s theorem to transform one integral into another. Before I make remarks about what this means, let’s evaluate the integral on the RHS, which is a lot easier then the original integral. First, note that

$$\int_1^{\infty} \frac{dt}{\sqrt{t^4-1}} = \int_0^1 \frac{dt}{\sqrt{1-t^4}} $$

Now sub $t=u^{1/4}$, then $dt = \frac14 u^{-3/4} du$, and we now have

$$\int_{0}^{\infty} \frac{dx}{\sqrt{1+x^4}} = \frac{\sqrt{2}}{4} \int_0^1 du \, u^{-3/4} (1-u)^{-1/2} $$

The latter integral is a beta function. Thus, we have an analytical result for the integral:

$$\int_{0}^{\infty} \frac{dx}{\sqrt{1+x^4}} = \frac{\sqrt{2}}{4} \frac{\displaystyle \Gamma \left (\frac14\right ) \Gamma \left (\frac12\right )}{\displaystyle \Gamma \left (\frac34\right )} $$

Use the facts that $\Gamma \left (\frac12\right ) = \sqrt{\pi}$, and

$$\Gamma \left (\frac34\right ) \Gamma \left (\frac14\right ) = \frac{\pi}{\sin{(\pi/4)}} = \sqrt{2} \pi$$

Putting this altogether, we finally have

$$\int_{0}^{\infty} \frac{dx}{\sqrt{1+x^4}} = \frac1{4 \sqrt{\pi}} \Gamma \left (\frac14\right )^2 $$

and

$$\int_{0}^{2} \frac{dx}{\sqrt{1+x^4}} = \frac1{4 \sqrt{\pi}} \Gamma \left (\frac14\right )^2 – \sum_{k=0}^{\infty} \frac1{2^{6 k+1}} \binom{2 k}{k} \frac1{4 k+1}$$

That is the final result – it is about as simple an analytical result as we can hope for without resorting to hypergeometrics. However, I have two comments:

1) *Numerical evaluation of the series*. I know of no simple closed form for the series. We can, however, prescribe a way to compute the series to an arbitrary tolerance with an minimum number of terms. To do this, we provide a simple estimate of the summand. It turns out that

$$\frac1{2^{2 k}} \binom{2 k}{k} \lt (\pi k)^{-1/2} $$

so that the summand is bounded by, and behaves for large $k$ as $(8 \sqrt{\pi})^{-1} k^{-3/2} 2^{-4 k}$. To achieve a tolerance $\delta$, the minimum number of terms in the sum is roughly

$$\frac1{4 \log{2}} \log{\left (\frac1{8 \sqrt{\pi} \delta}\right )} $$

For $\delta = 10^{-16}$, the number of terms needed is 13.

2) *Was Cauchy’s theorem really necessary?* Recall that we used Cauchy’s theorem to convert one integral into another. Fortunately, that second integral was much easier to evaluate. Could we have derived it using, say, a smart substitution instead?

I don’t really know the answer to this question. In hindsight, one might see that a substitution of $x=e^{i \pi/4} t$ would produce the integral times a factor. This, however, completely ignores questions about the branch of the square root in the integrand, and it would be difficult to deduce the correct factor as we did above. Using Cauchy’s theorem and the contour above, we were able to work out questions about branches and get the proper transformation of the integral. So, all in all, I feel pretty good that Cauchy’s theorem is not a case of swatting a fly with a golden hammer – in fact, it is the proper tool for the job.

As usual, RG, very clever and creative.

Integrals like this are usually tackled via Elliptics or Hypergeometrics. That is how I have seen this one commonly done. But even then the upper limit of integration of 2 causes a small issue. Your use of contours is original and downright ‘smarty pants’ :).

Cody

The integral \int_0^\infty dx/\sqrt{1+x^4} can be found quickly by making the substitution u=x^4 and then using the following form for the beta function:

B(m,n)=\int_0^\infty u^{m-1}du/(1+u)^{m+n}.

But still, it is interesting to see how it can also be done via contour integration!

Dear Ron,

I read your blog with great interest and amusement

How can I connect with you (e-mail or other means)? I would like to consult about one “tough” integral.

Kind regards, Ilyas.

ilyas: rlgordonma at yahoo dot com