There are a lot of integrals posted at Math.SE. I attempt to evaluate quite a few of them. Many times, I fail spectacularly; you will typically not hear of those because I feel there is nothing to say. Occasionally, I succeed; of course, you will hear about those because I post and then post again here (when I remember). When I do post, sometimes it gets ignored (some of my best work got zero upvotes, or maybe one or two). Sometimes my posts get a lot of love. And then there’s the integral I evaluated the other day, courtesy of Laila Podlesny, who occasionally posts some hard integrals for us to evaluate.

I don’t normally comment on personal stuff, but I feel compelled here. For some weird reason that I do not yet fathom, the question has generated as of this writing over 10,000 views, and my answer got 102 upvotes, far more than anything I obtained before. I hope to learn what has been driving the enthusiasm here, but I certainly am not complaining. Anyway, without further ado, here is the problem and solution.

The problem is to evaluate the following integral:

$$I=\int_{-1}^1 dx \frac1x\sqrt{\frac{1+x}{1-x}}\ln\left(\frac{2\,x^2+2\,x+1}{2\,x^2-2\,x+1}\right)$$

Note the integrable singularity at $x=1$ and the removable singularity at $x=0$. I will show that the integral has a closed form, which is $4 \pi \text{arccot}{\sqrt{\phi}}$, where $\phi$ is the golden ratio.

I will transform the integral via a substitution, break it up into two pieces and recombine, perform an integration by parts, and perform another substitution to get an integral to which I know a closed form exists. From there, I use a method I know to attack the integral, but in an unusual way because of the 8th degree polynomial in the denominator of the integrand.

First sub $t=(1-x)/(1+x)$, $dt=-2/(1+x)^2 dx$ to get

$$2 \int_0^{\infty} dt \frac{t^{-1/2}}{1-t^2} \log{\left (\frac{5-2 t+t^2}{1-2 t +5 t^2} \right )} $$

Now use the symmetry from the map $t \mapsto 1/t$. Break the integral up into two as follows:

$$2 \int_0^{1} dt \frac{t^{-1/2}}{1-t^2} \log{\left (\frac{5-2 t+t^2}{1-2 t +5 t^2} \right )} + 2 \int_1^{\infty} dt \frac{t^{-1/2}}{1-t^2} \log{\left (\frac{5-2 t+t^2}{1-2 t +5 t^2} \right )} \\ = 2 \int_0^{1} dt \frac{t^{-1/2}}{1-t^2} \log{\left (\frac{5-2 t+t^2}{1-2 t +5 t^2} \right )} + 2 \int_0^{1} dt \frac{t^{1/2}}{1-t^2} \log{\left (\frac{5-2 t+t^2}{1-2 t +5 t^2} \right )} \\ = 2 \int_0^{1} dt \frac{t^{-1/2}}{1-t} \log{\left (\frac{5-2 t+t^2}{1-2 t +5 t^2} \right )}$$

Sub $t=u^2$ to get

$$4 \int_0^{1} \frac{du}{1-u^2} \log{\left (\frac{5-2 u^2+u^4}{1-2 u^2 +5 u^4} \right )}$$

Integrate by parts:

$$\left [2 \log{\left (\frac{1+u}{1-u} \right )} \log{\left (\frac{5-2 u^2+u^4}{1-2 u^2 +5 u^4} \right )}\right ]_0^1 \\- 32 \int_0^1 du \frac{\left(u^5-6 u^3+u\right)}{\left(u^4-2 u^2+5\right) \left(5 u^4-2 u^2+1\right)} \log{\left (\frac{1+u}{1-u} \right )}$$

One last sub: $u=(v-1)/(v+1)$ $du=2/(v+1)^2 dv$, and finally get

$$8 \int_0^{\infty} dv \frac{(v^2-1)(v^4-6 v^2+1)}{v^8+4 v^6+70v^4+4 v^2+1} \log{v}$$

With this form, we may finally conclude that a closed form exists and apply the residue theorem to obtain it. To wit, consider the following contour integral:

$$\oint_C dz \frac{8 (z^2-1)(z^4-6 z^2+1)}{z^8+4 z^6+70z^4+4 z^2+1} \log^2{z}$$

where $C$ is a keyhole contour about the positive real axis. This contour integral is equal to (I omit the steps where I show the integral vanishes about the circular arcs)

