# Evaluating $\int_{0}^{\infty}\frac{\ln\left(x\right)\left(e^{-x}-\cos x\right)}{x}dx$

From here after the partial fractions in the question :

$$I = \int_{0}^{\infty}\frac{\ln\left(x\right)\left(e^{-x}-\cos x\right)}{x}dx$$

I tried this via contour integration but ran into some problems with the choice of contours and the convergence of the circular arcs. I'm not sure if I need a branch cut yet, but that doesn't affect this integral. Going anticlockwise and having $$z=Re^{i\theta}$$ :

\begin{align}\int_{\Gamma}&=\int_{0}^{\pi}{\frac{\ln(Re^{i\theta})(e^{-Re^{i\theta}}-e^{iRe^{i\theta}})}{Re^{i\theta}}iRe^{i\theta}\, d\theta}\\&=i\int_{0}^{\pi}(\ln(R)+i\theta)(e^{-Re^{i\theta}}-e^{iRe^{i\theta}})\,d\theta\end{align}

But I don't think this converges given $$R\to\infty$$. Should a different contour be used or can this be continued?

• As a little start, the modulus of the integrand in question is unbounded in the second, third, and fourth quadrants of the complex plane except for the first quadrant. What this means is that you can use a contour shaped like 1/4th of a donut in the first quadrant and safely make its outer circumference's radius infinitely large. This should work with the principal branch of the logarithm. Aug 16, 2023 at 22:02
• And by integrand, I mean $\frac{\log(z)\left(e^{-z}-e^{iz}\right)}{z}$ which you seem to have used for that $\Gamma$ integral. Aug 16, 2023 at 22:39

By Frullani's theorem $$\ln(b)=\int_{0}^{+\infty}\frac{e^{-x}-e^{-bx}}{x}\,dx \tag{1}$$ holds for any $$b\in\mathbb{C}$$ in the right half-plane ($$\operatorname{Re}(b)>0$$). Under the same assumptions, the slight generalization $$\Gamma(k)\left(1-\frac{1}{b^k}\right) = \int_{0}^{+\infty} x^k\frac{e^{-x}-e^{-bx}}{x}\,dx \tag{2}$$ holds for any $$k>0$$. By differentiating both sides of $$(2)$$ with respect to $$k$$, then considering the limit as $$k\to 0^+$$, $$-\frac{1}{2}\ln(b)(2\gamma+\ln(b)) = \int_{0}^{+\infty}\ln(x)\frac{e^{-x}-e^{-bx}}{x}\,dx. \tag{3}$$ By considering the limit of both sides when $$b$$ approaches $$i$$ from the right half-plane we get $$\int_{0}^{+\infty}\ln(x)\frac{e^{-x}-e^{-ix}}{x}\,dx = \frac{\pi^2}{8}-\frac{\pi i}{2}\gamma \tag{4}$$ and finally, by considering the real parts of both sides, $$\int_{0}^{+\infty}\ln(x)\frac{e^{-x}-\cos x}{x}\,dx = \frac{\pi^2}{8}.\tag{5}$$ As usual, the properties of the (inverse) Laplace transform allow us to avoid the hunt for a suitable contour.
If you use the complex integration, it is convenient to consider the integrand $$\displaystyle f(z)=\ln z\,\frac{e^{-z}-e^{iz}}z$$ and closed contour $$r\to R\to iR \,(\text{along the arch of a big radius R, counter-clockwise})$$ $$\to ir\to r\,(\text{along the arch of a small radius r, clockwise})$$ and the cut along the positive part of the axis X (to make $$\ln z$$ a single-valued function). We stay on the upper bank of the cut.
Denoting the integral along the arches as $$I_{C_R}$$ and $$I_{C_r}$$, $$\oint f(z)dz=\int_r^R\ln x\,\frac{e^{-x}-e^{ix}}xdx+I_{C_R}+\int_{iR}^{ir}\ln x\,\frac{e^{-x}-e^{ix}}xdx+I_{C_r}=0$$ because we do not have poles inside the contour. Using $$\,\displaystyle x=e^\frac{\pi i}2t\,$$ for the second integral, $$\int_r^R\ln x\,\frac{e^{-x}-e^{ix}}xdx+\int_r^R\ln x\,\frac{e^{-x}-e^{-ix}}xdx=2\int_r^R\ln x\,\frac{e^{-x}-\cos x}xdx$$ $$=\frac{\pi i}2\int_r^R\frac{e^{-ix}-e^{-x}}xdx-I_{C_R}-I_{C_r}$$ Integral along small and big arches tend to zero.
Indeed, $$I_{C_r}=\int_0^{\pi/2}\ln(re^{i\phi})\frac{e^{-re^{i\phi}}-e^{ire^{i\phi}}}{re^{i\phi}}ire^{i\phi}d\phi=O(r\ln r)\to0 \,\text{at}\,r\to0$$ $$I_{C_R}=\int_0^{\pi/2}\ln(Re^{i\phi})\frac{e^{-Re^{i\phi}}-e^{iRe^{i\phi}}}{Re^{i\phi}}iRe^{i\phi}d\phi=i\int_0^{\pi/2}\ln(Re^{i\phi})\left(e^{-Re^{i\phi}}-e^{iRe^{i\phi}}\right)d\phi$$ where every integral can be estimated by means of Jordan's lemma. For example, $$\Big|I_1\Big|=\Big|i\int_0^{\pi/2}\ln(Re^{i\phi})e^{-Re^{i\phi}}d\phi\Big|<\ln R\int_0^{\pi/2}e^{-R\cos\phi}d\phi=\ln R\int_0^{\pi/2}e^{-R\sin\phi}d\phi$$ Using $$\sin\phi\geqslant \frac2\pi\phi$$ for $$\phi\in[0;\frac\pi2]$$ $$\Big|I_1\Big|<\ln R\int_0^{\pi/2}e^{-\frac2\pi R\phi}d\phi=\frac\pi2\frac{\ln R}R\left(1-e^{-R}\right)\to 0\,\text{at}\,R\to\infty$$ Therefore, leading $$r\to 0;\,R\to\infty$$ $$2\int_0^\infty\ln x\,\frac{e^{-x}-\cos x}xdx=\frac{\pi i}2\int_0^\infty\frac{e^{-ix}-e^{-x}}xdx$$ $$=\frac\pi2\int_0^\infty\frac{\sin x}xdx+\frac{\pi i}2\int_0^\infty\frac{\cos x-e^{-x}}xdx$$ $$=\frac{\pi^2}4+\frac{\pi i}2\int_0^\infty\frac{\cos x-e^{-x}}xdx$$ The second integral is zero - the approach is exactly the same as for the initial integral (by means of a quarter-circle in the complex plane). But, in fact, we do not need to evaluate it: the initial integral is real, and the last integral is imaginary, so it must equals zero. Hence, $$\int_0^\infty\ln x\,\frac{e^{-x}-\cos x}xdx=\frac{\pi^2}8$$