4

How can you express p(x1|x2,x3) in terms of p(x2|x1,x3) and p(x1|x3) and p(x2|x3) with the help of the chain rule ?

enter image description here

Source:https://www.hackerearth.com/practice/machine-learning/prerequisites-of-machine-learning/bayes-rules-conditional-probability-chain-rule/tutorial/

what I tried: $p(x1|x2,x3) = \gamma* p(x1,x2,x3) = \gamma*p(x3|x1,x2)*p(x1,x2) = \gamma*\tau*p(x3|x1,x2)*p(x2|x1)*p(x1) $

... but the result should be: $$p(x1|x2,x3)=p(x1|x3,x2)=p(x2|x1,x3)*p(x1|x3)/p(x2|x3)$$

james
  • 303

1 Answers1

11

$$P(x_1\mid x_2, x_3)=_{\color{red}{\text{by def. of cond. prob.}}}=\frac{P(x_1,x_2,x_3)}{P(x_2,x_3)}=$$$$=_{\color{red}{\text{by the ch. rule. three times}}}=\frac{P(x_2\mid x_1,x_3)P(x_1\mid x_3)P(x_3)}{P(x_2\mid x_3)P(x_3)}=$$

$$=_{\color{red}{\text{canceling out...}}}=\frac{P(x_2\mid x_1,x_3)P(x_1\mid x_3)}{P(x_2\mid x_3)}$$

zoli
  • 20,452
  • Thank you very much for this very clear answer ! +1 I just have one question ? Why do you write that you use the chain rule 3 times ? I can only see that you applied it once to the nominator and once to the denominator, but I am probably wrong.... – james Jan 21 '18 at 10:14
  • 1
    First time: $P(x_1,x_2,x_3)=P(x_2\mid x_1,x_3)P(x_1,x_3).$ Second time $P(x_1,x_3)=P(x_1\mid x_3)P(x_3)$. Third time: in the denominator. : ) – zoli Jan 21 '18 at 10:18
  • Ah, I see. thanks a lot !! – james Jan 21 '18 at 10:21