$$-i 4 \pi \int_0^{\infty} dv \frac{8 (v^2-1)(v^4-6 v^2+1)}{v^8+4 v^6+70v^4+4 v^2+1} \log{v} + 4 \pi^2 \int_0^{\infty} dv \frac{8 (v^2-1)(v^4-6 v^2+1)}{v^8+4 v^6+70v^4+4 v^2+1}$$

It should be noted that the second integral vanishes; this may be easily seen by exploiting the symmetry about $v \mapsto 1/v$.

On the other hand, the contour integral is $i 2 \pi$ times the sum of the residues about the poles of the integrand. In general, this requires us to find the zeroes of the eight degree polynomial, which may not be possible analytically. Here, on the other hand, we have many symmetries to exploit, e.g., if $a$ is a root, then $1/a$ is a root, $-a$ is a root, and $\bar{a}$ is a root. For example, we may deduce that

$$z^8+4 z^6+70z^4+4 z^2+1 = (z^4+4 z^3+10 z^2+4 z+1) (z^4-4 z^3+10 z^2-4 z+1)$$

which exploits the $a \mapsto -a$ symmetry. Now write

$$z^4+4 z^3+10 z^2+4 z+1 = (z-a)(z-\bar{a})\left (z-\frac{1}{a}\right )\left (z-\frac{1}{\bar{a}}\right )$$

Write $a=r e^{i \theta}$ and get the following equations:

$$\left ( r+\frac{1}{r}\right ) \cos{\theta}=-2$$

$$\left (r^2+\frac{1}{r^2}\right) + 4 \cos^2{\theta}=10$$

From these equations, one may deduce that a solution is $r=\phi+\sqrt{\phi}$ and $\cos{\theta}=1/\phi$, where $\phi=(1+\sqrt{5})/2$ is the golden ratio. Thus the poles take the form

$$z_k = \pm \left (\phi\pm\sqrt{\phi}\right) e^{\pm i \arctan{\sqrt{\phi}}}$$

Now we have to find the residues of the integrand at these 8 poles. We can break this task up by computing:

$$\sum_{k=1}^8 \operatorname*{Res}_{z=z_k} \left [\frac{8 (z^2-1)(z^4-6 z^2+1) \log^2{z}}{z^8+4 z^6+70z^4+4 z^2+1}\right ]=\sum_{k=1}^8 \operatorname*{Res}_{z=z_k} \left [\frac{8 (z^2-1)(z^4-6 z^2+1)}{z^8+4 z^6+70z^4+4 z^2+1}\right ] \log^2{z_k}$$

Here things got very messy, but the result is rather unbelievably simple:

$$\operatorname*{Res}_{z=z_k} \left [\frac{8 (z^2-1)(z^4-6 z^2+1)}{z^8+4 z^6+70z^4+4 z^2+1}\right ] = \text{sgn}[\cos{(\arg{z_k})}]$$

That is, if the pole has a positive real part, the residue of the fraction is $+1$; if it has a negative real part, the residue is $-1$.

Now consider the log piece. Expanding the square, we get 3 terms:

$$\log^2{|z_k|} – (\arg{z_k})^2 + i 2 \log{|z_k|} \arg{z_k}$$

Summing over the residues, we find that because of the $\pm1$ contributions above, that the first and third terms sum to zero. This leaves the second term. For this, it is crucial that we get the arguments right, as $\arg{z_k} \in [0,2 \pi)$. Thus, we have

$$\begin{align}I= \int_0^{\infty} dv \frac{8 (v^2-1)(v^4-6 v^2+1)}{v^8+4 v^6+70v^4+4 v^2+1} \log{v} &= \frac12 \sum_{k=1}^8 \text{sgn}[\cos{(\arg{z_k})}] (\arg{z_k})^2 \\ &= \frac12 [2 (\arctan{\sqrt{\phi}})^2 + 2 (2 \pi – \arctan{\sqrt{\phi}})^2 \\ &- 2 (\pi – \arctan{\sqrt{\phi}})^2 – 2 (\pi + \arctan{\sqrt{\phi}})^2]\\ &= 2 \pi^2 -4 \pi \arctan{\sqrt{\phi}} \\ &= 4 \pi \, \text{arccot}{\sqrt{\phi}}\\\end{align}$$

which is what we wanted to show.

There is a generalization of course, which integral wizard s0s440 pointed out:

