# Evaluate integral over quadratic form [duplicate]

This question already has an answer here:

What would be the most kosher way to evaluate an integral like this in Mathematica: $$\int_\mathbb{R^3} \exp\left((x-b)^tA(x-b)\right)dx \ ?$$ Here $$A$$ is a real symmetric matrix and $$b$$ some vector in $$\mathbb{R^3}$$. Should I write everything out in components and integrate the expression $$\int_{\mathbb{R}}\int_{\mathbb{R}}\int_{\mathbb{R}}\exp \left( \sum_{i=1}^n\sum_{j=1}^n (x_i-b_i)^tA_{i,j}(x_j-b_j)) \right) dx_1dx_2dx_3 \ ,$$ or is there a more elegant way to do this by staying in the "vector notation" without writing the sums?

## marked as duplicate by AccidentalFourierTransform, Henrik Schumacher, Daniel Lichtblau, m_goldberg, Thies HeideckeJun 3 at 15:52

• But in other words. – user64494 Jun 3 at 15:11
• Most elegant way in this case would be to do this integral analytically. Expand brackets, diagonalize by an orthogonal transformation, complete squares etc. – Kagaratsch Jun 3 at 15:13
• @Kagaratsch Yes, I know how to do it by hand. But that is not the topic of this site. – Jannik Pitt Jun 3 at 15:38

If you give the integral an explicit matrix, then Integrate can solve it:
A = {{-5,-5,7/2},{0,-10,7/2},{0,0,-3}};

• The OP mentioned symmetric matrices and in that case there is a symbolic result. For example: n = 3; A = Table[a[Min[i, j], Max[i, j]], {i, n}, {j, n}]; Integrate[Exp[x.A.x], x \[Element] FullRegion[n]] as I think b can be anything. – JimB Jun 3 at 16:41