How to fill in these steps to evaluate this Gaussian integral?

172 Views Asked by At

As a part of a much bigger problem, I came across this integral

$$\int_{-\infty}^{\infty}\ln(|x|)\frac{1}{\sigma \sqrt{2\pi}}e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}dx$$

which represents the expected value of a normal random variable after we take its log. Playing around with it and not getting anywhere, I plugged it into Mathemtica and it gave me

$$\ln\left(\frac{\sigma}{\sqrt{2}}\right)-\frac{\gamma}{2}-\left[\frac{\partial}{\partial a}1F1(a,b,z)\right]_{a=0,b=\frac{1}{2},z=-\frac{\mu^2}{2\sigma^2}}$$

where $1F1$ is the Kummer Confluent Hypergeometric Function and we take its partial derivative with respect to the first parameter and then plug in $a=0,b=\frac{1}{2},z=-\frac{\mu^2}{2\sigma^2}$. I was able to "simplify" the last term to get

$$\ln\left(\frac{\sigma}{\sqrt{2}}\right)-\frac{\gamma}{2}+\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{2^{n+1}}\cdot\frac{\sqrt{\pi}}{n \Gamma(n+1/2)}\cdot\left(\frac{\mu}{\sigma}\right)^{2n}$$

and I have verified all three expressions are equal numerically by computing the integral numerically (at least for $\mu/\sigma$ ratio being small). I also see that (using the $n$-th term test) that the sum converges for all real numbers. What I still don't understand is how to get from the first expression to the second one. I thought about maybe using Taylor series expansion for the Gaussian, multiply by log, but then I can't integrate them term by term on all of $\mathbb{R}$. Any help/hints/references will be appreciated. Thanks.


Addendum: If we make $\mu=0$, the sum is zero. So can we even say anything about how to get

$$\int_{-\infty}^{\infty}\ln(|x|)\frac{1}{\sigma \sqrt{2\pi}}e^{-\frac{1}{2}\left(\frac{x}{\sigma}\right)^2}dx=\ln\left(\frac{\sigma}{\sqrt{2}}\right)-\frac{\gamma}{2}?$$

1

There are 1 best solutions below

1
On BEST ANSWER

I will try to address the case for $\mu=0$. The integral for this case is: $$\frac{1}{\sigma} \sqrt{\frac{2}{\pi}}\int_0^{\infty} \ln(x)e^{-\frac{1}{2}\left(\frac{x}{\sigma}\right)^2}\,dx$$ With the substitution $\dfrac{x}{\sigma\sqrt{2}}=t$,

$$\begin{aligned} \frac{1}{\sigma} \sqrt{\frac{2}{\pi}}\int_0^{\infty} \ln(x)e^{-\frac{1}{2}\left(\frac{x}{\sigma}\right)^2}\,dx &=\frac{2}{\sqrt{\pi}}\int_0^{\infty} \ln(\sigma \sqrt{2}\,t)e^{-t^2}\,dt \\ &= \frac{2}{\sqrt{\pi}}\left(\ln(\sigma\sqrt{2})\int_0^{\infty} e^{-t^2}\,dt+\int_0^{\infty} e^{-t^2} \ln t\,dt\right)\\ &= \frac{2}{\sqrt{\pi}}\left(\frac{\sqrt{\pi}}{2}\ln(\sigma\sqrt{2})-\frac{\sqrt{\pi}}{4}(\gamma+2\ln 2)\right) \,\,\,\,\,\,\,(*)\\ &=\ln(\sigma \sqrt{2})-\ln2-\frac{\gamma}{2}\\ &=\ln\left(\frac{\sigma}{\sqrt{2}}\right)-\frac{\gamma}{2} \\ \end{aligned}$$

$(*)$ - I used the formula $(8)$ mentioned here: http://mathworld.wolfram.com/Euler-MascheroniConstant.html