TITLE: Evaluating $\int\limits_0^\infty \mathcal{e}^{-x}\ln^{2}x\,dx$
QUESTION [8 upvotes]: I'm looking for a proof of this:
$$\int\limits_0^\infty \mathcal{e}^{-x}\ln^{2}x\,dx = \gamma^{2}+\frac{\pi^{2}}{6}$$
My first thought would have been to write $e^{-x}$ as an infinite series and then exchange its order with the integral, but that brought me nowhere. Considering also that $\frac{\pi^{2}}{6}$ shows up, it seems inevitable to make use of the zeta function, which is something I'm not really familiar with. For context, I'm trying to evaluate the Laplace Transform of $\ln^2x$, which has come down to the integral above.

REPLY [7 votes]: Recall that 
$$\Pi(s)=\Gamma(s+1)=\int_0^\infty x^{s}e^{-x}dx$$
so by the Leibniz integral rule,
$$\Pi'(s)=\int_0^\infty \frac{\partial}{\partial s}x^se^{-x}dx=\int_0^\infty x^{s}e^{-x}\ln(x)dx$$
So naturally 
$$\Pi''(s)=\int_0^\infty x^se^{-x}\ln(x)^2dx$$
so your integral is given by 
$$\Pi''(0)=\Gamma''(1)$$
then we recall the definition of the polygamma function:
$$\psi_n(s)=\left(\frac{d}{ds}\right)^{n+1} \ln\Gamma(s)=\frac{d}{ds}\psi_{n-1}(s)$$
So we see that 
$$\Gamma'(s)=\Gamma(s)\psi_0(s)$$
And accordingly,
$$\Gamma''(s)=\Gamma'(s)\psi_0(s)+\Gamma(s)\psi_1(s)$$
Which is $$\Gamma''(s)=\Gamma(s)\left(\psi_0^2(s)+\psi_1(s)\right)$$
Hence your integral is
$$\Gamma''(1)=\psi_0^2(1)+\psi_1(1)$$
Then from here we have that 
$$\psi_0(1)=-\gamma$$
And from here
$$\psi_1(1)=\frac{\pi^2}6$$
So we have your integral at 
$$\Gamma''(1)=\gamma^2+\frac{\pi^2}6$$

REPLY [5 votes]: For any $x>0$, we can write
$$\log(x)=\int_0^\infty \frac{e^{-t}-e^{-xt}}{t}\,\,dt\tag1$$
Using $(1)$, we have
$$\begin{align}
\int_0^\infty e^{-x}\log^2(x)\,dx&=\int_0^\infty \int_0^\infty \frac{e^{-(t+x)}-e^{-x(t+1)}}{t}\log(x)\,dt\,dx\\\\
&=\int_0^\infty\frac1t \int_0^\infty \left(e^{-(t+x)}-e^{-x(t+1)}\right)\log(x)\,dx\,dt\\\\
&=\int_0^\infty \frac1t\left(-\gamma e^{-t}+\frac\gamma{t+1}\right)\,dt-\int_0^\infty \frac{\log(t+1)}{t(t+1)}\tag2
\end{align}$$

Integrating by parts the first integral on the right-hand side of $(2)$ with $u=\left(-\gamma e^{-t}+\frac\gamma{t+1}\right)$ and $v=\log(t)$, we obtain
$$\begin{align}
\int_0^\infty \frac1t\left(-\gamma e^{-t}+\frac\gamma{t+1}\right)\,dt&=-\int_0^\infty \left(\gamma e^{-t}-\frac\gamma{(t+1)^2}\right)\log(t)\,dt\\\\
&=\gamma^2+\gamma\underbrace{\int_0^\infty \frac{\log(t)}{(t+1)^2}\,dt}_{=0\,\text{as seen by substituting }\,t\mapsto 1/t}\\\\
&=\gamma^2 \tag3
\end{align}$$

For the second integral on the right-hand side of $(2)$, we have
$$\begin{align}
\int_0^\infty \frac{\log(t+1)}{t(t+1)}\,dt&=\int_0^1 \frac{\log(t+1)}{t(t+1)}\,dt+\int_1^\infty \frac{\log(t+1)}{t(t+1)}\,dt\\\\
&=\int_0^1 \left(\frac{\log(t+1)}{t}-\frac{\log(t+1)}{t+1}\right)\,dt+\int_0^1 \frac{\log(t+1)-\log(t)}{t+1}\,dt\\\\
&\int_0^1 \left(\frac{\log(t+1)}{t}\right)\,dt-\int_0^1 \left(\frac{\log(t)}{t+1}\right)\,dt\\\\
&=2\int_0^1 \left(\frac{\log(t+1)}{t}\right)\,dt\\\\
&=2\frac{\pi^2}{12}\\\\
&=\frac{\pi^2}{6}\tag4
\end{align}$$

Putting it all together yields the coveted identity
$$\int_0^\infty e^{-x}\log^2(x)\,dx=\gamma^2+\frac{\pi^2}{6}$$
as was to be shown!