I have been recently trying to review some topics on improper integrals. The Integral I am trying to solve is:
$$
\int_0^\infty {log(x) \over x^2 -1} dx
$$
The branch cut of the $log(x)$ is excluded by rotating the red line by an infinitesimal angle M. The origin and the pole on the real axis are both excluded by going around them. I have denoted the semicircle around the origin with $S_{\epsilon}$ and the other semicircle around the pole at 1 with $S_\delta$. The large semicircle is $S_R$. $\epsilon$, $\delta$ and $R$ are the corresponding radii. On the described contour $\Gamma$ the integral should vanish. The integral is
$$ \int_\Gamma {log(x) \over x^2 -1} dx = \int_R^\epsilon {log(re^{i\pi})e^{i\pi} \over r^2 -1} dr + \int_\pi^0 {log(\epsilon e^{i\phi})\epsilon e^{i\phi} \over (\epsilon e^{i\phi})^2 -1} d\phi + \int_\epsilon^{1-\delta} {log(r) \over r^2 -1} dr + \int_\pi^0 {log(\delta e^{i\phi})\delta e^{i\phi} \over (\delta e^{i\phi})^2 -1} d\phi + \int_{1+\delta}^R {log(r) \over r^2 -1} dr + \int_\epsilon^{1-\delta} {log(r) \over r^2 -1} dr + \int_0^\pi {log(R e^{i\phi})R e^{i\phi} \over (R e^{i\phi})^2 -1} d\phi = 0 $$
Taking the limits $R \to \infty$, $\delta \to 0$ and $\epsilon \to 0$, the integrals over the semicircles $S_{\epsilon}$ , $S_\delta$ and $S_R$ vanish. Therefore we are left with:
$$ \int_0^\infty {log(r)+i\pi \over r^2-1}dr + \int_0^\infty {log(r) \over r^2-1}dr=2\int_0^\infty {log(r) \over r^2-1}dr+\int_0^\infty {i\pi \over r^2-1}dr = 0 $$
The last integral is divergent (Mathematica), however, again according to Mathematica the answer to my question is $\pi^2 \over 4$. I have tried to calculate the last integral by using the same contour as before without the indent contour $S_\epsilon$ around zero and including only the pole at $r=1$ with factor $\frac12$. This second contour I have denoted by $\gamma$. If I had tried to go a full half circle, I would have had both poles at $r=1$ and $r=-1$ included and the residue theorem would have given me zero. Therefore I have excluded one of them by the wedge and obtained $$ \int_\gamma {i\pi \over r^2-1}dr = \int_R^0 {i\pi e^{i\pi} \over r^2-1}dr + \int_0^R {i\pi \over r^2-1}dr = 2 \int_0^\infty {i\pi \over r^2-1}dr =i \pi Res({i\pi \over r^2-1},r=1) $$ Evaluating the residue I have obtained precisely $-{\pi^2 \over 2}$. Is this selection of contour allowed? Dropping one pole and keeping the other? Is the selection of the integration contour that arbitrary? I always have such moments doubt. This is why I would appreciate any ideas or comments.
Thanks, Alex