How can I prove $\frac{\gamma}{2}=\int_{0}^{\infty}\frac{e^{-x^{2}}-e^{-x}}{x}\text{d}x$? How can I prove the following equation?
$$\frac{\gamma}{2}=\int_{0}^{\infty}\frac{e^{-x^{2}}-e^{-x}}{x}\text{d}x$$
 A: Starting from
$$\int_a^b \frac{e^{-x^2} - e^{-x}}{x}\, dx \quad (b > a > 0)$$
we have that
\begin{align}\int_a^b \frac{e^{-x^2} - e^{-x}}{x}\, dx &= \int_a^b \frac{e^{-x^2}}{x}\, dx - \int_a^b \frac{e^{-x}}{x}\, dx \\&= \frac{1}{2}\int_{a^2}^{b^2} \frac{e^{-u}}{u}\, du - \int_a^b \frac{e^{-x}}{x}\, dx\end{align}
by the substitution $u = x^2$. If we integrate by parts, we form
$$\int_a^b \frac{e^{-x}}{x}\, dx = e^{-b}\ln b - e^{-a}\ln a + \int_a^b e^{-x}\ln x\, dx$$
and
$$\frac{1}{2}\int_{a^2}^{b^2} \frac{e^{-u}}{u}\, du = e^{-b^2}\ln b - e^{-a^2}\ln a + \frac{1}{2}\int_{a^2}^{b^2} e^{-x}\ln x\, dx.$$
Thus,
\begin{align}\int_a^b \frac{e^{-x^2} - e^{-x}}{x}\, dx
& = (e^{-b^2} - e^{-b})\ln b - (e^{-a^2} - e^{-a})\ln a\\& + \frac{1}{2}\int_{a^2}^{b^2} e^{-x}\ln x\, dx - \int_a^b e^{-x}\ln x\, dx.\\
\end{align}
Therefore, because $\big(e^{-x^2} - e^{-x}\big)\ln x$ tends to $0$ as $x\to 0^+$ and as $x\to \infty$, we can take the limit as $a \to 0^+$ and $b\to \infty$. This forms
$$\int_0^\infty \frac{e^{-x^2} - e^{-x}}{x}\, dx = -\frac{1}{2}\int_0^\infty e^{-x}\ln x\, dx$$
$\gamma$ is the Euler-Mascheroni Constant. It is defined by
$$\gamma = -\int_0^{\infty}e^{-x}\ln x ~dx \tag{*}$$
Thus, we have that
$$\int_0^{\infty}\frac{e^{-x^2}-e^{-x}}{x}dx=-\frac{1}{2}\int_0^{\infty}e^{-x}\ln x ~dx=\frac{\gamma}{2}$$

To show that $(*)$ holds, we can derive the above representation of the Euler-Mascheroni Constant. Let's start from
$$\int_0^{\infty}e^{-x}\ln x ~dx$$
and then write
$$e^{-x}=\lim_{n\to\infty}\Big(1-\frac{x}{n}\Big)^n=\lim_{n\to\infty}\Big(1-\frac{x}{n}\Big)^{n-1}$$
which means that
$$\int_0^{\infty}e^{-x}\ln x ~dx=\lim_{n\to\infty}\int_0^{n}\Big(1-\frac{x}{n}\Big)^{n-1}\ln x ~dx$$
Then, we can perform the $u$ substitution $$u=1-\frac{x}{n} ~~\Rightarrow~~ x=n(1-u)$$ $$du = -\frac{1}{n}dx$$ $$dx=-n~du$$
to form 
\begin{align}
\int_0^{n}\Big(1-\frac{x}{n}\Big)^{n-1}\ln x ~dx&=\int_1^{0}u^{n-1}\ln \big(n(1-u)\big) (-n~du) \\&=n\int_0^1u^{n-1}\ln \big(n(1-u)\big)du
\end{align}
Hence,
\begin{align}
\int_0^{n}\Big(1-\frac{x}{n}\Big)^{n-1}\ln x ~dx &=
n\int_0^1u^{n-1}\ln \big(n(1-u)\big)du \\&= n\ln(n) \int_0^1u^{n-1}du ~+ ~n\int_0^1u^{n-1}\ln \big((1-u)\big)du \\ &=
n\ln(n)\Big[\frac{u^n}{n}\Big]_0^1 ~-~ n\int_0^1u^{n-1} \sum_{k=1}^{\infty}\frac{u^k}{k}~du \\ &=
n\ln(n)\frac{1}{n}~-~n\int_0^1 \sum_{k=1}^{\infty} \frac{u^{k+n-1}}{k}du
 \\ &=
