# How to calculate an intersection in bayesian network

I was trying to solve this question, but i don't know how to proceed from there. And i am not sure how to compute $$P(A|X_1,X_2,\neg X_3)$$ or $$P(A \cap X_1\cap X_2)$$. It seems like i don't understand something fundamentally important about Bayesian Belief networks.

# The Question

Given the following information, Calculate $$P(A|X_1,X_2,\neg X_3 )$$and $$P(X_3|X_1)$$

• $$P(A) = 0.5$$
• $$P(X_i|A) = 0.8$$
• $$P(X_i| \neg A) = 0.4$$

Network visualization

### Solution for $$P(A|X_1,X_2,\neg X_3)$$

$$P(A,X_1,X_2, X_3) = P(A)\times P(X_1|A)\times P(X_2|A)\times P(X_3|A)$$ $$P(A|X_1,X_2,\neg X_3) =$$

### Solution for $$P(X_3|X_1)$$

$$P(X_3|X_1) = \frac{P(X_1\cap X_3)}{P(X_1)}$$

$$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{P(A\cap X_1)+ P(\neg A\cap X_1)}$$ $$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{P(X_1|A)\times P(A)+ P(X_1|\neg A)\times P(\neg A)}$$

$$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{0.8\times 0.5+ 0.4\times 0.5}$$ $$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{0.6}$$

• The definition of conditional probability is $$\mathbf{P}(A \mid B) = \dfrac{\mathbf{P}(A \cap B)}{\mathbf{P}(B)}.$$ If $B = B_1 \cap B_2,$ you can multiply and divide by the same, say $\mathbf{P}(B_2).$ Then $$\mathbf{P}(A \mid B) = \dfrac{\mathbf{P}(A \cap B_1 \cap B_2)}{\mathbf{P}(B_1 \cap B_2)} \dfrac{\mathbf{P}(B_2)}{\mathbf{P}(B_2)} = \dfrac{\mathbf{P}(A \cap B_1 \mid B_2)}{\mathbf{P}(B_1 \mid B_2)}.$$ You can continue in this fashion with as many events as you want; all these relations come from the definition (first equation written). Jan 21, 2022 at 17:24
• Also, $\mathbf{P}(A^\complement) = 1- \mathbf{P}(A).$ Furthermore, how are the events $X_i$ related (are they independent)? Jan 21, 2022 at 17:25
• The question doesn't state that. I assumed events $X_i$ are independent. Because otherwise I got probabilities bigger than 1.
– osbm
Jan 21, 2022 at 18:19

This notation with commas really confuses me. But I think they are the same.

$$P(A \cap B) = P(A, B)$$

### Solution for $$P(A|X_1,X_2,\neg X_3)$$

$$P(A,X_1,X_2, X_3) = P(A)\times P(X_1|A)\times P(X_2|A)\times P(X_3|A)$$ $$P(A|X_1,X_2,\neg X_3) = \frac{P(A, X_1, X_2, \neg X_3)}{P( X_1, X_2, \neg X_3)}$$ $$= \frac{P(A)\times P(X_1|A)\times P(X_2|A)\times P(\neg X_3|A)}{P(X_1|A)\times P(X_2|A)\times P(\neg X_3|A)}$$ $$= \frac{0.5\times 0.8\times 0.8\times 0.2}{0.8\times 0.8\times 0.2}=0.5$$

### Solution for $$P(X_3|X_1)$$

$$P(X_3|X_1) = \frac{P(X_1\cap X_3)}{P(X_1)}$$

$$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{P(A\cap X_1)+ P(\neg A\cap X_1)}$$ $$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{P(X_1|A)\times P(A)+ P(X_1|\neg A)\times P(\neg A)}$$

$$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{0.8\times 0.5+ 0.4\times 0.5}$$ $$= \frac{P(A \cap X_1\cap X_3) + P(\neg A \cap X_1\cap X_3)}{0.6}$$ $$= \frac{P(A)\times P(X_1|A)\times P(X_3|A) + P(\neg A)\times P(X_1|\neg A)\times P(X_3|\neg A)}{0.6}$$ $$\frac{0.5 \times 0.8\times 0.8 + 0.5 \times 0.4\times 0.4}{0.6} = \frac{0.32 + 0.08}{0.6} = \frac{0.40}{0.6} = 0.\overline 6$$