# How can I integrate over the product of two multivariate normal distributions?

Suppose that $$\mathbf{y} \sim N(\mathbf{n},\sigma^2\mathbf{I})$$ and $$\mathbf{n} \sim N(\boldsymbol{\mu},\boldsymbol{\Sigma})$$. I want to integrate the following:

$$\int [\mathbf{y}\mid\mathbf{n},\sigma^2][\mathbf{n} \mid \boldsymbol{\mu},\boldsymbol{\Sigma}] \, d\mathbf{n},$$ where $$[\cdot]$$ indicates a probability distribution.

I take it that $$\mathbf{y}$$ and $$\mathbf{n}$$ have multivariate normal distributions, so I really want to solve the integral:

$$\int (2\pi)^{-\frac{1}{2}(k+k)} \det(\sigma^2\mathbf{I})^{-1/2} \det(\boldsymbol{\Sigma})^{-1/2} \exp\left[-\frac{1}{2}((\mathbf{y}-\mathbf{n})^T (\sigma^2\mathbf{I})^{-1}(\mathbf{y}-\mathbf{n}) + (\mathbf{n}-\boldsymbol{\mu})^T(\boldsymbol{\Sigma})^{-1}(\mathbf{n}-\boldsymbol{\mu})\right] \, d\mathbf{n},$$

where $$k$$ is the dimension of y and of n.

However, I don't know what to do next. Is there some standard trick that mathematicians use to complete this integration? I take it that the result is a multivariate normal. Thank you.

• At this point where you say "a probability distribution" you probably mean a probability density function. Commented Jun 18, 2020 at 18:47
• Write the expression in the [ ] brackets in the form $(\mathbf{n} - \mathbf{c})^TB^{-1}(\mathbf{n} - \mathbf{c}) + \gamma$ for a suitable matrix $B$, suitable $\mathbf{c}$, and suitable $\gamma$. This is essentially an exercise in completing the square. This is now again a multiple of the density of a normal distribution, and you can integrate. Commented Jun 18, 2020 at 19:10
• en.wikipedia.org/wiki/…
– user762914
Commented Jun 18, 2020 at 19:19
• \begin{align} & \text{Instead of } \mathbf{y} \sim N(\mathbf{n}, \sigma^2\mathbf{I}), \text{ I'd write }\mathbf{y} \mid \mathbf n \sim N(\mathbf{\mu},\sigma^2\mathbf{I}). \\ & \text{From the above it follows that }\mathbf y- \mathbf n \mid N \sim N(\mathbf 0, \sigma^2 \mathbf I). \\ {} \\ & \text{Since the conditional distribution of } \mathbf y - \mathbf n\text{ given } \mathbf n \text{ is} \\ & \text{thus seen not to depend on } \mathbf n, \text{ we can draw two conclusions:} \end{align} Commented Jun 18, 2020 at 21:46
• \begin{align} & \bullet\quad \mathbf y - \mathbf n \text{ and } \mathbf n \text{ are independent; and} \\ \\ & \bullet\quad \text{The marginal (or “unconditional'', if you like) distribution} \\ & \phantom{\bullet\quad\text{o}} \text{of } \mathbf y - \mathbf n \text{ is the same as this given conditional distribution.} \end{align} Commented Jun 18, 2020 at 21:47