# Integrate $\frac{\log(x^2+4)}{(x^2+1)^2}$.

Using residue calculus show that $$\int_0^{\infty}\frac{\log(x^2+4)}{(x^2+1)^2}dx=\frac{\pi}2\log 3-\frac{\pi}6.$$

I was thinking of using some keyhole or semi-circular contour here. But the problem is apart from poles at $$x=-i$$ and $$x=i$$, the logarithm has singularities when $$x=\pm 4i$$.

I consider $$C_R$$, a semicircle contour oriented clockwise with radius $$R$$ centered at origin. The semicircle resides in the lower half plane, so that it encloses $$x=-i$$ as a pole. I set $$\int_{C_R} \frac{\log(2-ix)}{(x^2+1)^2}dx$$ But it seems like it leads to wrong answer.

• You moving in the right direction. Please note that the you have a second order pole (if you go clockwise - in the negative direction - and close the contour in the lower half-plane). $\int_{C_R} \frac{\log(2-ix)}{(x^2+1)^2}dx=-2\pi{i}Res\frac{\log(2-ix)}{(x^2+1)^2}|_{x=-i}=-2\pi{i}\frac{d}{dx}\frac{\log(2-ix)}{(x-i)^2}|_{x=-i}$. And then you have to take a real part of it and divide by 2 - to get the initial integral. – Svyatoslav Mar 7 at 12:45

Integrating $$\int_\gamma\frac{\log\left(z^2+4\right)}{\left(z^2+1\right)^2}\,\mathrm{d}z\tag1$$ along the contour

gives $$2\pi i$$ times the residue at $$z=i$$.

The integral along the curved pieces vanish as the radius of the large semi-circle grows to $$\infty$$.

The integral along the downward line along the right side of the imaginary axis to $$2i$$ (in red) is $$-i\int_2^\infty\frac{\log\left(x^2-4\right)+\pi i}{\left(x^2-1\right)^2}\,\mathrm{d}x\tag2$$ The integral along the upward line along the left side of the imaginary axis from $$2i$$ (in green) is $$i\int_2^\infty\frac{\log\left(x^2-4\right)-\pi i}{\left(x^2-1\right)^2}\,\mathrm{d}x\tag3$$ For $$z=ix$$ and $$x\gt2$$, we have one of $$\log\left(z^2+4\right)=\log\left(x^2-4\right)\pm\pi i$$. Integrating $$\frac1{z-2i}+\frac1{z+2i}$$ clockwise around $$2i$$ decreases $$\log\left(z^2+4\right)$$ by $$2\pi i$$. Thus, on the right side of the branch cut, we have $$\log\left(x^2-4\right)+\pi i$$, and on the left side, we have $$\log\left(x^2-4\right)-\pi i$$.

The sum of the integrals in $$(2)$$ and $$(3)$$ is $$2\pi\int_2^\infty\frac1{(x^2-1)^2}\,\mathrm{d}x=\frac\pi6(4-3\log(3))\tag4$$ The integral along the real axis (in blue) is $$2\int_0^\infty\frac{\log(x^2+4)}{(x^2+1)^2}\,\mathrm{d}x\tag5$$ Furthermore, $$2\pi i\operatorname*{Res}_{z=i}\left(\frac{\log(z^2+4)}{(z^2+1)^2}\right)=\frac\pi6(2+3\log(3))\tag6$$ Subtracting $$(4)$$ from $$(6)$$ and dividing by $$2$$ gives $$\int_0^\infty\frac{\log(x^2+4)}{(x^2+1)^2}\,\mathrm{d}x=\frac\pi2\log(3)-\frac\pi6\tag7$$

• Very nice presentation. (+1) – Markus Scheuer Mar 8 at 19:02
• @MarkusScheuer: thanks! I have added a description of how $\log\left(z^2+4\right)$ behaves near the branch cut – robjohn Mar 8 at 21:31

One thing you could do to avoid a keyhole is to denote

$$I[a] = \int_0^\infty \frac{\log\left(a(x^2+1)+3\right)}{(x^2+1)^2}\:dx \implies I'[a] = \frac{1}{2}\int_{-\infty}^\infty \frac{1}{x^2+1}\cdot \frac{1}{ax^2+a+3}\:dx$$

then apply a semicircular contour and calculate the residues as normal.