\ln(n) ~-~ n\sum_{k=1}^{\infty}\frac{1}{k(k+n)} \\ &=
\ln(n)~-~\sum_{k=1}^{\infty}\Big(\frac{1}{k}-\frac{1}{n+k}\Big) \\ &=
\ln(n)~-~\sum_{k=1}^{n}\frac{1}{k}
\end{align}
So, if we let $n\to\infty$ we see that
\begin{align}
\int_0^{\infty}e^{-x}\ln x ~dx &=
\lim_{n\to\infty}\Big(\ln(n)~-~\sum_{k=1}^{n}\frac{1}{k}\Big) \\&=
-\gamma
\end{align}
A: \begin{align}
I=\int_0^\infty\frac{e^{-x^2}-e^{-x}}{x}\ dx\overset{IBP}{=}\int_0^\infty\ln x\left(2xe^{-x^2}-e^{-x}\right)\ dx
\end{align}
let $x^2\mapsto x$ for the first integral to get
\begin{align}
I=-\frac12\int_0^\infty\ln x\ e^{-x} dx=-\frac12(-\gamma)
\end{align}

Proof for the last step:
Using the fact that $$\int_0^\infty x^{a-1} \ e^{-bx} dx=\frac{\Gamma(a)}{b^{\ a}}\tag{1}$$
differentiate both sides of $(1)$ with respect to $a$ to get 
$$\int_0^\infty \ln x\  x^{a-1} \ e^{-bx}\ dx=-\frac{\Gamma(a)(\ln b-\psi(a))}{b^{\ a}}\tag{2}$$
 now set $a=1$ in $(2)$
$$\int_0^\infty \ln x\ e^{-bx}\ dx=-\frac{\ln b+\gamma}{b}$$
Finally set $b=1$ we get
$$\int_0^\infty \ln x\ e^{-x}\ dx=-\gamma$$
A: If you are allowed to use the exponential integral function
$$I=\int\frac{e^{-x^{2}}-e^{-x}}{x}\,dx=\int\frac{e^{-x^{2}}}{x}\,dx-\int\frac{e^{-x}}{x}\,dx$$ For the first integral, let $x=\sqrt t$ to make
$$\int\frac{e^{-x^{2}}}{x}\,dx=\frac 12\int\frac{e^{-t}}{t}\,dt$$ making
$$I=\int\frac{e^{-x^{2}}-e^{-x}}{x}\,dx=\frac{1}{2}\text{Ei}\left(-x^2\right)-\text{Ei}(-x)$$
Now, using asymptotics for small $t$
$$\text{Ei}(-t)=\gamma+\log (t) -t+\frac{t^2}{4}+O\left(t^3\right)$$ and for large $t$
$$\text{Ei}(-t)=e^{-t}
   \left(-\frac{1}{t}+\frac{1}{t^2}+O\left(\frac{1}{t^3}
   \right)\right)$$
So, for an infinite upper bound, the integral tend to $0$ and close to $0$
$$I=\frac{\gamma }{2}-x+\frac{3 x^2}{4}+O\left(x^3\right)$$ which shows the limit and also how it is approached.
A: A different proof. Let's use Gamma function.
$$I(a)=\int_{0}^{\infty} x^a \frac{e^{-x^{2}}-e^{-x}}{x}\text{d}x, \qquad a>0$$
$$\int_{0}^{\infty} x^{a-1} e^{-x^2} dx= \frac{1}{2} \int_{0}^{\infty} t^{a/2-1} e^{-t} dt= \frac{\Gamma(a/2)}{2}$$
$$\int_{0}^{\infty} x^{a-1} e^{-x} dx=\Gamma(a)$$
So our integral is:
$$I(1)=\frac{1}{2} \lim_{a \to 0} \left(\Gamma \left( \frac{a}{2} \right)-2\Gamma(a) \right)$$
$$I(1)=\frac{1}{2} \lim_{b \to 0} \left(\Gamma (b)-2\Gamma(2 b) \right)$$
There's a known identity:
$$\Gamma(2 b)= \frac{1}{2 \sqrt{\pi}}2^{2b} \Gamma(b) \Gamma \left(b+ \frac{1}{2} \right)$$
$$I(1)=\frac{1}{2} \lim_{b \to 0} \left(\Gamma (b)-\frac{2^{2b}}{\sqrt{\pi}} \Gamma(b) \Gamma \left(b+ \frac{1}{2} \right) \right)$$
$$I(1)=\frac{1}{2} \lim_{b \to 0}\Gamma (b) \left(1-\frac{2^{2b}}{\sqrt{\pi}} \Gamma \left(b+ \frac{1}{2} \right) \right)$$
Expanding the part in the brackets in a Taylor series and keeping the first term, we have:
$$I(1)=-\frac{1}{2} \lim_{b \to 0} b\Gamma (b) \left(2 \log 2+\psi \left( \frac{1}{2} \right) \right)$$
It's easy to prove:
$$\lim_{b \to 0} b\Gamma (b)=\lim_{b \to 0} \Gamma(1-b) \frac{\pi b}{\sin \pi b}=1$$
Thus we have:

$$I(1)=-\frac{1}{2} \left(2 \log 2+\psi \left( \frac{1}{2} \right) \right)= \frac{\gamma}{2}$$

