# Integrate $\exp[-x^T M x + r^T x]$ when M is a block matrix

I need to evaluate an integral of the form

$$\int_{-\infty}^\infty ... \int_{-\infty}^\infty \exp[-\mathbf{x}^T\mathbf{M}\mathbf{x} + \mathbf{r}^T\mathbf{x}] dx_1...dx_N$$

I know that when $\mathbf{r} = \mathbf{0}$, the integral is simply $\sqrt{\frac{\pi^N}{\det\mathbf{M}}}$. The matrix, $\mathbf{M}$, is large but its structure is block

$$\mathbf{M} = \begin{bmatrix} \mathbf{A} & \mathbf{G} \\ \mathbf{G}^T & \mathbf{0} \end{bmatrix}$$

where $\mathbf{A}$ is also block diagonal, so that the determinant of $\mathbf{M}$ is not difficult to find in closed form (by decomposing into a product of matrices with determinants that are much easier to calculate). However, when $\mathbf{r} \neq \mathbf{0}$ then the only way I know to evaluate the integral is to diagonalize $\mathbf{M}$ by $\mathbf{P} \mathbf{M} \mathbf{P}^T$, rotate $\mathbf{r}$, and complete the square. This requires that I find the eigenvectors and eigenvalues of $\mathbf{M}$. Is there either (1) a simpler way to find the eigenvalues and eigenvectors of $\mathbf{M}$ that makes use of its structure ($\mathbf{A}$ is $5M \times 5M$ consisting of $5 \times 5$ blocks, $\mathbf{G}$ is $3 \times 5M$ and $N = 5M + 3$) or (2) an alternative way to evaluate the integral that does not require finding the eigenvalues and eigenvectors of $\mathbf{M}$?

• Do the completion of the squares business and compute. At the end in the result, the factorization of $M$ gets back together, and the result can be put in terms of $M$ and $r$ without computing factorizations of $M$. There is a factor, of the result that is the determinant of a square root of $M$, but that is just the square root of of the determinant of $M$, which doesn't require the factorization of $M$ to be computed. – Peyton Aug 2 '17 at 3:10

Let $M=A^TA$, where $A$ might be complex.
Therefore, making the change of variable $y=Ax-(A^{-1})^Tr$ in the integral we get that it is equal to
$\det(A^{-1})e^{\frac{1}{4}r^TM^{-1}r}\int e^{-y^Ty}=\frac{1}{\sqrt{\det(M)}}e^{\frac{1}{4}r^TM^{-1}r}\sqrt{\pi^N}$