How to show $\int_{0}^{\infty}{{\gamma+\ln x\over e^x}}\cdot{1-\cos x\over x} \,\mathrm dx={1\over 2}\cdot{\pi-\ln 4\over 4}\cdot{\pi+\ln4\over 4}?$

The Laplace transform of $1-\cos x$ is $\frac{1}{s(1+s^2)}$ and the inverse Laplace transform of $\frac{1}{x e^{x}}$ is the characteristic function of $(1,+\infty)$, hence $$ \int_{0}^{+\infty}\frac{1-\cos x}{x e^x}\,dx = \int_{1}^{+\infty}\frac{ds}{s(1+s^2)}=\frac{1}{2}\log(2).$$ You may apply the same technique to find $$ \int_{0}^{+\infty}\frac{1-\cos x}{x^\alpha e^x}\,dx = \Gamma(1-\alpha)\left[1-2^{\frac{\alpha-1}{2}}\sin\left(\frac{\pi(\alpha-1)}{4}\right)\right]$$ then differentiate with respect to $\alpha$ and consider the limit as $\alpha\to 1^-$. Done.

The appearance of $\gamma$ just depends on $\Gamma'(1)=-\gamma$, as a clever eye should expect.


$\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{\int_{0}^{\infty}\ln\pars{x}\expo{-x}\,\dd x = \color{#f00}{-}\gamma}$.

\begin{align} &\int_{0}^{\infty}{\gamma + \ln\pars{x} \over \expo{x}}\, {1 - \cos\pars{x} \over x}\,\dd x = \int_{0}^{\infty}\bracks{\gamma + \ln\pars{x}}\expo{-x} \int_{0}^{1}\sin\pars{xt}\,\dd t\,\dd x \\[5mm] = &\ \Im\int_{0}^{1}\int_{0}^{\infty}\bracks{\gamma + \ln\pars{x}} \expo{-\pars{1 - \ic t}x}\,\dd x\,\dd t\qquad\qquad\pars{~\ln\mbox{-Principal Branch}~} \\[5mm] = &\ \gamma\,\Im\int_{0}^{1}{\dd t \over 1 - \ic t} + \Im\int_{0}^{1}{1 \over 1 - \ic t}\int_{0}^{\pars{1 - \ic t}\infty} \ln\pars{x \over 1 - \ic t}\expo{-x}\,\dd x\,\dd t \\[5mm] = &\ \gamma\,\Im\int_{0}^{1}{\dd t \over 1 - \ic t} + \Im\int_{0}^{1}{1 \over 1 - \ic t}\bracks{% \int_{0}^{\infty}\ln\pars{x}\expo{-x}\,\dd x - \ln\pars{1 - \ic t}}\,\dd t \\[5mm] = &\ -\,\Im\int_{0}^{1}{\ln\pars{1 - \ic t} \over 1 - \ic t}\,\dd t = -\,\Im\bracks{\ic\,{1 \over 2}\ln^{2}\pars{1 - \ic t}}_{\ 0}^{\ 1} = -\,{1 \over 2}\,\Re\ln^{2}\pars{1 - \ic} \\[5mm] = &\ -\,{1 \over 2}\,\Re\bracks{{1 \over 2}\,\ln\pars{2} - {\pi \over 4}\,\ic}^{2} = -\,{1 \over 8}\,\ln^{2}\pars{2} + {1 \over 32}\,\pi^{2} = {1 \over 32}\,\pi^{2} - {1 \over 32}\,\ln^{2}\pars{4} \\[5mm] = &\ \bbx{\ds{{1\over 2}\,{\pi - \ln\pars{4} \over 4}\,{\pi + \ln\pars{4} \over 4}}} \end{align}


Assuming that $a>1$,

$$ \begin{align} I(a) &= \int_{0}^{\infty} \frac{\gamma+\ln x}{e^{ax}} \frac{1-\cos x}{x} \, dx \\ &= -\int_{0}^{\infty} \frac{\gamma+\ln x}{e^{ax}} \sum_{n=1}^{\infty} \frac{(-1)^{n}x^{2n-1}}{(2n)!} \, dx \\ &= -\sum_{n=1}^{\infty} \frac{(-1)^{n}}{(2n)!} \int_{0}^{\infty} (\gamma + \ln x) e^{-ax} x^{2n-1} \, dx \\ &= -\sum_{n=1}^{\infty} \frac{(-1)^{n}}{(2n)!} \left(\gamma \, \frac{\Gamma(2n)}{a^{2n}} + \frac{\Gamma'(2n) -\ln(a) \Gamma(2n)}{a^{2n}}\right) \\ &=-\sum_{n=1}^{\infty} \frac{(-1)^{n}}{2n} \left(\frac{\gamma + \psi_{0}(2n)- \ln(a)}{a^{2n}} \right) \tag{1} \\ &= -\sum_{n=1}^{\infty}\frac{(-1)^{n}}{2n} \frac{H_{2n}- \frac{1}{2n} -\ln (a) }{a^{2n}} \tag{2} \\ &= -\sum_{n=1}^{\infty} \frac{(-1)^{n}}{2n}\frac{H_{2n}}{a^{2n}} + \sum_{n=1}^{\infty} \frac{(-1)^{n}}{4n^{2}} \frac{1}{a^{2n}} + \ln (a) \sum_{n=1}^{\infty} \frac{(-1)^{n}}{2n} \frac{1}{a^{2n}} \\\ &= -\sum_{n=1}^{\infty} \frac{(-1)^{n}}{2n}\frac{H_{2n}}{a^{2n}} + \, \frac{1}{4} \, \operatorname{Li}_{2} \left(- \frac{1}{a^{2}} \right) - \frac{\ln (a)}{2} \, \ln\left(1+ \frac{1}{a^{2}} \right) \tag{3}. \end{align}$$

From the ordinary generating function for the harmonic numbers, we see that $$f(z) = \sum_{n=1}^{\infty} \frac{(-1)^{n} H_{n}}{n} \, z^{n} = -\int_{0}^{z} \frac{\log(1+t)}{t(1+t)} \, dt = \operatorname{Li}_{2}(-z) + \frac{1}{2} \, \ln^{2}(1+z), \quad |z| <1. $$

Therefore,$$\begin{align} \sum_{n=1}^{\infty} \frac{(-1)^{n}}{2n}\frac{H_{2n}}{a^{2n}}&= \frac{1}{2} \left[f\left(\frac{i}{a}\right)+f\left(-\frac{i}{a} \right) \right] \\ &= \frac{1}{2} \left[\operatorname{Li}_{2} \left(-\frac{i}{a}\right)+ \frac{1}{2} \, \ln^{2} \left(1+ \frac{i}{a} \right)+ \operatorname{Li}_{2} \left(\frac{i}{a}\right) + \frac{1}{2} \, \ln^{2} \left(1- \frac{i}{a} \right) \right] \\ &= \frac{1}{4} \left[\operatorname{Li}_{2} \left(-\frac{1}{a^{2}} \right) +\ln^{2} \left(1+ \frac{i}{a} \right) + \ln^{2} \left(1- \frac{i}{a} \right)\right], \tag{5} \end{align}$$

and $$\begin{align} I(a) &= -\frac{1}{4} \left[ \ln^{2} \left(1+ \frac{i}{a}\right)+ \ln^{2} \left(1- \frac{i}{a} \right)+2 \ln (a) \ln \left(1+ \frac{1}{a^{2}} \right)\right] \\ &= - \frac{1}{8} \left[ \ln^{2} \left(1+ \frac{1}{a^{2}} \right)-4\arctan^{2} \left(\frac{1}{a} \right) + 4 \ln (a) \ln \left(1+ \frac{1}{a^{2}} \right)\right]. \end{align}$$

Letting $a \downarrow 1$, we get $$I(1) = - \frac{1}{8} \, \ln^{2}(2)+\frac{1}{2} \left(\frac{\pi^{2}}{16} \right) = \frac{\pi^{2}-4 \ln^{2}(2)}{32} = \frac{\pi^{2}-\ln^{2}(4)}{32}.$$

For evaluation purposes, I assumed that $a >1$. But the result should hold for $a>0$.


$(1)$ https://en.wikipedia.org/wiki/Digamma_function

$(2)$ https://en.wikipedia.org/wiki/Digamma_function#Relation_to_harmonic_numbers

$(3)$ https://en.wikipedia.org/wiki/Polylogarithm

$(4)$ https://en.wikipedia.org/wiki/Polylogarithm#Properties