Some integral representations of the Euler–Mascheroni constant 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 $-\gamma$ (where $\gamma$ is the Euler-Mascheroni constant). I got these integrals while reading this Wikipedia page. 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.
 A: For the fourth one, express the integral as an iterated integral and then switch the order of integration.
$$ \begin{align} \int_{0}^{\infty} \left( e^{-x}- \frac{1}{1+x^{k}} \right) \frac{dx}{x} &= \int_{0}^{\infty} \int_{0}^{\infty} \left(e^{-x} - \frac{1}{1+x^{k}} \right) e^{-xt} \ dt \ dx \\  &= \int_{0}^{\infty} \int_{0}^{\infty} \left(e^{-x} - \frac{1}{1+x^{k}} \right) e^{-tx} \ dx \ dt \\ &= \int_{0}^{\infty} \left(\int_{0}^{\infty} e^{-(t+1)x} \ dx  - \int_{0}^{\infty} \frac{e^{-tx}}{1+x^{k}} \ dx \right) \ dt  \\ &= \int_{0}^{\infty} \left( \frac{1}{t+1} - \int_{0}^{\infty} \frac{e^{-u}}{1+ (\frac{u}{t})^{k}} \frac{du}{t}  \right) \ dt \\ &= \int_{0}^{\infty} \left(\int_{0}^{\infty}\frac{e^{-u}}{t+1} \ du - \int_{0}^{\infty} \frac{t^{k-1}e^{-u}}{t^{k}+u^{k}} \ du  \right) \ dt \tag{1} \\ &= \int_{0}^{\infty} \int_{0}^{\infty} \left(\frac{1}{t+1} - \frac{t^{k-1}}{t^{k}+u^{k}} \right)e^{-u} \ du \ dt \\ &= \int_{0}^{\infty} e^{-u} \int_{0}^{\infty} \left(\frac{1}{t+1} - \frac{t^{k-1}}{t^{k}+u^{k}} \right) \ dt \ du \\ &= \int_{0}^{\infty} e^{-u} \ln \left(\frac{1+t}{(t^{k}+u^{k})^{1/k}} \right) \Bigg|^{t=\infty}_{t=0}  \ du \\ &=  \int_{0}^{\infty} e^{-u} \ln u =  -\gamma  \end{align}$$
$(1)$ Since $\int_{0}^{\infty} e^{-u} \ du = 1$
$ $
Since I'm pretty sure I saw sos440 use this approach on another site to show that $$ \int_{0}^{\infty} \left(\cos (x) - \frac{1}{1+x^{2}} \right) \frac{dx}{x} = - \gamma,$$ I'm going to post this answer as a community wiki.
A: For equation $(2)$, make substitution $t=e^{-x}\,\Rightarrow\, x=-\ln t\,\Rightarrow\,dx=-\dfrac{dt}{t}$, then we get equation $(3)$ after $t\mapsto x$.
\begin{equation}
\int_0^\infty \left(\frac{1}{xe^x} - \frac{1}{e^x-1} \right)\,dx=\int_0^\infty \left(\frac{e^{-x}}{x} - \frac{e^{-x}}{1-e^{-x}} \right)\,dx=\int_0^1 \left(\frac{1}{1-x} \color{red}{+} \frac{1}{\ln x} \right)\,dx
\end{equation}
Indeed equation $(3)$ equals $-\gamma$ and here is the proof. We have
\begin{equation}
-\int_0^1 \left(\frac{1}{1-x} \color{red}{+} \frac{1}{\ln x} \right)\,dx=-\int_0^1 \frac{\ln x+1-x}{(1-x)\ln x}\,dx
\end{equation}
I check on the cited link (Wikipedia), there is a minor typo in $(3)$.
Proposition :

\begin{equation}
I(s)=\int_0^1 \frac{s\ln x+1-x^s}{(1-x)\ln x}\,dx=\ln\Gamma(s+1) +\gamma s
\end{equation}

