# Marginalizing the product of conditional probabilities

When learning about Bayesian networks, I come across a statement where one of the term $$X_2$$ was marginalized away:

$$\sum_{X_2} P(X_3|X_2)P(X_2|X_1) = P(X_3|X_1)$$

It is not clear to me why this is so. From the definition of conditional probability, I get: $$\sum_{X_2} P(X_3|X_2)P(X_2|X_1) = \sum_{X_2} \frac{P(X_3,X_2)}{P(X_2)}\frac{P(X_2,X_1)}{P(X_1)}$$

I know the equation for marginalizing for a joint probability, $$\sum_{X_2}P(X_1,X_2) = P(X_1)$$

But I don't know how to combine these together and handle the product between probabilities to prove the 1st statement

## 1 Answer

First check that the kwown marginalization formula $$\sum_{X_2}P(X_2, X_3) = P(X_3) \tag1$$

is also valid when everything is conditioned on an additional variable (you can check that in this particular case, but this is true in general, conditioning on an additional variable just defines new variables on a new restricted universe):

$$\sum_{X_2}P(X_2,X_3 | X_1) = P(X_3| X_1) \tag2$$

Then notice that $$P(X_2,X_3 | X_1) = P(X_3 | X_2, X_1) P(X_2 | X_1)$$ ( again, this is the same as the known formula $$P(X_2,X_3) = P(X_3 | X_2) P(X_2)$$, only that everything is aditionally conditioned on $$X_1$$)

Hence the formula you post is not true in general, it's true only if $$P(X_3 | X_2, X_1)=P(X_3 | X_2)$$ , that is, if $$X_1 \to X_2 \to X_3$$ (Markov property).

• Thank you for your answer! Yes it was stated that the there is an assumption of local markov property. Feb 27 '21 at 13:51