# Expectation and direct integration give different results [closed]

I have an integral I want to compute:

$$\qquad \int_{\mathbb R^4} e^{-(x_1+x_2+x_3+x_4)} \left( 1-x_1-x_3 \right) dx$$

To me, this should be equivalent (modulo some scaling factor) to computing the expectation of $$(1-x_1^2-x_3^2+ 0 x_2 + 0 x_4)$$ when $$x$$ is a zero-mean Gaussian variable with variance $$2I_4$$. See How to deal with complicated Gaussian integrals in Mathematica?).

So I tried

Sqrt[(2 Pi)^4] Sqrt[2^4]
Expectation[
(1 - x1^2 - x3^2),
{x1, x2, x3, x4} \[Distributed] MultinormalDistribution[2 IdentityMatrix]]


which gives $$-48 \pi^2$$. However, when I compute

Integrate[Exp[-x1^2 - x2^2 - x3^2 - x4^2] (1 - x1^2 - x3^2),
{x1, -Infinity, Infinity}, {x2,-Infinity,Infinity},
{x3, -Infinity,Infinity}, {x4, -Infinity, Infinity}]


The result is $$0$$.

I am not sure what is going on here. Which one is correct?.

• I think the variance should be 1/2 IdentityMatrix. – b.gates.you.know.what Dec 16 '19 at 13:45
• True, which actually gives 0. – NoobNoob Dec 16 '19 at 13:51

If you only consider the part x1,x3 of your integral Integrate[ Exp[-x1^2 - x3^2 ] (1 - x1^2 - x3^2), {x1, -Infinity, Infinity}, {x3, -Infinity, Infinity} ] its possible to transform in polarcoordinates (pointsymmetrical integrand!) which gives
Integrate[Exp[-r^2] (1 -r^2) 2Pi r, {r, -Infinity,Infinity}  ]

That means your Integrate`-result is ok!