$$ I(r, s) = \int_{-1}^{1} dx \frac{1}{x}\sqrt{\frac{1+x}{1-x}} \log \left( \frac{(r-1)x^{2} + sx + 1}{(r-1)x^{2} – sx + 1} \right) = 4 \pi \operatorname{arccot} \sqrt{ \frac{2r + 2\sqrt{r^{2} – s^{2}}}{s^{2}} – 1} $$

which may easily be shown (OK, not that easily) using the methods outline above.

It got so much attention because it was posted on Reddit with the title “Master of Integration”:

http://www.reddit.com/r/math/comments/1qpus4/master_of_integration/

A lot of people, including me, can read and understand the individual steps but can only marvel at how one can be so skilled in integrating to be able to come up with this solution. It seems to me like it requires an intuition about which steps to take, which substitutions to perform, etc, far beyond what many of us could ever hope to achieve.

Mark,

Thank you so much for that – that solves a big mystery for me! I was wondering how on earth this particular one got so many page views. Not that I am complaining, of course.

As far as how I got there, the solution took me about 12 hours of effort. There was a lot of stumbling around and compromise – I think there has to be a simpler way because of all the symmetry. Anyway, I do have particular tools that I like to use, and for me, the puzzle of integration is one of transformation of an integral into a form that you can deal with via, e.g., the residue theorem. In this case, an integral of the form f(x) log(x) from 0 to infinity would do nicely, but it took a lot of work to get there. Once I got there, and I saw the x -> 1/x symmetry, I knew I had a winner.

I really hope that I have given people some new tricks for evaluating monster integrals. I do this for relaxation, believe it or not, the way some people do crossword puzzles. It’s really great to come to a simple solution to an eye-popping integral like this; it makes it even better when folks like you appreciate what I’ve done.

Thanks Ron.

When you say “I do have particular tools that I like to use”, do you mean tools like Maple and Mathematica? Or mathematical “tools” like the residue theorem?

If you do only use pen and paper, I’d be curious to know how many pages of scribbling (including attempts that led nowhere) this took.

I do believe you that you do this as relaxation, I like to do IMO problems myself. But only the combinatorics ones, as you can do those almost 100% in your head, no need to “calculate” much, very low chance of mistakes. I highly doubt one can solve integrals like this in one’s head.

Mark,

By “tools”, I mean the residue theorem, Plancherel/Parseval and other transform techniques, differentiation under the integral, etc etc. I have a copy of Mathematica which I use to check my results. But I only post stuff that I have worked out by hand, period. The whole point of the exercise is to understand the mathematics, not impress people with some result. (Thankfully people seem impressed with the steps; that makes me very happy.) How many pages was that one? No idea, perhaps half a pad of paper? Lots of x’s, scribbles,…my thesis advisor taught me to work in pen so I could see all of my mistakes. Best advice ever. (Meanwhile, my son’s teacher threatened to take marks off for using pen. Words will be exchanged on that.) But another major part of all of this is communicating the result. This takes time, too, and is really important; otherwise, your effort is for naught. So I invested a lot of my own free time in posting that result. And believe me, I am very OK with it. Reading that Reddit page was very surreal – but very nice that at least one person learned something from the whole mish-mash. Good stuff.

You are indeed a genius, RG. Your incredible skill with contours is amazing. I could never learn to do that if I live to be a thousand. 🙂

Cody

Hey Cody. Have more faith in yourself than that.

Probably the most ridiculous post! In a good way of course 🙂 Congrats! I think one can generate an interesting book from the answers you have posted with (integration) tag. It would be called “Ron’s Integration Powers”.

Ron, long time reader first time commenter. I do not understand the step where you consider the symmetry from the map t to 1/t, and have seen you use it quite often. Do you have any useful links to understand this I tried good old google but only get integration of odd and even functions. Thank you for Igniting a passion to solve integrals and learn complex analysis a month before beginning an introductory course at university.

bryce, you are very welcome. I am so glad to have played some sort of role in your learning; I hope you yourself can inspire others. Anyway, to answer your question, I do not have a good reference. It’s one of those things I am sure is common but is not widely taught. The map t -> 1/t is used to change an interval of integration from [1,Infinity) to (0,1). In our case, we had [0,Infinity], which I split into [0,1] + [1,Infinity). Then I applied the transformation to the integral over (1,Infinity) to get two integrals over [0,1]. I was lucky to see that the integrals then combined to make a single, simple integral. Complex analysis merely makes the set of forms we can evaluate that much bigger; it is the most beautiful subject in my opinion, enjoy!