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?

  • $\begingroup$ Your rearrangement is problematical, since $\log x$ is not defined for $x\le0$. $\endgroup$ Oct 31, 2017 at 4:02
  • $\begingroup$ If you used the fact that $\ln(x^2) = 2 \ln x$ while simplifying, then note that for $x$ negative, it must change to $2 \ln |x|$. $\endgroup$ Oct 31, 2017 at 4:04
  • 1
    $\begingroup$ Are you very sure the exponent should not be $-x^2/(2\sigma^2)\text{ ?} \qquad$ $\endgroup$ Oct 31, 2017 at 4:22
  • 2
    $\begingroup$ If we assume that this was supposed to say $$\int_{-\infty}^\infty \frac{\ln(x^2)e^{-x^2/(2\sigma^2)}}{(2\pi)^{1/2} \sigma}dx= \ln(\sigma^2)-\gamma-\ln(2),$$ then in probabilistic language, it says that if $X\sim N(0,\sigma^2),$ i.e. $X$ is normally distributed with expected value $0$ and standard deviation $\sigma,$ then $$\operatorname{E}(2\log|X|) = 2\log\sigma - \gamma-\log 2.$$ $\endgroup$ Oct 31, 2017 at 4:26
  • 1
    $\begingroup$ $$ \begin{align} \int_{-\infty}^\infty \frac{\ln(x^2)e^{-x^2/(2\sigma^2)}}{(2\pi)^{1/2} \sigma}dx & = 2\log\sigma - \int_{-\infty}^\infty 2\log|(x/\sigma)| \frac{e^{(-1/2)(x/\sigma)^2}}{\sqrt{2\pi}} \, \frac{dx} \sigma \\ \\ & = 2\log \sigma - \int_{-\infty}^\infty 2\log|u| \frac{e^{-(1/2)u^2}}{\sqrt{2\pi}} \,du. \end{align} $$ Thus it is easily seen that the value of the integral is $2\log\sigma$ plus something not depending on $\sigma. \qquad$ $\endgroup$ Oct 31, 2017 at 4:36

1 Answer 1


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}$.

  • $\begingroup$ I tried doing so research, but do you know how to prove $\frac{d}{dx}[\Gamma(1/2)] = (\pi)^\frac{1}{2}(-\gamma-2\ln(2))$ Or a link to somewhere with the proof? $\endgroup$
    – Tom Himler
    Oct 31, 2017 at 16:35
  • $\begingroup$ The simplest way is possibly via the digamma function $\psi(z) = \Gamma'(z)/\Gamma(z)$. The digamma function satisfies $$\psi(1+z) = -\gamma + \int_0^1 \frac{1-x^z}{1-x} dx $$ from which you can calculate $\psi(1/2)$ easily. You can learn more about these functions by consulting relevant books, online resources sometimes only list formula but no proofs. $\endgroup$
    – pisco
    Oct 31, 2017 at 17:46
  • $\begingroup$ Thanks, I really appreciate it. $\endgroup$
    – Tom Himler
    Nov 1, 2017 at 3:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .