Applying Bayes’ rule to conditional probabilities with more than 2 variables

bayes-theoremconditional probability

Bayes' rule gives us the following equation:

$$P(X|Y) = \frac{P(X,Y)}{P(Y)} = \frac{1}{Z}P(X)P(Y|X)$$

where Z is a normalizer.

Now I saw that the following two equations holds according to Bayes' rule:

$$P(A|B,C,D) = \frac{1}{Z} P(B,C|A,D)P(A,D)$$

$$P(A|B,C) = \frac{P(B|A,C)P(A|C)}{P(B|C)}$$

Why is this true according to Bayes' rule? In opposite to Bayes' rule we condition on 2 (B,C,D) and 3 (B,C) variables and it is not clear to me how in this case Bayes' rule works.

Best Answer

The two equations can obtained by applying several times Bayes' rule and grouping the event : \begin{align*} \mathbb P[A|B,C,D] &= \frac{\mathbb P[A,(B,C,D)]}{\mathbb P[B,C,D]}\\ &=\frac{\mathbb P[A,B,C,D]}{\mathbb P[B,C,D]}\\ &=\frac{\mathbb P[(B,C),(A,D)]}{\mathbb P[B,C,D]}\\ &=\frac{\mathbb P[B,C|A,D]\mathbb P[A,D]}{\mathbb P[B,C,D]} \end{align*} and \begin{align*} \mathbb P[A|B,C] &= \frac{\mathbb P[A,(B,C)]}{\mathbb P[B,C]}\\ &=\frac{\mathbb P[B,(A,C)]}{\mathbb P[B,C]}\\ &=\frac{\mathbb P[B|A,C]\mathbb P[A,C]}{\mathbb P[B|C]\mathbb P[C]}\\ &=\frac{\mathbb P[B|A,C]\mathbb P[A|C]\mathbb P[C]}{\mathbb P[B|C]\mathbb P[C]}\\ &=\frac{\mathbb P[B|A,C]\mathbb P[A|C]}{\mathbb P[B|C]}\\ \end{align*}

Related Question