I want to calculate the following Integration $$\int \mathcal{N}\left(\mathbf{x} \mid \boldsymbol{\mu}, \boldsymbol{\Lambda}^{-1}\right) \cdot \mathcal{N}\left(\boldsymbol{\mu} \mid \mathbf{m},\left(\beta \boldsymbol{\Lambda}\right)^{-1}\right) d \boldsymbol{\mu}$$ and the answer is $$ \mathcal{N}\left(\mathbf{x} \mid \boldsymbol{m}, (1 + \beta^{-1})\boldsymbol{\Lambda}^{-1}\right)$$ How to get this answer?

  • 2
    $\begingroup$ What have you tried doing so far? The main trick to completing the integration is combining the exponentials into one and then completing the square within the exponential. $\endgroup$
    – jcken
    Commented Jul 1, 2020 at 7:14
  • 2
    $\begingroup$ The question is more about the marginal distribution in a Normal - Normal model that about integration per se. The solution is available from standard Bayesian textbooks, if need be. $\endgroup$
    – Xi'an
    Commented Jul 1, 2020 at 7:49
  • $\begingroup$ The technique is called completing the square. $\endgroup$
    – whuber
    Commented Jul 1, 2020 at 13:31

1 Answer 1


There is a conclusion in Session 2.3.3 of PRML

Given a marginal Gaussian distribution for x and a conditional Gaussian distribution for y given x in the form $$\begin{aligned} p(\mathbf{x}) &=\mathcal{N}\left(\mathbf{x} \mid \boldsymbol{\mu}, \mathbf{\Lambda}^{-1}\right) \\ p(\mathbf{y} \mid \mathbf{x}) &=\mathcal{N}\left(\mathbf{y} \mid \mathbf{A} \mathbf{x}+\mathbf{b}, \mathbf{L}^{-1}\right) \end{aligned}$$ the marginal distribution of y and the conditional distribution of x given y are given by $$p(\mathbf{y})=\mathcal{N}\left(\mathbf{y} \mid \mathbf{A} \boldsymbol{\mu}+\mathbf{b}, \mathbf{L}^{-1}+\mathbf{A} \mathbf{\Lambda}^{-1} \mathbf{A}^{\mathrm{T}}\right)$$

Here, we have $$p(\boldsymbol{\mu}) = \mathcal{N} (\boldsymbol{\mu}|\boldsymbol{m}, (\beta \mathbf{\Lambda})^{-1})$$ $$p(\boldsymbol{x}|\boldsymbol{\mu}) = \mathcal{N}(\boldsymbol{x}|\boldsymbol{\mu}, \mathbf{\Lambda}^{-1}) = \mathcal{N}(\boldsymbol{x}|\boldsymbol{I}\boldsymbol{\mu}+0, \mathbf{\Lambda}^{-1})$$ then, we have the marginal distribution $$p(\boldsymbol{x}) = \mathcal{N}(\boldsymbol{I}\boldsymbol{m}+0, \boldsymbol{\Lambda}^{-1}+\boldsymbol{I}(\beta \boldsymbol{\Lambda})^{-1}\boldsymbol{I})=\mathcal{N}(\boldsymbol{x}|\boldsymbol{m}, (1+\beta)\boldsymbol{\Lambda}^{-1})$$

Hence, $$\int p(\boldsymbol{x}|\boldsymbol{\mu})p(\boldsymbol{\mu})d\boldsymbol{\mu}=p(\boldsymbol{x})=\mathcal{N}(\boldsymbol{x}|\boldsymbol{m}, (1+\beta)\boldsymbol{\Lambda}^{-1})$$ Just as required.


Not the answer you're looking for? Browse other questions tagged or ask your own question.