# Finding the conditional probability from the given chain of random variables

Consider the following simple Bayesian network, where all the nodes are assumed to be binary random variables, i.e., X=x0 or x1 with certain probabilities, and similar notations will be used for Y, Z, and W.

(X)->(Y)->(Z)->(W)

This Bayesian network is fully specified if we are given the following (conditional) probabilities: (for notational simplicity, we write P(x1) to mean P(X=x1), and so on)

P(x1) = 0.60; P(y1 | x1) = 0.40, P(z1 | y1) = 0.25, P(w1 | z1) = 0.45, P(y1 | x0) = 0.30; P(z1 | y0) = 0.60; P(w1 | z0) = 0.30;

From the above information I was able to calculate P(y0),p(y1),p(z0),p(z1),p(w0) and p(w1). I want to find the value of P(wo|x1). How should I proceed?

## 1 Answer

Apply the Law of Total Expectation

$$P(w_0\mid x_1) ~{~=~P(w_0,x_1)/P(x_1) \\~=~ \sum\limits_{b\in\{0,1\}}\sum\limits_{c\in\{0,1\}} P(w_0,z_c,y_b, x_1)/P(x_1)\\~=~ \phantom{\sum\limits_{b\in\{0,1\}}\sum\limits_{c\in\{0,1\}} P(w_0\mid z_c)P(z_c\mid y_b)P(y_b\mid x_1)}}$$

• you mean it should be the summation of the 4 terms (combination of b and c)?? – Hariharan Adhithya Sep 21 '17 at 17:13
• Yes. That is what it means. A sum of four terms each of three factors. – Graham Kemp Sep 21 '17 at 17:24
• But how do I expand P(w0,Zc,Yb,x1)? Can you please give me all the steps? – Hariharan Adhithya Sep 21 '17 at 17:55
• Basically use the same steps you used to calculate $P(y_0)$ and $P(y_1)$. – Graham Kemp Sep 21 '17 at 23:41
• is P(y0) = P(y1 | x1)+P(y1 | x0)? – Hariharan Adhithya Sep 22 '17 at 3:25