To prove the last part we'll use one of the definitions for digamma:
$$\psi \left( \frac{1}{2} \right)=-\gamma+\sum_{n=1}^\infty \left( \frac{1}{n}-\frac{2}{2n-1} \right)$$
$$\sum_{n=1}^\infty \frac{y^{2n}}{n}=-\log(1-y)-\log(1+y)$$
$$\sum_{n=1}^\infty \frac{2y^{2n-1}}{2n-1}=2\text{arctanh}(y)=\log(1+y)-\log(1-y) $$
So we obtain:
$$\psi \left( \frac{1}{2} \right)=-\gamma+\lim_{y \to 1} \left(-2\log(1+y) \right)=-\gamma-2 \log 2$$
A: let we start 
$$first \ i\ will\ generalize\ the\ integral \\
\\
I=\int_{0}^{\infty }\frac{e^{-ax^{p}}-e^{-bx^{q}}}{x}dx\ \ \ \ \ \ \ \ \ \ \ \ \ for\ a\ , b\ ,\ q\ , p >0\\
\\
\\
\therefore I=\int_{0}^{\infty }\frac{e^{-ax^{p}}-e^{-bx^{q}}}{x}dx=\int_{0}^{\infty }\frac{e^{-ax^{p}}-e^{-ax^{q}}+e^{-ax^{q}}-e^{-bx^{q}}}{x}dx\\
\\
\\
=\int_{0}^{\infty }\frac{e^{-ax^{p}}-e^{-ax^{q}}}{x}dx+\int_{0}^{\infty }\frac{e^{-ax^{q}}-e^{-bx^{q}}}{x}dx=I_{1}+I_{2}$$
$$
now we will evaluate   $I_{1}$
$$I_{1}=\int_{0}^{\infty }\frac{e^{-ax^{p}}-e^{-ax^{q}}}{x}dx\ \ \ \ , \ let \ y=x^{p}\\
\\
\therefore I_{1}=\frac{1}{p}\int_{0}^{\infty }\frac{e^{-ay}-e^{-ay^{\frac{q}{p}}}}{y}dy\\
\\
=\frac{1}{p}\int_{0}^{\infty }(e^{-ay}-\frac{1}{1+y}).\frac{dy}{y}-\frac{1}{p}\int_{0}^{\infty }(e^{-ay^{\frac{q}{p}}}-\frac{1}{1+y}).\frac{dy}{y}\\
\\
\\
=\frac{1}{p}(-\gamma -ln(a))-\frac{1}{p}\int_{0}^{\infty }(e^{-at}-\frac{1}{1+t^{\frac{p}{q}}}).\frac{pdt}{qt}\\
\\
\\
=-(\frac{\gamma +ln(a)}{p})-\frac{1}{q}\int_{0}^{\infty }(e^{-at}-\frac{1}{1+t}+(\frac{1}{1+t})-\frac{1}{1+t^{\frac{p}{q}}}).\frac{dt}{t}$$
$$=-(\frac{\gamma +ln(a)}{p})+(\frac{\gamma +ln(a)}{q})+\frac{1}{q}\int_{0}^{\infty }(\frac{1}{1+t^{\frac{p}{q}}}-\frac{1}{1+t})\frac{dt}{t}\\
\\
\\
=(\gamma +ln(a))(\frac{1}{q}-\frac{1}{p})+\frac{1}{q}\int_{0}^{\infty }\frac{t-t^{\frac{p}{q}}}{(1+t)(1+t^{\frac{p}{q}})}.\frac{dt}{t}\\
\\
=(\gamma +ln(a))(\frac{1}{q}-\frac{1}{p})=I_{1}$$
now we compute I2
$$I_{2}=\int_{0}^{\infty }\frac{e^{-ax^{q}}-e^{-bx^{q}}}{x}dx\\
\\
\\
=\frac{1}{q}\int_{0}^{\infty }\frac{e^{-ay}-e^{-by}}{y}dy=\frac{1}{q}\int_{0}^{\infty }(e^{-ay}-\frac{1}{1+y}).\frac{dy}{y}-\frac{1}{q}\int_{0}^{\infty }(e^{-by}-\frac{1}{1+y})\frac{dy}{y}\\
\\
\\
=\frac{1}{q}(-\gamma -ln(a))-\frac{1}{q}(-\gamma -ln(a))=\frac{ln(\frac{b}{a})}{q}\\
\\$$
therefore we have  
$$\therefore I=(\gamma +ln(a))(\frac{1}{q}-\frac{1}{p})+\frac{ln(\frac{b}{a})}{q}\\
\\
\\
=\gamma (\frac{1}{q}-\frac{1}{p})+ln(\frac{b^{\frac{1}{q}}}{a^{\frac{1}{p}}})\\
\\
 now\ \ let \ put\ a=1\ \ , b=1\ \ , q=1\ \ , p=\frac{1}{2}\\
\\
\\
\therefore \int_{0}^{\infty }\frac{e^{-x^2}-e^{-x}}{x}dx=\frac{\gamma }{2}$$
