# Integral $\int_0^{\infty} \log(x)^2 e^{-x} \, \mathrm{d}x$

According to WolframAlpha, the integral $$\int_0^{\infty} \log(x)^2 e^{-x} \, \mathrm{d}x$$ has closed form $\gamma^2 + \frac{\pi^2}{6}$, where $\gamma$ is the Euler-Mascheroni constant.

The term $\frac{\pi^2}{6}$ is $\zeta(2)$, and other integrals of the form $\int_0^{\infty} \log(x)^n e^{-x} \, \mathrm{d}x$ clearly have some relation to values of $\zeta(s)$ at integers. I do not know where to go with this. The usual trick I know for integrating something of the form $\log(x)^n f(x)$ is to compare integrals along the top and bottom of the slit in a keyhole contour, but this doesn't converge with the term $e^{-x}$.

Using $$\Gamma(z) = \int_0^\infty e^{-x}x^{z-1} dx$$ we obtain $$\int_0^\infty e^{-x}\ln^2 x dx = \Gamma''(1) = \gamma^2+\zeta(2)$$
To derive $\Gamma''(1)$, use the expansion and take expoential on both sides: $$\ln\Gamma(1+z) = -\gamma z + \sum_{k=2}^\infty \frac{(-1)^k\zeta(k)}{k}z^k$$
Let's use the classic differentiation under the integral sign to prove your identity. The work is as follows\begin{align*}\int\limits_0^{\infty}e^{-x}\log^2x\, dx & =\lim\limits_{\mu\to0}\frac {\partial^2}{\partial\mu^2}\int\limits_{0}^{\infty}e^{-x}x^\mu\, dx\\ & =\lim\limits_{\mu\to0}\frac {\partial^2\,\Gamma(\mu+1)}{\partial\mu^2}\\ & =\Gamma''(1)\end{align*}We can evaluate the gamma function by making use of the identity $\Gamma'(x)=\Gamma(x)\psi(x)$. Letting $x=1$ and differentiating, we see that\begin{align*}\Gamma''(1) & =\Gamma(1){\psi^2(1)}+\Gamma(1){\psi'(1)}\\ & ={\gamma^2}+{\zeta(2)}\end{align*}Hence, we can see immediately that$$\int\limits_{0}^{\infty}e^{-x}\log^2x\, dx=\gamma^2+\frac {\pi^2}6$$
You can generate similar identities by changing the power of the natural log function\begin{align*}\int\limits_0^{\infty}e^{-x}\log x\, dx & =\color{blue}{-\gamma}\\\int\limits_0^{\infty}e^{-x}\log^3 x\, dx & =\color{blue}{\gamma^3+\frac {\gamma\pi^2}2+2\zeta(3)}\\\int\limits_{0}^{\infty}e^{-x}\log^4 x\, dx & =\color{blue}{8\gamma\zeta(3)+\gamma^4+\gamma^2\pi^2+\frac {3\pi^4}{20}}\end{align*}