# Integration of $\ln$ around a keyhole contour

I want to evaluate the following integral: $$\int_{0}^{\infty}\frac{\ln^2 x}{x^2-x+1}{\rm d}x$$

I use the following contour in order to integrate.

I considered the function $\displaystyle f(z)=\frac{\ln^3 z}{z^2-z+1}$. The poles of the function are $\displaystyle z_1=\frac{1+i\sqrt{3}}{2}, \; z_2=\frac{1-i\sqrt{3}}{2}$ and these are simple poles. I evaluated the residues $\displaystyle \mathfrak{Res}(z_1)=\mathfrak{Res}(z_2)=-\frac{i\pi^2}{9\sqrt{3}}$.

If we declare $\gamma$ the entire contour , we have that: $$\oint_{\gamma}f(z)\,dz=2\pi i \sum res=2\pi i \left ( -\frac{2i\pi^2}{9\sqrt{3}} \right )=\frac{4\pi^3}{9\sqrt{3}}$$

I splitted the contour apart and I got: $$\oint_{\gamma}f(z)\,dz=\int_{C_r}+\int_{S_1}+\int_{C_\epsilon }+\int_{S_2}$$

where $S_1$ is the segment from $R$ to $\epsilon$ and $S_2$ is the segment from $\epsilon$ to $R$. I proved that the other two line integrals vanish when $R\rightarrow +\infty, \epsilon \rightarrow 0$ respectively.

And this is where I get stuck. Well, letting $R \rightarrow +\infty$ this gives me that: $$\int_{\gamma}f(z)\,dz=\int_{\infty}^{0}f(z)\,dz+\int_{0}^{\infty}f(z)\,dz=\int_{0}^{\infty}-\int_{0}^{\infty}$$

I set $z=-x-i\epsilon$ at the second one and at the first one $z=-x+i\epsilon$ but I cannot seem to finish up the problem and get the correct result.

On $S_2$ you get $$\int_0^\infty \frac{\ln^3 x}{x^2-x+1}\,dx$$ and on $S_1$ $$-\int_0^\infty \frac{(\ln x + 2\pi i)^3}{x^2-x+1}\,dx.$$ Adding the two you get $$\int_0^\infty \frac{-6\pi i\ln^2 x + 4\pi^2\ln x + 8\pi^3 i}{x^2-x+1}\,dx.$$ Take the imaginary part, and all you have to do to finish things off is to compute $$\int_0^\infty \frac{1}{x^2-x+1}\,dx$$ either with freshman calculus techniques or using residues if you prefer.
• Why take the imaginery part? And why on $S_2$ I get that $2\pi i$? Is it because of the difference between the branches? – Tolaso Jan 10 '15 at 8:50
• The $2\pi i$ is from the branch cut, yes. The argument on the "lower side" of the real axis is $2\pi$. Taking the imaginary part gets rid of the $\ln x/(x^2-x+1)$ term. Your residues seem off. (Did you remember to take the correct branch when computing them?) – mrf Jan 10 '15 at 9:50
• I am belatedly learning contour integration so correct me: In order to apply the Cauchy theorem on enclosed poles, you need a connected complex manifold without essential singularities. In order to do this, you need to have Riemann's spiral manifold where the "vertical axis" is accumulated turns/angle. When you made the turn at the origin you proceeded to travel back around the spiral and the tangent line was going the other direction;i.e. +2$\pi$i . If you take this into account you have a non-zero round trip because the phase is different. It all follows from Cauchy. – rrogers Aug 18 '16 at 20:52