Gaussian multi-variate integral I would like to compute the following integral
$$
I_n = \frac{1}{\sqrt{det(2\pi A)}} \int_{\mathbb{R}^n} ||x||^2_2 \exp\left(-\frac{1}{2} x^TAx\right) \mathrm{d} x
$$
where $A$ is symmetric and positive definite.
Any suggestions or hints? Thanks in advance! 
 A: The strategy for dealing with this sort of integral is to start with the integral
$$\int \exp\left(-\frac12 x^TAx+c^Tx\right)\,dx$$
for some fixed vector $c$.
If we then make the change of variables $x\mapsto x+A^{-1}c$, that integral becomes
$$\int\exp\left(-\frac12 x^TAx+\frac12c^TA^{-1}c\right)\,dx=\sqrt{\det(2\pi A)}\exp\left(\frac12c^TA^{-1}c\right).$$
Now comes the trick: we differentiate the integral with respect to $c_i$ and $c_j$ (the $i$th and $j$th components of the $c$ vector), and then set $c=0$:
$$\frac{\partial^2}{\partial c_i\partial c_j}\int \exp\left(-\frac12 x^TAx+c^Tx\right)\,dx=\sqrt{\det(2\pi A)}\frac{\partial^2}{\partial c_i\partial c_j}\exp\left(\frac12c^TA^{-1}c\right)$$
$$\int x_ix_j\exp\left(-\frac12 x^TAx\right)\,dx=\sqrt{\det(2\pi A)}(A^{-1})_{ij}$$
where $(A^{-1})_{ij}$ is the $i,j$ entry of the matrix $A^{-1}$.
Now you can just sum over the pairs $x_ix_j$ that you want; in your case you have $\|x\|_2^2=\sum_{i=1}^nx_ix_i$, so you get $\sum_{i=1}^n (A^{-1})_{ii}=\boxed{\operatorname{Tr}A^{-1}}$.
