A logarithmic sine integral via a keyhole contour
Integrals on \((0, \infty)\) containing \(\sin(\ln x)\) or \(\cos(\ln x)\) are the imaginary and real parts of \(\int_0^\infty x^i R(x)\,dx\), since \(x^i = e^{i\ln x} = \cos(\ln x) + i\sin(\ln x)\). By placing a keyhole branch cut along the negative real axis \((-\infty, 0]\) for an even rational function \(R(z)\), the integrals along the upper and lower banks of the cut both fold onto \((0, \infty)\) with different constant factors \(e^{-\pi}\) and \(e^{\pi}\). We will use this method to prove
The keyhole contour
Consider the function
where the branch of the logarithm is chosen with \(-\pi < \arg z \leq \pi\), so the branch cut lies along the negative real axis \((-\infty, 0]\). We integrate \(f(z)\) around the positively oriented keyhole contour shown below:
Here \(C_R\) is a large circle of radius \(R > 2\) and \(C_\epsilon\) is a small semicircle of radius \(\epsilon < 2\), both centered at the origin. On the circle \(|z| = r\), we have \(\left|e^{i\log z}\right| = e^{-\arg z} \leq e^\pi\), so
Thus, in the limits \(R \to \infty\) and \(\epsilon \to 0^+\), only the two horizontal segments just above and just below the negative real axis contribute to the contour integral.
Computing the residues at \(\pm 2i\)
Inside the contour, \(f(z)\) has simple poles at \(z = 2i\) and \(z = -2i\). Using the branch \(-\pi < \arg z \leq \pi\), we have \(\log(2i) = \ln 2 + i\frac{\pi}{2}\) and \(\log(-2i) = \ln 2 - i\frac{\pi}{2}\). Hence,
and similarly,
Evaluating the integral along the branch cut
On the upper bank of the negative real axis (traversed from \(-\infty\) to \(0\)), \(\arg z = +\pi\), so \(\log z = \ln|x| + i\pi\) and \(e^{i\log z} = e^{-\pi}e^{i\ln|x|}\). On the lower bank (traversed from \(0\) to \(-\infty\)), \(\arg z = -\pi\), so \(\log z = \ln|x| - i\pi\) and \(e^{i\log z} = e^{\pi}e^{i\ln|x|}\). Substituting \(t = -x > 0\) (and relabeling \(t\) as \(x\)) on both banks, the residue theorem gives
Using the double-angle identity \(\sinh(\pi) = 2\sinh\left(\frac{\pi}{2}\right)\cosh\left(\frac{\pi}{2}\right)\) to simplify the ratio of hyperbolic sines, we obtain
Taking the imaginary part of both sides yields the desired evaluation:
Equating the real parts simultaneously gives the companion cosine integral: