Prove $\gamma = \int_{0}^{1}\frac{1-e^{-u}}{u}\,du - \int_{1}^{+\infty} \frac{e^{-u}}{u}\,du $ How do we prove this integral representation of the Euler-Mascheroni constant ?
$$\gamma = \int_{0}^{1}\frac{1-e^{-u}}{u} du - \int_{1}^{+\infty} \frac{e^{-u}}{u} du $$
Here are the three intermediate steps of my exercise:

*

*$ S_n:= \sum_{p=1}^{n}\frac{1}{p} - \ln n $ then $S_n$ converges to a constant we call $\gamma$, so  $ S_n\underset{ n \to \infty}{\rightarrow} \gamma$


*$\forall x \in ]0,1[  ~, f(x):= - \ln(1-x) - \int_{1}^{+\infty} \frac{x^t}{t}$, and $f(x) \underset{ x \to 1^{-}}{\rightarrow} \gamma$


*$[ \ln(1-x) - \ln(-\ln(x)) ] \underset{ x \to 1^{-}}{\rightarrow} 0 $

My attempt :

*

*$S_n$ is decreasing and positive so converges

*$f_n(x):=\sum_{p=1}^{n} \frac{x^p}{p}- \int_{1}^{n} \frac{x^t}{t}$ : the convergence to $f$ is uniform.

*I do a limited developpement.

 A: Let's begin with the second assumption (i.e., Intermediate Step $2$) in the OP, namely
$$\gamma=\lim_{x\to 1^-}\left(-\log(1-x)-\int_1^\infty \frac{x^t}{t}\,dt\right)\tag2$$
Next, we use Intermediate Step $3$ of the OP to write $(2)$ as
$$\gamma=\lim_{x\to 1^-}\left(-\log(-\log(x))-\int_1^\infty \frac{x^t}{t}\,dt\right)\tag3$$
Enforcing the substitution $x=e^{-\varepsilon}$ in $(3)$ reveals
$$\begin{align}
\gamma&=\lim_{\varepsilon \to 0^+}\left(-\log(\varepsilon)-\int_1^\infty \frac{e^{-\varepsilon t}}{t}\,dt\right)\\\\
&=\lim_{\varepsilon \to 0^+}\left(\int_\varepsilon^1 \frac1t \,dt-\int_{\varepsilon}^\infty \frac{e^{- t}}{t}\,dt\right)\\\\
&=\lim_{\varepsilon\to 0^+}\left(\int_\varepsilon^1 \frac{1-e^{-t}}{t}\,dt\right)-\int_1^\infty \frac{e^{-t}}{t}\,dt\\\\
&=\int_0^1 \frac{1-e^{-t}}{t}\,dt-\int_1^\infty \frac{e^{-t}}{t}\,dt
\end{align}$$
as was to be shown!


NOTE:  The enumerated point $2$ in the OP's attempt can be used to link together the Intermediate Step $1$ with the Intermediate Step $2$.


ALTERNATIVE APPROACH:
Note that we can write
$$\int_0^1 \frac{1-e^{-u}}{u}\,dx=\lim_{\varepsilon\to 0}\int_\varepsilon^1 \frac{1-e^{-u}}{u}\,du\tag1$$
Now, integrating by parts the integral on the right-hand side of $(1)$ reveals
$$\int_\varepsilon^1 \frac{1-e^{-u}}{u}\,du=-\log(\varepsilon)(1-e^{-\varepsilon})-\int_\varepsilon ^1 \log(u)e^{-u}\,du$$
In addition, integration by parts yields
$$\int_1^\infty \frac{e^{-u}}{u}\,du=-\int_1^\infty \log(u) e^{-u}\,du$$
Putting it together, we find that
$$\int_0^1 \frac{1-e^{-u}}{u}\,du-\int_1^\infty \frac{e^{-u}}{u}\,du=-\int_0^\infty \log(u) e^{-u}\,du=\gamma$$
as expected!
A: Your "intermediate step 1." is the most common definition of $\gamma$ (I think).
Here is a derivation directly from it. We have $$\sum_{k=1}^{n}\frac1k=\sum_{k=1}^{n}\int_0^1 t^{k-1}\,dt=\int_0^1\frac{1-t^n}{1-t}\,dt\underset{t=1-\frac{x}{n}}{\phantom{[}\quad=\quad}\phantom{]}\int_0^n\left[1-\left(1-\frac{x}{n}\right)^n\right]\frac{dx}{x};$$ now we split $\int_0^n=\int_0^1+\int_1^n$, use $\log n=\int_1^n\frac{dx}{x}$, and make the two $\int_1^n$ into one: $$\sum_{k=1}^n\frac1k-\log n=\int_0^1\left[1-\left(1-\frac{x}{n}\right)^n\right]\frac{dx}{x}-\int_1^n\left(1-\frac{x}{n}\right)^n\frac{dx}{x}.$$ Now taking $n\to\infty$ is easy (for DCT, the integrands are dominated by $1$ and $e^{-x}/x$, respectively).
