TITLE: Some integral representations of the Euler–Mascheroni constant
QUESTION [16 upvotes]: What kind of substitution should I use to obtain the following integrals?
$$\begin{align}
\int_0^1 \ln \ln \left(\frac{1}{x}\right)\,dx
&=\int_0^\infty e^{-x} \ln x\,dx\tag1\\
&=\int_0^\infty \left(\frac{1}{xe^x} - \frac{1}{e^x-1} \right)\,dx\tag2\\
&=-\int_0^1 \left(\frac{1}{1-x} + \frac{1}{\ln x} \right)\,dx\tag3\\
&=\int_0^\infty \left( e^{-x} - \frac{1}{1+x^k} \right)\,\frac{dx}{x},\qquad k>0\tag4\\
\end{align}$$
This is not homework problems and I know that the above integrals equal to negative of the Euler–Mascheroni constant. I got these integrals while reading this Wikipedia page: The Euler–Mascheroni constant. According to Wikipedia, the Euler–Mascheroni constant is defined as the limiting difference between the harmonic series and the natural logarithm:
$$\gamma=\lim_{N\to\infty} \left(\sum_{k=1}^N \frac{1}{k} - \ln N\right)$$
but I don't know why can this definition be associated to the above integrals?
I can obtain the equation $(1)$ using substitution $t=\ln \left(\frac{1}{x}\right)\rightarrow x=e^{-t} \rightarrow dx=-e^{-t}\,dt$ and I know that
$$\int_0^\infty e^{-x} \ln x\,dx=\Gamma'(1)=\Gamma(1)\psi(1)=-\gamma$$
but I can't obtain the rest. Any idea? Any help would be appreciated. Thanks in advance.

REPLY [2 votes]: The easiest way to obtain this result is to use a regularization procedure. I will explain how to do the integral associated with a previous response, $$\int_{0}^{\infty}\left(\mathrm{cos}\space x-\frac{1}{1+x^2}\right)\frac{dx}{x}=-\gamma$$
This integral is correct.  Easiest way to show is to regularize the integral by adding the small real number $\delta$ to the exponent of $x^{-1}$.  This, after the $u$ substitution $u=ix$, gives $$\mathrm{Re}\left[\Gamma(\delta)\left(\frac{1}{i}\right)^\delta\right]-\frac{\pi}{2}\mathrm{csc}\left(\frac{\pi\delta}{2}\right).$$  Now, we just use the recursion identity $\delta\Gamma(\delta)=\Gamma(\delta+1)$ along with the Taylor series for $\Gamma(1+\delta)$ and sin($x$), to show that the integral is given by $-\gamma$.  There are two $\frac{1}{\delta}$ terms that cancel, and the remaining contribution when $\delta$ is very small is $-\gamma$.  This is a very neat integral for $\gamma$!
I'd like to see the reason why $$\int_{0}^{\infty}\frac{\mathrm{ln}(1+x)}{\mathrm{ln}^2(x)+\pi^2}\frac{dx}{x^2}=\gamma$$
I don't have any 'neat tricks' for this expression...  would appreciate any!