The probability of the union of two events

The probability of the union of two events
Pr(X ∪ Y ) = Pr(X) + Pr(Y ) − Pr(X ∩ Y )
Ω
Side remark:
X
Y
|X ∪ Y | = |X| + |Y | − |X ∩ Y |
-
Pr(X ∪ Y ) =
!
x∈(X∪Y )
Pr(x) =
!
x∈(X−Y )
+
−
Pr(x) +
!
!
x∈(X∩Y )
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
x∈(X∩Y )
Pr(x) +
x∈(Y −X)
Pr(x)
!
!
Pr(x)
x∈(X∩Y )
Pr(x)
19 / 49
Example
Suppose I have a jar of 30 sweets, as follows.
circular
square
red
2
6
blue
4
7
green
3
8
±
If I choose a sweet uniformly at random,
the probability that it is red is
2+6
30
the probability that it is circular is
8
30 .
2+4+3
30
=
=
9
30 .
What is the probability that it is red or circular?
8
9
2
15
1
+
−
=
=
30 30 30
30
2
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
20 / 49
Example: three dice
Suppose that I roll three dice. So
Ω = {1, 2, 3, 4, 5, 6} × {1, 2, 3, 4, 5, 6} × {1, 2, 3, 4, 5, 6}
What is the probability that I roll at least one 6?
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
21 / 49
#
EI
1.
.
-6
1.
(
4)
3)
i.
.
6
#
1.6
6×6×60
Computing the probability of a union of three sets
Pr(A ∪ B ∪ C) = Pr(A) + Pr(B) + Pr(C)
− Pr(A ∩ B) − Pr(A ∩ C) − Pr(B ∩ C)
+ Pr(A ∩ B ∩ C).
A
B
C
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
|A ∪ B ∪ C| = |A| + |B| + |C|
−|A ∩ B| − |A ∩ C| − |B ∩ C|
+|A ∩ B ∩ C|.
Part 7. Discrete Probability
22 / 49
Three dice example continued
H±
D
E1 : event that 1st die is a 6.
E1
,6A
16,1¥
E2 : event that 2nd die is a 6. I
E2
*
E3 : event that 3rd die is a 6.
E3
Pr(E1 ∪ E2 ∪ E3 ) = Pr(E1 ) + Pr(E2 ) + Pr(E3 )
Pre .tt?xIxeot=
Pv(Ed=Pr( ED
Pruned
.at#=sst
− Pr(E1 ∩ E2 ) − Pr(E1 ∩ E3 ) − Pr(E2 ∩ E3 )
-
+ Pr(E1 ∩ E2 ∩ E3 )
=
−
+
=
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
36
216
6
216
1
216
91
216
a
+
−
36
216
6
216
+
−
-
-
36
216
6
216
≈ 0.42
Part 7. Discrete Probability
23 / 49
Principle of inclusion and exclusion
Let A1 , A2 , . . . , An be events.
Then
Pr(A1 ∪ · · · ∪ An ) =
−
+
!
1≤k≤n
Pr(Ai )
!
1≤j<k≤n
Pr(Aj ∩ Ak )
!
1≤i<j<k≤n
Pr(Ai ∩ Aj ∩ Ak )
− ···
%1AMMA.MN#Pr(AiuAwANAn
)
+ (−1)n−1 Pr(A1 ∩ · · · ∩ An ).
=
RCA ftp.ASK Prato ) RCA )
t
Pr ( An At
+
Plain
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
A
-
in
MA nah
ASHPRIA
>
-
n
As
Part 7. Discrete Probability
Pr
n
IAN At
Ault R ( A
F ( An AH
-
-
in
A
Pratt )
}n
Att
-
R
Pr An
-
( As nad
a) NAH
24 / 49
-
Conditional Probability
If event Y has Pr(Y ) ! 0 then the probability of event X
conditioned on Y is written Pr(X | Y ) and is defined as
£
Pr(X ∩ Y )
Pr(X | Y ) =
Pr(Y )
The probability of X, given that Y occurs.
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
25 / 49
Explanation for uniform distributions
Ω
X
Ω
Y
I÷I:I
X
o÷*g±
outcomes can ‘hit’ X
outcomes can ‘hit’ Y
Pr(X) =
|X|
|Ω|
Pr(Y ) =
Pr(X ∩ Y ) =
Y
outcomes do ‘hit’ Y and can ‘hit’ X
Pr(X|Y ) =
|Y |
|Ω|
|X∩Y |
|Y |
|X∩Y |
|Ω|
Pr(X ∩ Y )
Pr(X | Y ) =
=
Pr(Y )
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$
|X∩Y |
|Ω|
÷
|Y |
|Ω|
definition
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
=
|X∩Y |
|Ω|
×
|Ω|
|Y |
|X ∩ Y |
=
|Y |
!!!!!!!!"#!!!!!!!$
intuition
26 / 49
Example
I choose a sweet uniformly at random from a jar of 30 sweets.
circular
square
red
2
6
blue
4
7
8
green
3
8
The probability that it is red conditioned on that it is circular is
2
30
÷
2+4+3
30
=
2
30
×
30
2+4+3
=
2
2+4+3
= 29 , which is
less than the unconditional probability that it is red,
2+6
30
=
8
30 .
The probability that it is circular conditioned on the event that it is
red is
2
2+6
2
1
÷
=
=
30
30
6+2
4
0
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
27 / 49
Independence
Suppose that Pr(X) ! 0 and Pr(Y ) ! 0.
Events X and Y , are independent if
Pr(X ∩ Y ) = Pr(X) Pr(Y )
This is equivalent to
=
Pr(X ∩ Y )
Pr(X | Y ) =
= Pr(X),
Pr(Y )
so the occurrence of Y has no influence on the probability of X.
It is also equivalent to Pr(Y | X) = Pr(Y )
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
28 / 49
Example
If you roll two dice, then the rolls are independent, so the event that
the first die shows a “1” is independent of the event that the second
die shows a “2”, so the probability that both of these happen is
1
6
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
×
1
6
=
1
36
Part 7. Discrete Probability
29 / 49
Example: Independent events
Suppose that I roll two fair dice. Then
Ω = {1, 2, 3, 4, 5, 6} × {1, 2, 3, 4, 5, 6}. The outcome (a, b) ∈ Ω
means that the roll on the first die is a and the roll on the second die
is b. The probability Pr((a, b)) = 1/36.
÷
Let X be the event that the roll on the first die is a “1”.
X = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6)}.
Let Y be the event that the roll on the second die is a “2”.
Y = {(1, 2), (2, 2), (3, 2), (4, 2), (5, 2), (6, 2)}
Note that Pr(X) =
6
36
= 16 . Similarly, Pr(Y ) = 16 .
X ∩ Y = {(1, 2)} so Pr(X ∩ Y ) =
1
36
= Pr(X) Pr(Y ).
-
We conclude that X and Y are independent.
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
30 / 49
Example continued: Independent events
Let X be the event that the roll on the first die is a “1”.
X = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6)}.
Let Z⎧be the event of rolling an even sum with the
⎫ two dice.
⎪
⎨ (1, 1), (1, 3), (1, 5), (2, 2), (2, 4), (2, 6), ⎪
⎬
(3, 1), (3, 3), (3, 5), (4, 2), (4, 4), (4, 6),
Z=
⎪
⎩ (5, 1), (5, 3), (5, 5), (6, 2), (6, 4), (6, 6) ⎪
⎭
=
Note that Pr(Z) =
18
36
= 12 .
(Recall Pr(X) = 16 )
X ∩ Z = {(1, 1), (1, 3), (1, 5)} so
Pr(X ∩ Z) =
3
36
=
1
12
= Pr(X) Pr(Y )
We conclude that X and Y are also independent.
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
31 / 49
Example continued: dependent events
Let Z⎧be the event of rolling an even sum with the
⎫ two dice.
⎪
⎨ (1, 1), (1, 3), (1, 5), (2, 2), (2, 4), (2, 6), ⎪
⎬
(3, 1), (3, 3), (3, 5), (4, 2), (4, 4), (4, 6),
Z=
⎪
⎩ (5, 1), (5, 3), (5, 5), (6, 2), (6, 4), (6, 6) ⎪
⎭
Let W be the event that the roll on the first or the second die is “1”.
W =
(
(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6)
(2, 1), (3, 1), (4, 1), (5, 1), (6, 1)
÷
Note that Pr(W ) =
11
36
)
.
(Recall Pr(Z) = 12 )
Z ∩ W = {(1, 1), (1, 3), (1, 5), (3, 1), (5, 1)} so
Pr(X ∩ Z) =
5
36
4 Pr(Y )
! Pr(X)
of
-
We conclude that E
X and Y
Y are not independent.
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
32 / 49
So far, we only considered the likelihood of events.
What about questions like
If I play the lotto long enough, on average, what is my balance?
If I randomly choose a direction at every junction, on average,
how long will it take me to get home?
If I pick socks from a box of brown and black socks, on average,
how many will I need to pick before getting a matching pair?
?iiT,ffrrrX+b+XHBpX+XmFfFQM2pf*PJSRyN
Part 7. Discrete Probability
33 / 49