Evaluating $\int\limits_0^\infty \frac{\log x} {(1+x^2)^2} dx$ with residue theory
I need a little help with this question, please!
I have to evaluate the real convergent improper integrals using RESIDUE THEORY (vital that I use this), using the following contour:
$$\int\limits_0^\infty \frac{\log x} {(1+x^2)^2} dx$$
Using this contour:
$R>1$ and $r<1$
I'll give my humble idea to show the integral is $-\dfrac{\pi}{4}$.
With a change of variables ($x=e^u$) we have that
$$\mathcal{I}=\int\limits_0^\infty {\frac{{\log x}}{{{{\left( {1 + {x^2}} \right)}^2}}}dx = } \int\limits_{ - \infty }^\infty {\frac{{u{e^u}}}{{{{\left( {1 + {e^{2u}}} \right)}^2}}}du} $$
We can write this as
$${\mathcal I} = \int\limits_{ - \infty }^\infty {\frac{{u{e^{ - u}}}}{{{{\left( {{e^{ - u}} + {e^u}} \right)}^2}}}du} $$
Putting $u=-v$ we have that
$${\mathcal I} = \int\limits_{ - \infty }^\infty {\frac{{u{e^{ - u}}}}{{{{\left( {{e^{ - u}} + {e^u}} \right)}^2}}}du} = -\int\limits_{ - \infty }^\infty {\frac{{v{e^v}}}{{{{\left( {{e^{ - v}} + {e^v}} \right)}^2}}}dv} $$
This means that
$$2I = 2\int\limits_0^\infty {\frac{{\log x}}{{{{\left( {1 + {x^2}} \right)}^2}}}dx = } \int\limits_{ - \infty }^\infty {\frac{{u\left( {{e^{ - u}} - {e^u}} \right)}}{{{{\left( {{e^u} + {e^{ - u}}} \right)}^2}}}du} $$
We can write this in terms of the hiperbolic functions, to get
$$2I = 2\int\limits_0^\infty {\frac{{\log x}}{{{{\left( {1 + {x^2}} \right)}^2}}}dx = } - \frac{1}{2}\int\limits_{ - \infty }^\infty {\frac{{u\sinh u}}{{\cosh^2 u}}du} $$
Integration by parts gives ($(\operatorname{sech} u)'=-\dfrac{{\sinh u}}{{\cosh^2 u}}$)
$$ - \int\limits_{ - \infty }^\infty {\frac{{\sinh udu}}{{{{\cosh }^2}u}}} = \left[ {u\operatorname{sech} u} \right]_{ - \infty }^\infty - \int\limits_{ - \infty }^\infty {\frac{{du}}{{\cosh u}}} $$
Finally, you can easily check that
$$\int\limits_{ - \infty }^\infty {\frac{{du}}{{\cosh u}}} = \pi $$
and that $u \operatorname{sech} u$ is odd so the first term in the RHS is zero. Thus
$$\eqalign{ & 2I = 2\int\limits_0^\infty {\frac{{\log x}}{{{{\left( {1 + {x^2}} \right)}^2}}}dx = } - \frac{\pi }{2} \cr & I = \int\limits_0^\infty {\frac{{\log x}}{{{{\left( {1 + {x^2}} \right)}^2}}}dx = } - \frac{\pi }{4} \cr} $$
Calling $\sigma$ the contour you drew, i.e. a big arc of radius $R$, a small arc of radius $r$ connected by two segments, let the angle subtended by the arcs approach $2\pi$ from below, so that the two segments are just above and below the positive real axis. Choosing the branch cut of the logarithm on the positive real axis, by the residue theorem we have $$ \oint_\sigma \frac{\ln^2 z}{(1+z^2)^2}dz=i2\pi \left(\text{Res}\frac{\ln^2z}{(1+z^2)^2}\Big|_{z=e^{i\pi/2}}+\text{Res}\frac{\ln^2z}{(1+z^2)^2}\Big|_{z=e^{i3\pi/2}}\right); $$ note that we wrote $i={e^{i\pi/2}}$ and $-i=e^{i3\pi/2}$ according to the chosen branch cut. Using the formula for the second order pole residue: $$ f(z) = \frac{\ln^2z}{(1+z^2)^2}=\frac{\ln^2z}{(z+i)^2(z-i)^2} $$ $$ \frac{d}{dz}\left[f(z)(z-i)^2\right]=2\ln z\frac{(z+i)-z\ln z}{z(z+i)^3}=\Big|_{z=e^{i\pi/2}}i\frac{\pi}{8}\left(\frac{\pi}{2}+2i\right) $$ $$ \frac{d}{dz}\left[f(z)(z+i)^2\right]=2\ln z\frac{(z-i)-z\ln z}{z(z-i)^3} =\Big|_{z=e^{i3\pi/2}}-i\frac{3\pi}{8}\left(\frac{3\pi}{2}+2i\right) $$ so that $$ \oint_\sigma \frac{\ln^2 z}{(1+z^2)^2}dz=i2\pi\left[ i\frac{\pi}{8}\left(\frac{\pi}{2}+2i\right) -i\frac{3\pi}{8}\left(\frac{3\pi}{2}+2i\right) \right]=\pi^3+i\pi^2. $$
Now, the integral on the big circle vanishes as $R\to\infty$, since the integrand falls off as $\ln^2 R/(1/R^2)^2$, and the integral on the small circle vanishes as $r\to0$ since the $r$ coming from the line element cancels the $\ln^2r$ singularity: explicitly $$ \left|\int_\Gamma \frac{\ln^2z}{(1+z^2)^2}dz\right|\le\int_{0}^{2\pi}\frac{|\ln R + i\varphi|^2}{|1+R^2|^2}Rd\varphi\le\text{const}\times R^{-3}\xrightarrow[R\to\infty]{}0, $$ $$ \int_\gamma \frac{\ln^2z}{(1+z^2)^2}dz= \int_{0}^{2\pi}\frac{(\ln r + i\varphi)^2}{(1+re^{i2\pi})^2}ie^{i\varphi}rd\varphi\xrightarrow[r\to0]{}0. $$ Therefore, in such limits, $$ \pi^3+i\pi^2 = \int_0^{+\infty}\frac{\ln^2x}{(1+x^2)^2}dx-\int_{0}^{+\infty}\frac{(\ln x+i2\pi)^2}{(1+x^2)^2}dx \\= -i4\pi\int_{0}^{+\infty}\frac{\ln x}{(1+x^2)^2}dx+4\pi^2\int_{0}^{+\infty}\frac{1}{(1+x^2)^2}dx. $$ Comparing real and imaginary parts \begin{align} \int_{0}^{+\infty}\frac{dx}{(1+x^2)^2} &= \frac{\pi}{4}\qquad (\star)\\ \int_{0}^{+\infty}\frac{\ln x}{(1+x^2)^2}dx&=-\frac{\pi}{4}.\qquad (\star) \end{align} Willing to use only the pole in the upper-half plane, one can proceed as follows: let the angle in the contour you drew approach $\pi$, which gives us $$ \int_{0}^{+\infty}\frac{\ln x}{(1+x^2)^2}dx - \int_{0}^{+\infty}\frac{\ln x +i\pi}{(1+x^2)^2}e^{i\pi}dx=i2\pi \left[i\frac{\pi}{8}\left(\frac{\pi}{2}+2i\right)\right] $$ or $$ 2\int_{0}^{+\infty}\frac{\ln x}{(1+x^2)^2}dx+i\pi \int_0^{+\infty}\frac{1}{(1+x^2)^2}dx=-\frac{\pi}{2}+i\frac{\pi^2}{4}; $$ again, confrontation leads to $(\star)$.
One can avoid computing the annoying double poles and reduce the argument to simple poles at the price of computing a derivative: $$ \int_0^{+\infty}\frac{\ln x}{(1+x^2)^2}dx=-\frac{1}{2}\frac{d}{da}\left(\int_0^{+\infty}\frac{\ln x}{a^2+x^2}dx\right)_{a=1}; $$ now, in the same spirit as above, for an indented half-circle contour in the upper-half plane $$ \int_0^{+\infty}\frac{\ln x}{a^2+x^2}dx-\int_0^{+\infty}\frac{\ln x+i\pi}{a^2+x^2}e^{i\pi}dx=\frac{\pi}{a}\ln a+i\frac{\pi^2}{2a} $$ hence, real and imaginary parts give: $$ \int_0^{+\infty}\frac{\ln x}{x^2+a^2}dx=\frac{\pi}{2a}\ln a\\ \int_0^{+\infty}\frac{dx}{a^2+x^2}=\frac{\pi}{2a}. $$ Performing the above derivative calculated at $a=1$, one recovers the desired results $(\star)$.
It is very interesting that this problem can be solved just by a few lines using substitution without using residue theory. Let the integral be $$ I = \int_0^{+\infty}\frac{\ln x}{(1+x^2)^2} $$ and let $$ J(a)=-\frac{1}{2}\int_0^\infty\frac{\log x}{x^2+a^2}dx. $$ Clearly $I=-J'(1)$. Using $x=au$, one has \begin{eqnarray} J(a)&=&-\frac{1}{2a}\int_0^\infty\frac{\log a+\log x}{x^2+1}dx\\ &=&-\frac{\log a}{2a}\int_0^\infty\frac{1}{x^2+1}dx-\frac{1}{2a}\int_0^\infty\frac{\log x}{x^2+1}dx\\ &=&-\frac{\pi\log a}{4a}. \end{eqnarray} Here we used the fact that $$ \int_0^\infty\frac{\log x}{x^2+1}dx=0,$$ and $$ \int_0^{\infty}\frac{1}{1+x^2}dx = \frac{\pi}{2}. $$ Now $$ I=\frac{d}{da}\frac{\pi\log a}{4a}\bigg|_{a=1}=-\frac{\pi}{4}.$$