# Identity regarding exponential integral

I came across an identity which is described in this book as "classical" (page 85/350): $$\begin{equation} \int_{0}^{x} \frac{1 - e^{-y}}{y} dy = E_1(x) + \log(x) + \gamma, \qquad x > 0 \end{equation}$$ where $$\gamma$$ is the Euler-Mascheroni constant and $$E_1$$ is defined as below: $$\begin{equation} E_1(x) = \int_{x}^{\infty} \frac{e^{-s}}{s} ds. \end{equation}$$ Unfortunately, I was not able to prove this identity. My attempts have only provided me that the bilaterally derived equation holds, but not sure why $$\gamma$$ is the desired constant on the right hand side. I have a suspicion that one should somehow use the Weierstrass product representation of the gamma function (as the Euler-Mascheroni constant appears there as well) but to no avail.

As I wrote in the original post, it is enough to prove that the right hand side of the original equation converges to zero (because the supposed equation is true when derived by $$x$$ variable). Let us look on the integral $$\int_{0}^{\infty} \log (t)\,e^{-t} dt$$ in two different ways. On one hand: \begin{align} \int_{0}^{\infty}\log(t)\,e^{-t}\,dt &=\lim_{n\to\infty}\int_0^n\log(t)\,\left(1-\frac{t}{n}\right)^n\,dt\\ &=\lim_{n\to\infty}n\int_0^1(\log(t)+\log(n))\,(1-t)^n\,dt\\ &=\lim_{n\to\infty}\left(\frac{n}{n+1}\log(n)+n\int_0^1\log(1-t)\,t^n\,dt\right)\\ &=\lim_{n\to\infty}\left(\frac{n}{n+1}\log(n)-\frac{n}{n+1}H_{n+1}\right)\\[6pt] &=-\gamma. \end{align} In the above sequence of equations we used the monotone convergence, $$t \mapsto nt$$ substitution, $$t \mapsto 1-t$$ substitution, integration by parts and the definition of Euler-Mascheroni constant, respectively.
On the other hand, we can use integration by parts to see that: \begin{align} \int_{0}^{\infty}\log(t)\,e^{-t}\,dt &= \lim_{y\to0^{+}} \left(\left[-e^{-t}\log(t)\right]_{t=y}^{\infty} - \int_{y}^{\infty}\frac{-e^{-t}}{t} dt \right)\\ &= \lim_{y\to0^{+}} \left(\log(y) - \int_{y}^{\infty}\frac{-e^{-t}}{t} dt \right)\\ &= \lim_{y\to0^{+}} \left(\log(y) + E_1(y) \right)\\ &= -\gamma, \end{align} because $$\lim_{y\to0^{+}} e^{-t}\log(t) - \log(t) = 0$$ (which is pretty easy to prove using well known limits: $$\lim_{x\to0^+} x\ln x = 0$$ and $$\lim_{x\to0} (e^x - 1) / x = 1$$).
\begin{align} \int_{0}^{x} \frac{1 - e^{-y}}{y} dy &=\int_{0}^{1} \frac{1 - e^{-y}}{y} dy+\int_{1}^{x} \frac{1 - e^{-y}}{y} dy\\ &=\int_{0}^{1} \frac{1 - e^{-y}}{y} dy+\int_{1}^{x} \frac{1}{y} dy-\int_{1}^{x} \frac{e^{-y}}{y} dy\\ &=\int_{0}^{1} \frac{1 - e^{-y}}{y} dy+\int_{1}^{x} \frac{1}{y} dy-\left(\int_{1}^{\infty} \frac{e^{-y}}{y} dy-\int_{x}^{\infty} \frac{e^{-y}}{y} dy\right)\\ &=\int_{0}^{1} \frac{1 - e^{-y}}{y} dy+[\ln{|y|}]_1^x-\left(E_1(1)-E_1(x)\right)\\ &=E_1(x)+\ln{(x)}+\int_{0}^{1} \frac{1 - e^{-y}}{y} dy-E_1(1)\\ \end{align} Now all you have to do is prove that $$\int_{0}^{1} \frac{1 - e^{-y}}{y} dy=\sum_{k=1}^\infty\frac{(-1)^{k+1}}{k(k!)}=\gamma+E_1(1)$$ which I am unsure of how to do.