Mathematical Foundations of Computer Science Lecture Outline
Mathematical Foundations of Computer Science Lecture Outline
Lecture Outline
October 18, 2018
The Total Probability Theorem. Consider events E and F . Consider a sample point
ω ∈ E. Observe that ω belongs to either F or F . Thus, the set E is a disjoint union of two
sets: E ∩ F and E ∩ F . Hence we get
Pr[E] = Pr[E ∩ F ] + Pr[E ∩ F ]
= Pr[F ] × Pr[E|F ] + Pr[F ] × Pr[E|F ]
In general, if A1 , A2 , . . . , An form a partition of the sample space and if ∀i, Pr[Ai ] > 0, then
for any event B in the same probability space, we have
n
X n
X
Pr[B] = Pr[Ai ∩ B] = Pr[Ai ] × Pr[B|Ai ]
i=1 i=1
Example. A medical test for a certain condition has arrived in the market. According
to the case studies, when the test is performed on an affected person, the test comes up
positive 95% of the times and yields a “false negative” 5% of the times. When the test is
performed on a person not suffering from the medical condition the test comes up negative
in 99% of the cases and yields a “false positive” in 1% of the cases. If 0.5% of the population
actually have the condition, what is the probability that the person has the condition given
that the test is positive?
Example. A transmitter sends binary bits, 80% 0’s and 20% 1’s. When a 0 is sent, the
receiver will detect it correctly 80% of the time. When a 1 is sent, the receiver will detect
it correctly 90% of the time.
(a) What is the probability that a 1 is sent and a 1 is received?
(b) If a 1 is received, what is the probability that a 1 was sent?
Pr[S1 ∩ R1 ]
Pr[S1 |R1 ] =
Pr[R1 ]
0.18
=
Pr[R1 ∩ S1 ] + Pr[R1 ∩ S0 ]
0.18
=
0.18 + Pr[S0 ] × Pr[R1 |S0 ]
0.18
=
0.18 + 0.8 × 0.2
= 0.5294
Example. An urn contains 5 white and 10 black balls. A fair die is rolled and that
number of balls are chosen from the urn.
(a) What is the probability that all of the balls selected are white?
(b) What is the conditional probability that the die landed on 3 if all the balls selected are
white?
Independent Events. Two events A and B are independent if and only if Pr[A ∩ B] =
Pr[A]×Pr[B]. This definition also implies that if the conditional probability Pr[A|B] exists,
then A and B are independent events if and only if Pr[A|B] = Pr[A] .
In other words, to show that A1 , A2 , . . . , An are mutually independent we must show that
all of the following hold.
The above definition implies that if A1 , A2 , . . . , An are mutually independent events then
Example. Two cards are sequentially drawn (without replacement) from a well-shuffled
deck of 52 cards. Let A be the event that the two cards drawn have the same value (e.g.
both 4s) and let B be the event that the first card drawn is an ace. Are these events
independent?
Solution. To decide whether the two events are independent we need to check whether
Pr[A ∩ B] = Pr[A] Pr[B].
3 1
Pr[A] = =
51 17
4 1
Pr[B] = =
52 13
1 3
Pr[A ∩ B] = ×
13 51
1
=
221
1 1
= ×
17 13
= Pr[A] Pr[B]
Example. Suppose that a fair coin is tossed twice. Let A be the event that a head is
obtained on the first toss, B be the event that a head is obtained on the second toss, and
C be the event that either two heads or two tails are obtained. (a) Are events A, B, C
pairwise independent? (b) Are they mutually independent?
Pr[A] = 1/2
Pr[B] = 1/2
Pr[C] = 1/2
Pr[A ∩ B] = 1/4 = Pr[A] Pr[B]
Pr[A ∩ C] = 1/4 = Pr[A] Pr[C]
Pr[B ∩ C] = 1/4 = Pr[B] Pr[C]
Pr[A ∩ B ∩ C] = 1/4 6= Pr[A] Pr[B] Pr[C]
Thus we see that A, B, C are pairwise independent but not mutually independent.
Example. Consider the experiment in which we roll a dice twice. Consider the following
events.
Solution. We show below that the events are not mutually independent as they are not
pairwise independent.
A = {(i, j) | 1 ≤ i ≤ 3 and 1 ≤ j ≤ 6}
B = {(i, j) | 3 ≤ i ≤ 5 and 1 ≤ j ≤ 6}
C = {(3, 6), (6, 3), (4, 5), (5, 4)}
A ∩ B = {(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6)}
A ∩ C = {(3, 6)}
B ∩ C = {(3, 6), (4, 5), (5, 4)}
A ∩ B ∩ C = {(3, 6)}
Pr[A] = 1/2
Pr[B] = 1/2
Pr[C] = 1/9
Pr[A ∩ B ∩ C] = 1/36 = Pr[A] · Pr[B] · Pr[C]
Pr[A ∩ B] = 1/6 6= Pr[A] · Pr[B]
Pr[A ∩ C] = 1/36 6= Pr[A] · Pr[C]
Pr[B ∩ C] = 3/36 6= Pr[B] · Pr[C]