Compute $ \int_{0}^{+\infty} \left( \frac{\ln(x)}{e^x}\right)^2 dx $ How can I compute this integral?
$$
\int_{0}^{+\infty} \left( \frac{\ln(x)}{e^x}\right)^2 dx
$$
 A: Let
$$f(a):=\int_0^\infty x^{a-1}e^{-2x}\,dx.$$
Then
$$f''(1)=\int_0^\infty \ln^2x\,e^{-2x}\,dx,$$
which is the integral in question.
On the other hand, $f(a)=2^{-a}\,\Gamma(a)$, and hence
the integral in question is
$$f''(1)=\frac{\ln^2 2}2 - \Gamma'(1)\ln2
+ \Gamma''(1)/2
=\frac{\pi^2}{12}+ \frac{(\gamma +\ln2)^2}2=1.6293\dots,$$
where $\gamma=0.57721\dots$ is the Euler gamma constant.
(The second equality in the latter display follows because $\Gamma'(1)=-\gamma$ and $\Gamma''(1)=\gamma^2+\pi^2/6$. In turn, the latter two equalities can be obtained using the last two displays in Section Recurrence relation.)
A: Hint: you may try $n=2$ and follow in general this :\begin{align} \int_0^\infty \left(\frac{\log(x)}{e^x}\right)^n\,dx&=\int_0^\infty e^{-nx}\log^n(x)\,dx\\\\ &=\frac1n\sum_{k=0}^n\binom{n}{k}\log^{n-k}(n)\int_0^\infty e^{-x}\log^n(x)\,dx\\\\ &=\frac1n\sum_{k=0}^n\binom{n}{k}\log^{n-k}(n) \left.\left(\frac{d^n \Gamma(x+1)}{dx^n}\right)\right|_{x=0} \end{align}
For more information check answers of my question here
For more clarification according to the answer of @Nikunj, try $n=2$ using this steps in general: Let $$I(a) = \int_0^\infty e^{-nx}x^a\,dx$$
$$\implies \frac{d^nI(a)}{da^n} = \int_0^\infty e^{-nx}x^a(\ln x)^n\,dx$$
Put $nx \rightarrow v$ in the first integral to get:
$$I(a) = \frac1{n^{1+a}}\int_0^\infty e^{-v}v^a\,dv$$
$$\implies I(a) = \frac{\Gamma(1+a)}{n^{1+a}}$$
Now $$\implies \frac{d^nI(a)}{da^n}\bigg|_{a=0} = \frac{d^n}{da^n}\left(\frac{\Gamma(1+a)}{n^{1+a}}\right)\bigg|_{a=0}$$
Which evaluates to:
$$\frac1{n}\sum_{k=0}^n(-1)^k\binom{n}{k}\Gamma^{(n-k)}(1+a)\ln^k(n)\bigg|_{a=0}$$
Where $\Gamma^{(n-k)}(1+a)$ is the $(n-k)$th derivative of the Gamma function.
