Week 3
Conditional Probability and Bayes Applications
1. Conditional Probability: Let 𝐴, 𝐵 be two events. The conditional
probability of 𝐴 given 𝐵 (that is, B has occurred), denoted by 𝑃(𝐴|𝐵), is
defined as
𝑃(𝐴|𝐵) = 𝑃(𝐴 𝑎𝑛𝑑 𝐵)/𝑃(𝐵) = 𝑃(𝐴 ∩ 𝐵) 𝑃(𝐵) .
The above realtion leads to:
𝑃(𝐴 𝑎𝑛𝑑 𝐵) = 𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐴|𝐵)𝑃(𝐵); 𝑃(𝐴 𝑎𝑛𝑑 𝐵) = 𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐵|𝐴)𝑃(𝐴).
If 𝐴 and 𝐵 are disjoint, then 𝑃(𝐴|𝐵) = 0.
General rule: For any three events 𝐴1 , 𝐴2 , 𝐴3 we have
𝑃(𝐴1 ∩ 𝐴2 ∩ 𝐴3 ) = 𝑃(𝐴1 )𝑃(𝐴2 |𝐴1 )𝑃(𝐴3 |𝐴1 ∩ 𝐴2 )
In words, the probability that 𝐴1 and 𝐴2 and 𝐴3 all occur is equal to the
probability that 𝐴1 occurs times the probability that 𝐴2 occurs given that 𝐴1
has occurred times the probability that 𝐴3 occurs given that both 𝐴1 and 𝐴2
have occurred.
The result is easily generalized to 𝑛 events.
If an event A must result in one of the mutually exclusive events
𝐴1 , 𝐴2 , … . , 𝐴𝑛 , then
𝑃(𝐴) = 𝑃(𝐴1 )𝑃(𝐴|𝐴1 ) + 𝑃(𝐴2)𝑃(𝐴 |𝐴2) + ⋯ . . +𝑃(𝐴𝑛 ) 𝑃(𝐴 |𝐴𝑛 )
1.1 Example: Show that for events 𝐴, 𝐵 abd 𝐶 with 𝑃(𝐶) > 0,
𝑃(𝐴 ∪ 𝐵|𝐶) = 𝑃(𝐴|𝐶) + 𝑃(𝐵|𝐶) − 𝑃(𝐴 ∩ 𝐵|𝐶).
Proof: Note
𝑃(𝐴 ∪ 𝐵) ∩ 𝐶
𝑃(𝐴 ∪ 𝐵|𝐶) =
𝑃(𝐶)
𝑃(𝐴 ∩ 𝐶) ∪ (𝐵 ∩ 𝐶)
=
𝑃(𝐶)
𝑃(𝐴 ∩ 𝐶) + 𝑃(𝐵 ∩ 𝐶) − 𝑃(𝐴 ∩ 𝐵 ∩ 𝐶)
=
𝑃(𝐶)
= 𝑃(𝐴|𝐶) + 𝑃(𝐵|𝐶) − 𝑃(𝐴 ∩ 𝐵|𝐶).
Note if 𝐴 and 𝐵 are disjoint, then
𝑃(𝐴 ∪ 𝐵|𝐶) = 𝑃(𝐴|𝐶) + 𝑃(𝐵|𝐶).
Note: It can be seen that
1
𝑃(𝐴𝑐 |𝐵) = 1 − 𝑃(𝐴|𝐵) 𝑃(𝐴|𝐵) + 𝑃(𝐴𝑐 |𝐵) = 𝑃(𝐵|𝐵) = 1.
Also, the following facts holds in general:
𝑃(𝐴|𝐵 𝑐 ) ≠ 1 – 𝑃(𝐴|𝐵);
𝑃(𝐴 |𝐵 𝑐 ) ≠ 1 − 𝑃(𝐴|𝐵);
𝑐
𝑃(𝐴|𝐵) + 𝑃(𝐴𝑐 |𝐵 𝑐 ) ≠ 1
, 1.2 Example: Roll a die
Let 𝐴 = {one, two, three} and 𝐵 = {two, four}. Are 𝐴 and 𝐵 independent?
1 1 1
Solution: 𝑃(𝐴) = 2 , 𝑃(𝐵) = 3 , 𝑃(𝐴 ∩ 𝐵) = 6 , then
1
𝑃(𝐴 ∩ 𝐵) 1
𝑃(𝐴|𝐵) = = 6 = = 𝑃(𝐴)
𝑃(𝐵) 1 2
3
1
𝑃 ∩ 𝐴 1
𝑃(𝐵|𝐴) = = 6 = = 𝑃(𝐵)
𝑃(𝐴) 1 3
2
Thus, we conclude that A and B are independent.
1.3 Example: A box contains 4 red and 2 green balls. Draw successively two
balls without replacement and observe the color.
Define the following events: 𝐺1 = green on the first draw, 𝐺2 = green on the
second draw, 𝑅1 = red on the first draw, 𝑅2 = red on the second draw. For
this experiment, the sample space 𝑆 is
𝑆 = {𝐺1 𝐺2 , 𝐺1 𝑅2 , 𝑅1 𝐺2 𝑅1 𝑅2 }
First, we compute the probabilities of simple events. Note it involves
conditional probabilities.
The probabilities of the simple events 𝐺1 ∩ 𝐺2 , 𝐺1 ∩ 𝑅2 , 𝑅1 ∩ 𝐺2 and 𝑅1 ∩ 𝑅2 are:
2 1 2 1
𝑃(𝐺1 ∩ 𝐺2 ) = 𝑃(𝐺1 )𝑃(𝐺2 |𝐺1 ) = × = =
6 5 30 15
4 3 12 2
𝑃(𝑅1 ∩ 𝑅2 ) = 𝑃(𝑅1 )𝑃(𝑅2 |𝑅1 ) = × = =
6 5 30 5
2 4 8 2
𝑃(𝐺1 ∩ 𝑅2 ) = 𝑃(𝐺1 )𝑃(𝑅2 |𝐺1 ) = × = =
6 5 30 15
4 2 8 2
𝑃(𝑅1 ∩ 𝐺2 ) = 𝑃(𝑅1 )𝑃(𝐺2 |𝑅1) = 6 × 5 = 30 = 15
The probability that the second ball is green is
8 2 10 1
𝑃(𝐺2 ) = 𝑃(𝑅1 ∩ 𝐺2 ) + 𝑃(𝐺1 ∩ 𝐺2 ) = 30 + 30 = 30 = 3 .
1.4 Example: Given is a contingency table of 100 students cross-
classified by their school goal and gender.
Conditional Probability and Bayes Applications
1. Conditional Probability: Let 𝐴, 𝐵 be two events. The conditional
probability of 𝐴 given 𝐵 (that is, B has occurred), denoted by 𝑃(𝐴|𝐵), is
defined as
𝑃(𝐴|𝐵) = 𝑃(𝐴 𝑎𝑛𝑑 𝐵)/𝑃(𝐵) = 𝑃(𝐴 ∩ 𝐵) 𝑃(𝐵) .
The above realtion leads to:
𝑃(𝐴 𝑎𝑛𝑑 𝐵) = 𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐴|𝐵)𝑃(𝐵); 𝑃(𝐴 𝑎𝑛𝑑 𝐵) = 𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐵|𝐴)𝑃(𝐴).
If 𝐴 and 𝐵 are disjoint, then 𝑃(𝐴|𝐵) = 0.
General rule: For any three events 𝐴1 , 𝐴2 , 𝐴3 we have
𝑃(𝐴1 ∩ 𝐴2 ∩ 𝐴3 ) = 𝑃(𝐴1 )𝑃(𝐴2 |𝐴1 )𝑃(𝐴3 |𝐴1 ∩ 𝐴2 )
In words, the probability that 𝐴1 and 𝐴2 and 𝐴3 all occur is equal to the
probability that 𝐴1 occurs times the probability that 𝐴2 occurs given that 𝐴1
has occurred times the probability that 𝐴3 occurs given that both 𝐴1 and 𝐴2
have occurred.
The result is easily generalized to 𝑛 events.
If an event A must result in one of the mutually exclusive events
𝐴1 , 𝐴2 , … . , 𝐴𝑛 , then
𝑃(𝐴) = 𝑃(𝐴1 )𝑃(𝐴|𝐴1 ) + 𝑃(𝐴2)𝑃(𝐴 |𝐴2) + ⋯ . . +𝑃(𝐴𝑛 ) 𝑃(𝐴 |𝐴𝑛 )
1.1 Example: Show that for events 𝐴, 𝐵 abd 𝐶 with 𝑃(𝐶) > 0,
𝑃(𝐴 ∪ 𝐵|𝐶) = 𝑃(𝐴|𝐶) + 𝑃(𝐵|𝐶) − 𝑃(𝐴 ∩ 𝐵|𝐶).
Proof: Note
𝑃(𝐴 ∪ 𝐵) ∩ 𝐶
𝑃(𝐴 ∪ 𝐵|𝐶) =
𝑃(𝐶)
𝑃(𝐴 ∩ 𝐶) ∪ (𝐵 ∩ 𝐶)
=
𝑃(𝐶)
𝑃(𝐴 ∩ 𝐶) + 𝑃(𝐵 ∩ 𝐶) − 𝑃(𝐴 ∩ 𝐵 ∩ 𝐶)
=
𝑃(𝐶)
= 𝑃(𝐴|𝐶) + 𝑃(𝐵|𝐶) − 𝑃(𝐴 ∩ 𝐵|𝐶).
Note if 𝐴 and 𝐵 are disjoint, then
𝑃(𝐴 ∪ 𝐵|𝐶) = 𝑃(𝐴|𝐶) + 𝑃(𝐵|𝐶).
Note: It can be seen that
1
𝑃(𝐴𝑐 |𝐵) = 1 − 𝑃(𝐴|𝐵) 𝑃(𝐴|𝐵) + 𝑃(𝐴𝑐 |𝐵) = 𝑃(𝐵|𝐵) = 1.
Also, the following facts holds in general:
𝑃(𝐴|𝐵 𝑐 ) ≠ 1 – 𝑃(𝐴|𝐵);
𝑃(𝐴 |𝐵 𝑐 ) ≠ 1 − 𝑃(𝐴|𝐵);
𝑐
𝑃(𝐴|𝐵) + 𝑃(𝐴𝑐 |𝐵 𝑐 ) ≠ 1
, 1.2 Example: Roll a die
Let 𝐴 = {one, two, three} and 𝐵 = {two, four}. Are 𝐴 and 𝐵 independent?
1 1 1
Solution: 𝑃(𝐴) = 2 , 𝑃(𝐵) = 3 , 𝑃(𝐴 ∩ 𝐵) = 6 , then
1
𝑃(𝐴 ∩ 𝐵) 1
𝑃(𝐴|𝐵) = = 6 = = 𝑃(𝐴)
𝑃(𝐵) 1 2
3
1
𝑃 ∩ 𝐴 1
𝑃(𝐵|𝐴) = = 6 = = 𝑃(𝐵)
𝑃(𝐴) 1 3
2
Thus, we conclude that A and B are independent.
1.3 Example: A box contains 4 red and 2 green balls. Draw successively two
balls without replacement and observe the color.
Define the following events: 𝐺1 = green on the first draw, 𝐺2 = green on the
second draw, 𝑅1 = red on the first draw, 𝑅2 = red on the second draw. For
this experiment, the sample space 𝑆 is
𝑆 = {𝐺1 𝐺2 , 𝐺1 𝑅2 , 𝑅1 𝐺2 𝑅1 𝑅2 }
First, we compute the probabilities of simple events. Note it involves
conditional probabilities.
The probabilities of the simple events 𝐺1 ∩ 𝐺2 , 𝐺1 ∩ 𝑅2 , 𝑅1 ∩ 𝐺2 and 𝑅1 ∩ 𝑅2 are:
2 1 2 1
𝑃(𝐺1 ∩ 𝐺2 ) = 𝑃(𝐺1 )𝑃(𝐺2 |𝐺1 ) = × = =
6 5 30 15
4 3 12 2
𝑃(𝑅1 ∩ 𝑅2 ) = 𝑃(𝑅1 )𝑃(𝑅2 |𝑅1 ) = × = =
6 5 30 5
2 4 8 2
𝑃(𝐺1 ∩ 𝑅2 ) = 𝑃(𝐺1 )𝑃(𝑅2 |𝐺1 ) = × = =
6 5 30 15
4 2 8 2
𝑃(𝑅1 ∩ 𝐺2 ) = 𝑃(𝑅1 )𝑃(𝐺2 |𝑅1) = 6 × 5 = 30 = 15
The probability that the second ball is green is
8 2 10 1
𝑃(𝐺2 ) = 𝑃(𝑅1 ∩ 𝐺2 ) + 𝑃(𝐺1 ∩ 𝐺2 ) = 30 + 30 = 30 = 3 .
1.4 Example: Given is a contingency table of 100 students cross-
classified by their school goal and gender.