Proof :
Let
\begin{equation}
I(s)=\int_0^1 \frac{s\ln x+1-x^s}{(1-x)\ln x}\,dx
\end{equation}
then
\begin{align*}
I'(s)&=\int_0^1 \frac{1-x^s}{1-x}\,dx\\
I''(s)&=-\int_0^1  \frac{x^s\ln x}{1-x} \,dx\\
&=-\int_0^1\sum_{n=0}^\infty x^{n+s}\ln x\,dx\\
&=-\sum_{n=0}^\infty\partial_s\int_0^1 x^{n+s}\,dx\\
&=-\sum_{n=0}^\infty\partial_s\left[\frac{1}{n+s+1}\right]\\
&=\sum_{n=0}^\infty\frac{1}{(n+s+1)^2}\\
&=\psi_1(s+1)\\
I'(s)&=\int\psi_1(s+1)\,ds\\
I'(s)&=\int\frac{\partial}{\partial s}\bigg[\psi(s+1)\bigg]\,ds\\
I'(s)&=\psi(s+1)+C\\
\end{align*}
For $s=0$, we have $I'(0)=0$. Implying $C=-\psi(1)=\gamma$, then
\begin{align*}
I'(s)&=\psi(s+1)+\gamma\\
I(s)&=\int \psi(s+1)\,ds +\gamma s+C\\
&=\int \frac{\partial}{\partial s}\bigg[\ln\Gamma(s+1)\bigg]\,ds +\gamma s+C\\
&=\ln\Gamma(s+1) +\gamma s+C\\
\end{align*}
For $s=0$, we have $I(0)=0$. Implying $C=0$, then 
\begin{equation}
I(s)=\int_0^1 \frac{s\ln x+1-x^s}{(1-x)\ln x}\,dx=\ln\Gamma(s+1) +\gamma s\qquad\qquad\square
\end{equation}

For $s=1$, we have
\begin{equation}
-I(1)=-\int_0^1 \left(\frac{1}{1-x} + \frac{1}{\ln x} \right)\,dx=-\int_0^1 \frac{\ln x+1-x}{(1-x)\ln x}\,dx=-\gamma
\end{equation}
A: 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!
A: I am not sure if you can obtain the other three from the first integral through some substitution. 
The $(3)$ one can be obtained from the definition of constant..
Notice that
$$\sum_{i=1}^N\frac{1}{i}=\int_0^1 \frac{1-t^N}{1-t}\,dt$$
and 
$$\ln N=\int_0^1 \frac{t^{N-1}-1}{\ln t}\,dt$$
The above can be proved using Frullani's integral.
Therefore
$$\begin{aligned}
\lim_{N\rightarrow \infty} \left(\sum_{i=1}^N\frac{1}{i}-\ln N\right) &=\lim_{N\rightarrow \infty}\int_0^1\left(\frac{1-t^N}{1-t}-\frac{t^{N-1}-1}{\ln t}\,dt\right)\,dt \\
&=\int_0^1 \left(\frac{1}{1-t}+\frac{1}{\ln t}\right)\,dt
\end{aligned}$$
Make the substitution $\ln x=-t$ to obtain the $(2)$.
A: The LHS of $(1)$ could be proven by using the fact that: $$\int_0^1(-\ln x)^sdx=\Gamma(s+1)$$Take the derivative of both sides: $$\int_0^1\ln\ln\left(\frac{1}{x}\right)(-\ln x)^sdx=\Gamma'(s+1)$$Let $s=0$. Then: $$\int_0^1\ln\ln\left(\frac{1}{x}\right)dx=\Gamma'(1)=-\gamma$$The derivative of $\Gamma$ is: $$\int_0^\infty e^{-t}t^{s-1}\ln tdt$$, and so we get the LHS of $(1)$. Take a look at this link for proofs on why $\Gamma'(1)=-\gamma$
