I am trying to evaluate $\int_0^{\infty} \big ( \frac{\ln x}{x - 1}\big)^2dx $, where $\big ( \frac{\ln x}{x - 1} \big)^2 = f(x)$ with residues and complex analysis. Pole here is $x_0$ = 1 and it has second order. Contour is here.
We need to use $f(z)$ instead of $f(x)$ for complex integration and split start function $f(z)$ to 2 functions: $R(z)$ and $h(z)$, where $$R(z) = \frac{1}{(z-1)^2},$$ $$h(z) = \ln(z) + i\phi,0 <\phi < 2\pi.$$ - that was in my lectures notes.
So could you help me with next steps?
The function to be integrated (and any related function that will ultimately solve the problem) hates and wants to avoid the points $0,1$, so the pink contour would be a first guess to apply complex analysis (C.A. for short below):
Let $a$ be $a=2\pi i$. We quickly find a polynomial $P=P_a$, so that $P(X+a)-P(X)=X^2$, this is $$ P(X) = \frac 1{3a}\left(x^3-\frac 32ax^2+\frac 12a^2x\right) \ . $$ Then $$ \int_{\color{magenta}{\text{Pink contour}}} \frac {P(\ln z)}{(z-1)^2} =2\pi\; i\sum_{r\text{ Residue}}\operatorname{Res}_{z=r} \frac {P(\ln z)}{(z-1)^2} =0 \ . $$ Now we let $R$ go to $+\infty$.
The upper blue segment produces an integral of the shape $$\displaystyle \int_{0+\varepsilon}^\infty \frac{P(\ln x)}{(x-1)^2}\; dx\ , $$
then the semicircle does not contribute, since for $z=R e^{it}$ the numerator contributes with $\ln^3 R+O(1)$, the denominator is $O(R^{-2})$, the whole fraction is $\sim R^{-2}\ln R$, and the contour is in $O(R)$,
and finally the lower pink segment produces an integral of the shape $$\displaystyle \int_\infty^{0+\varepsilon} \frac{P(\ln x+2\pi i)}{(x-1)^2}\; dx\ , $$ if we succeed to push it beyond the holes.
Here i have to appologize for using $\ln$ for the real function $\log$, and also for the used branch of the logarithm, which is the reason for getting $\ln(x+2\pi i)$ by the monodromy of the logarithm when the contour comes back.
By the choice of $P$, the two integrals come together to build (up to sign) $$ \int_{0+\varepsilon}^\infty \frac{P(\ln x+2\pi i)-P(\ln x)}{(x-1)^2}\; dx = \int_{0+\varepsilon}^\infty \frac{x^2}{(x-1)^2}\; dx \ , $$ and this value comes then during "pushing" exactly from the holes in $0,1$. Let us compute the two contributions. Let $C(z_0,\varepsilon)$ the contour / the circle centered in $z_0\in\Bbb C$ with radius $\varepsilon>0$. Then using the substitution $z=z_0+\varepsilon e^{it}$, $t\in[0,2\pi]$, $$ \left| \int_{C(0,\varepsilon)} \frac {\ln^k z} {(z-1)^2}\; dz \right| \sim 2\pi\epsilon\cdot |\ln\varepsilon+O(1)|^k \in O(\varepsilon^{1/2}) $$ produces no contribution, and $$ \begin{aligned} \int_{C(1,\varepsilon)} \frac {\ln^k z} {(z-1)^2}\; dz &= \int_0^{2\pi} \frac {\displaystyle\ln^k(1+\varepsilon e^{it})} {\displaystyle(1+\varepsilon e^{it}-1)^2} \; i\varepsilon e^{it}\; dt \\ &= \int_0^{2\pi} \frac {\displaystyle \left( \frac 11\varepsilon e^{it} -\frac 12\varepsilon^2 e^{2it} +\frac 13\varepsilon^3 e^{3it} \pm\dots \right)^k} {\displaystyle \varepsilon^2 e^{2it}} \; i\varepsilon e^{it}\; dt \\ &\to \begin{cases} 2\pi i = a&\text{ for }k=1\ ,\\ 0&\text{ for }k\ge 2\ , \end{cases} \qquad \text{ when } \varepsilon\to0\ . \end{aligned} $$ The coefficient of $x$ in $P$ was $\frac a6$, so we get the contribution from $1$ in the form (well, computations were done up to sign) $$ \pm \frac 16a^2=\pm\frac 16(2\pi i)^2=\mp \color{blue}{\frac23\pi^2}\ . $$ (We are choosing the plus sign of course, the integral is built w.r.t. a positive function.)
$\color{red}\square$
Job done, but...
This method applies mot-a-mot to the integrals $$ \int_0^\infty \frac{\ln^4 x}{(x-1)^2}\; dx\ ,\qquad \int_0^\infty \frac{\ln^6 x}{(x-1)^2}\; dx\ ,\qquad \int_0^\infty \frac{\ln^8 x}{(x-1)^2}\; dx\ ,\qquad \dots $$ in the following way:
Numerical experiments.
Numerically, i prefer to compute the half value, $$ \begin{aligned} J(2n) &= \int_1^\infty \frac{\ln^{2n} x}{(x-1)^2}\; dx \qquad\text{ Substitution: } y=\frac{1}{x},\ x=\frac{1}{y},\ dx=-\frac 1{y^2}\; dy \\ &= \int_0^1 \frac{\ln^{2n} y}{(1-y)^2}\; dy =\frac 12\int_0^\infty \frac{\ln^{2n} x}{(x-1)^2}\; dx \ . \end{aligned} $$ Then the expected value of the integral is numerically validated:
Also for some two bigger values: