# $E(\frac{1}{1+x^2})$ under a Gaussian

This question is leading on from the following question. https://math.stackexchange.com/questions/360275/e1-1x2-under-a-normal-distribution

Basically what is the $E\left(\frac{1}{1+x^2}\right)$ under a general Gaussian $\mathcal{N}(\mu,\sigma^2)$. I tried rewriting $\frac{1}{1+x^2}$ as a scalar mixture of Gaussians ($\propto \int\mathcal{N}(x|0,\tau^{-1})Ga(\tau|1/2,1/2)d\tau$). This also came to a halt, unless you folks have got a trick under your belt.

If this integral isn't analytical any sensible bounds?

• why can't you do the same as in the question you linked to? (which implies it is not analytic ( since it evaluates to erfc with a few constants) Commented Jul 29, 2014 at 9:14
• Because I don't follow what he has done completely. Also erfc is fine Commented Jul 29, 2014 at 10:16

Let $f_\sigma(x) = \frac{1}{\sqrt{2\pi}\sigma}\exp\left(-\frac{x^2}{2\sigma^2}\right)$ be the Normal$(0,\sigma)$ PDF and $g(x) = \frac{1}{\pi}\left(1+x^2\right)^{-1}$ be the PDF of a Student t distribution with one d.f. Because the PDF of a Normal$(\mu,\sigma)$ variable $X$ is $f_\sigma(x-\mu) = f_\sigma(\mu-x)$ (by symmetry), the expectation equals

$$\mathbb{E}_{\sigma,\mu}\left(\frac{1}{1+X^2}\right) = \mathbb{E}_{\sigma,\mu}\left(\pi g(X)\right) = \int_\mathbb{R} f_\sigma\left((\mu-x)^2\right) \pi g(x)dx.$$

This is the defining formula for the convolution $(f\star \pi g)(\mu)$. The most basic result of Fourier analysis is that the Fourier transform of a convolution is the product of Fourier transforms. Moreover, characteristic functions (c.f.) are (up to suitable multiples) Fourier transforms of PDFs. The c.f. of a Normal$(0,\sigma)$ distribution is

$$\widehat{f}_\sigma(t) = \exp(-t^2\sigma^2/2)$$

and the c.f. of this Student t distribution is

$$\widehat{g}(t) = \exp(-|t|).$$

(Both can be obtained by elementary methods.) The value of the inverse Fourier transform of their product at $\mu$ is, by definition,

$$\frac{1}{2\pi}\int_\mathbb{R} \widehat{f}_\sigma(t)\pi\widehat{g}(t) \exp(-i t \mu) dt =\frac{1}{2}\int_\mathbb{R} \exp(-t^2\sigma^2/2-|t|-i t \mu) dt.$$

Its calculation is elementary: carry it out separately over the intervals $(-\infty,0]$ and $[0,\infty)$ to simplify $|t|$ to $-t$ and $t$, respectively, and complete the square each time. Integrals akin to the Normal CDF are obtained--but with complex arguments. One way to write the solution is

$$\mathbb{E}_{\sigma,\mu}\left(\frac{1}{1+X^2}\right) = \frac{\sqrt{\frac{\pi }{2}} e^{-\frac{(\mu +i)^2}{2 \sigma ^2}} \left(e^{\frac{2 i \mu }{\sigma ^2}} \text{erfc}\left(\frac{1+i \mu }{\sqrt{2} \sigma }\right)-\text{erf}\left(\frac{-1+i\mu}{\sqrt{2} \sigma }\right)+1\right)}{2 \sigma }.$$

Here, $\text{erfc}(z) = 1 - \text{erf}(z)$ is the complementary error function where

$$\text{erf}(z) = \frac{2}{\sqrt{\pi}}\int_0^z \exp(-t^2)dt.$$

A special case is $\mu=0, \sigma=1$ for which this expression reduces to $$\mathbb{E}_{1, 0}\left(\frac{1}{1+X^2}\right) = \sqrt{\frac{e\pi}{2}}\text{erfc}\left(\frac{1}{\sqrt{2}}\right)=0.65567954241879847154\ldots.$$

Here is contour plot of $\mathbb{E}_{\sigma,\mu}$ (on a logarithmic axis for $\sigma$).

• +1. Small note: $\sqrt{\frac{e\pi}{2}}\text{erfc}\left(\frac{1}{\sqrt{2}}\right)$ equals $0.6556795424\ldots$ for me which agrees with @fabee's numerical answer. Commented Jul 29, 2014 at 16:37
• Nice. I actually totally missed that this is the density of the sum of a Gaussian and a t-distributed variable (up to normalization). +1 for deriving the general formula for arbitrary $\mu$ and $\sigma$. Commented Jul 29, 2014 at 17:53
• @COOL Thanks--I copied the wrong answer. (I did several numerical calculations; the one I mis-reported was actually for $\mu=1,\sigma=1/2$.) I'll paste in the right one.
– whuber
Commented Jul 29, 2014 at 18:45

This is an idea how to solve it which uses the identity $$\frac{1}{S}=\int_0^\infty \exp(-tS)dt$$ which was proposed by Did here. You could use

\begin{align}E\left(\frac{1}{x^2+1}\right) &= \frac{1}{\sqrt{2\pi}}\int_0^\infty \int_{-\infty}^{\infty}\exp\left(-t(x^2+1)\right)\exp\left(-\frac{x^2}{2}\right)\mathrm dx \mathrm dt\\ &=\int_0^\infty \exp\left(-t\right)\left(1+2t\right)^{-\frac{1}{2}} \mathrm dt\\ &=\sqrt{\frac{e\pi}{2}}\left[\mbox{erf}\left(\sqrt{t+\frac{1}{2}}\right)\right]_0^\infty\\ &=\sqrt{\frac{e\pi}{2}}\left(1-\mbox{erf}\left(\sqrt{\frac{1}{2}}\right)\right)\end{align}

• +1 For the approach. I believe the factor of $1/\sqrt{2\pi}$ does not belong in the result, though.
– whuber
Commented Jul 29, 2014 at 12:47
• That's the normalization constant $\frac{1}{\sqrt{2\pi\sigma^2}}$ for the Gaussian (comes from the expectation). So, unless I am missing something, I think it does belong there. Commented Jul 29, 2014 at 13:18
• You have conflated the error function with the Gaussian CDF: they are not the same. Try a numerical calculation--you will see the error.
– whuber
Commented Jul 29, 2014 at 13:45
• You are correct, the factor was wrong. But it happened before I used the error function. I computed the expectation of $\exp(-t x^2)$ w.r.t. $x$ and forgot to remove the normalization constant afterwards. Thanks for the hint. Commented Jul 29, 2014 at 14:07