TITLE: Integral representation for Euler constant
QUESTION [8 upvotes]: I am trying to show that $$\gamma=\int_0^{\infty}\frac{\ln(1+x)+e^{-x}-1}{x^2}\;dx$$ I haven't done so much, but since this is related to $\psi (1)=\Gamma'(1)$ I have tried to work backwards. So $$\Gamma(x)=\int_0^{\infty} t^{x-1}e^{-t}\;dt\rightarrow \Gamma'(x)=\int_0^{\infty} t^{x-1}e^{-t}\ln t\;dt$$ $$\int_0^{1} t^{x-1}e^{-t}\ln t\;dt+\int_0^{1} \frac{e^{-\frac{1}{t}}\ln t}{t^2}\;dt$$ Where I used $t=\frac{1}{t}$ in the second integral, I also tried to recombine those two, but of no use. Also this is equal to: $$\int_0^{\infty} (\ln\left(1+\frac{1}{x}\right)+e^{-\frac{1}{x}}-1)dx$$ Now I am thinking to use series. Could you give me some help or hints?

REPLY [4 votes]: Taking integration by parts (IbP) twice, we obtain
\begin{align*}
\int_{0}^{\infty} \frac{\log(1+x) + e^{-x} - 1}{x^2} \, dx
&\stackrel{\text{(IbP)}}{=} \int_{0}^{\infty} \left( \frac{1}{x+1} - e^{-x} \right) \frac{1}{x} \, dx \\
&\stackrel{\text{(IbP)}}{=} \int_{0}^{\infty} \left( \frac{1}{(x+1)^2} - e^{-x} \right) \log x \, dx.
\end{align*}
But it is easy to check that
$$ \int_{0}^{\infty} \frac{\log x}{(1+x)^2} \, dx
\stackrel{(x\ \mapsto\ \frac{1}{x})}{=} -\int_{0}^{\infty} \frac{\log x}{(1+x)^2} \, dx $$
and hence the common value of both sides is zero. For the remaining term, it is well-known that
$$ \int_{0}^{\infty} e^{-x}\log x \, dx = -\gamma. $$
This particular integral has been explained several times in this community. (See this, for instance.)