# Problem using continuous bayes theorem on multivariate normal distribution

Given three correlated normally distributed variables $x$, $y$ and $z$ such that:

$p\left(\begin{bmatrix} x \\ y\\ z\end{bmatrix}\right) \sim \mathcal{N}\left(\begin{bmatrix} 0 \\ 0\\ 0\end{bmatrix}, \begin{bmatrix} \Sigma_{xx} & 0 & \Sigma_{xz} \\ 0 & \Sigma_{yy} & \Sigma_{xz} \\ \Sigma_{xz}^{T} & \Sigma_{yz}^{T} & \Sigma_{zz} \end{bmatrix}\right)$,

Using the laws of conditional distribution of normal distribution:

$p(x|y,z) \sim N\left(0 + \begin{bmatrix} K_y \\ K_z \end{bmatrix}^{T} \left[ \begin{array}{c} y \\ z \end{array} \right], \Sigma_{xx} - \begin{bmatrix} K_y \\ K_z \end{bmatrix}^{T} \left[ \begin{array}{c} 0 \\ \Sigma_{xz} \end{array} \right] \right)$

where

$\begin{bmatrix} K_y \\ K_z \end{bmatrix}^{T} = [0 \, \, \, \, \, \Sigma_{xz}] \left[ \begin{array}{cc}\Sigma_{yy} & \Sigma_{yz} \\ \Sigma_{yz} & \Sigma_{zz} \end{array} \right]^{-1}$

and

$p(x|z) \sim N\left(0 + \Sigma_{xz}\Sigma_{zz}^{-1}(z), \Sigma_{xx} - \Sigma_{xz}\Sigma^{-1}_{zz}\Sigma_{xz} \right)$

Then using Bayes theorem:

$p(x|z) = \int_{-\infty}^{\infty} p(x|z, y=\epsilon) p(y=\epsilon) d\epsilon \sim \mathcal{N} \left( K_z z, \Sigma_{xx} - \begin{bmatrix} K_y \\ K_z \end{bmatrix}^{T} \left[ \begin{array}{c} 0 \\ \Sigma_{xz} \end{array} \right] + K_y \Sigma_{yy} K_y^{T} \right)$

however when I expand $K_z$ it results in a false statement:

$K_z = \Sigma_{xz} (\Sigma_{zz} - \Sigma_{zx} \Sigma_{xx}^{-1} \Sigma_{xz})^{-1} = \Sigma_{xz} \Sigma{zz}^{-1}$

I tried redoing the integral and could not find my mistake. Could someone enlight me on this step?

After a few days I was able to solve my own question.

The problem on my claim is when using the Bayes theorem, that is written incorrectly, the correct form would be:

$p(x|z) = \int_{-\infty}^{\infty} p(x|z, y=\epsilon) p(y=\epsilon|z) d\epsilon$

then the values becomes the same.