TITLE: What's the derivation of this integral formula?
QUESTION [5 upvotes]: I was searching around the web for some information about integrals and I came across the formula:
$$\int_{-\infty}^\infty \frac{\ln(x^2)e^{\frac{-x^2}{2\sigma}}}{(2\pi)^\frac{1}{2}\sigma}dx= \ln(\sigma^2)-\gamma-\ln(2)$$
$\gamma =$ the Euler-Mascheroni Constant
I'm very unsure where the Euler-Mascheroni constant came from. I tried rearranging the integral to simpler terms but I end up getting:
$$\int_{-\infty}^\infty \ln|x|e^{-x^2}dx$$
which isn't overtly integrable. Where does this formula come from?

REPLY [3 votes]: Throw out unecessary constants and since the integrand is even, the problem reduces to evaluate:
$$I=\int_0^\infty \ln(x^2) e^{-ax^2} dx$$
Enforcing the subsitution $x=(u/a)^{1/2}$ gives $$I = \frac{1}{2\sqrt{a}} \left[\int_0^\infty u^{-1/2} e^{-u}\ln u \, du - \ln a \int_0^\infty u^{-1/2}e^{-u}\ du \right]$$
The first integral is just $\Gamma'(1/2)=\sqrt{\pi}(-\gamma-2\ln 2)$, the second integral is $\Gamma(1/2)=\sqrt{\pi}$.