# Mean of log of $X$ with normal distribution: $\int^{\infty}_{-\infty} \log(| \alpha x + \beta |) \frac{ 1}{\sqrt{2\pi} }e^{\frac{-x^2}{2} }{\rm d}x$

The expectation of the log of the absolute value of random variable with the standard normal distrbution can be computed based on the result provided here 1.

How can this be computed for an arbitrary normal distrbution. It is equivalent to finding the following expectation:

$$\mathbb E [\log|\alpha X + \beta|]=\int^{\infty}_{-\infty} \log(| \alpha x + \beta |) \frac{1}{\sqrt{2\pi}} e^{\frac{-x^2}{2} }{\rm d}x$$

where $$X$$ has the standard normal distribution.

For $$\beta=0$$, the formula is

$$\mathbb E [\log|\alpha X|]=\log|\alpha|-\frac{1}{2} (\gamma +\log (2))$$

where $$\gamma$$ denotes the Euler's constant.

• If we were to drop the absolute value from the logarithm then the result, along with various generalizations, is given here math.stackexchange.com/questions/1359584/… . Commented Jan 23 at 15:17
• What is your motivation for asking that question? Is it a pure mathematical curiosity or does it have real life applications? Commented Jan 23 at 15:19
• @Przemo I think it is a good measure for comparing the magnitude of different distributions; it is even finite for the Cauchy distribution: math.stackexchange.com/q/4838543/1231520. You may also see the background discussed here for another application: math.stackexchange.com/q/4843188/1231520. Note that $$\mathbb E \left( \log(|1-\alpha X^2|) \right )=\mathbb E \bigg [ \log(|1-\sqrt{\alpha}X|)+\log(|1+\sqrt{\alpha}X|) \bigg ].$$
– Amir
Commented Jan 23 at 22:42
• @Przemo Regarding your first comment above, after dropping the absolute value, the log cannot be used for negative values. How did you manage this?
– Amir
Commented Jan 23 at 22:51
• Of course it can be. $\log (x) = \log(\left| x \right|) + \imath arg(x)$. Commented Jan 24 at 10:14

## Notations

• $$\displaystyle F(z):=\frac{\sqrt{\pi}}{2}e^{-z^2}\text{erfi}(z)\text{ is the Dawson integral}$$
• $$\gamma$$ is the Eulero-Mascheroni constant
• $${}_pF_q(a_1,...,a_p; b_1,...,b_q|z)$$ is the hypergemetric function
• P.V. is the principal value

You can use again the Feymann trick, but now it's more complex: \begin{align}\int_{-\infty}^{\infty}\frac{\ln\left(\left|ax+b\right|\right)}{\sqrt{2\pi}}e^{-\frac{x^{2}}{2}}dx=&\frac{\ln\left(\left|a\right|\right)}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-\frac{x^{2}}{2}}dx+\int_{-\infty}^{\infty}\frac{\ln\left(\left|x+\frac{b}{a}\right|\right)}{\sqrt{2\pi}}e^{-\frac{x^{2}}{2}}dx\\ =&\ln\left(\left|a\right|\right)+\int_{-\infty}^{\infty}\frac{\ln\left(\left|x+\frac{b}{a}\right|\right)}{\sqrt{2\pi}}e^{-\frac{x^{2}}{2}}dx\end{align}

Let $$G\left(s\right):=\int_{-\infty}^{\infty}\frac{\ln\left(\left|x+s\right|\right)}{\sqrt{2\pi}}e^{-\frac{x^{2}}{2}}dx$$ $$g\left(s\right):=G'(s)=\frac{1}{\sqrt{2\pi}}\text{P.V.}\int_{-\infty}^{\infty}\frac{e^{-\frac{x^{2}}{2}}}{x+s}dx=\sqrt{2}F\left(\frac{s}{\sqrt{2}}\right)$$

So $$G(s)=\frac{s^2}{2}{}_2F_2\left(\left.{1,1\atop\frac{3}{2},2}\right|-\frac{s^2}{2}\right)+c_0$$ $$c_0$$ is a constant and is determined by imposing the passage for $$0$$: $$c_0=\int_{-\infty}^{\infty}\frac{\ln\left(\left|x\right|\right)}{\sqrt{2\pi}}e^{-\frac{x^{2}}{2}}dx=-\frac{\ln\left(2\right)+\gamma}{2}$$

So

$$\color{blue}{\int_{-\infty}^{\infty}\frac{\ln\left(\left|ax+b\right|\right)}{\sqrt{2\pi}}e^{-\frac{x^{2}}{2}}dx=\ln(|a|)+\frac{b^2}{2a^2}\cdot{}_2F_2\left(\left.{1,1\atop\frac{3}{2},2}\right|-\frac{b^2}{2a^2}\right)-\frac{\ln\left(2\right)+\gamma}{2}}$$

P.S.: To check the correctness of my formula I leave you two Wolfram links: in the first the one with the integral, in the second the one with the solution (you can change the command and put random values, in this case I put $$a=6.2$$ and $$b=- 2.3$$)

## Update

In answer to the question if the hypergeometric function can be simplied the answer is no. At most I can give you a numerical method to calculate it yourself:

$${}_2F_2\left(\left.{1,1\atop\frac{3}{2},2}\right|-\frac{z^2}{2}\right)=2\sum_{n=0}^{\infty}\left(-1\right)^{n}\frac{2^{n}n!}{\left(2n+2\right)!}z^{2n}$$

• Thank you for the answer and links! Can the second term be simplified future?
– Amir
Commented Jan 5 at 10:23
• @Amir I updated the answer Commented Jan 5 at 11:27
• Thank you for your kind support!
– Amir
Commented Jan 5 at 14:39