Intersections and Unions of Events
CS 70, Summer 2019 Lecture 17, 7/23/19
1 / 25
Intersections and Unions of Events CS 70, Summer 2019 Lecture 17, - - PowerPoint PPT Presentation
Intersections and Unions of Events CS 70, Summer 2019 Lecture 17, 7/23/19 1 / 25 Last Time: Conditional Probability I P [ A | B ] : restricting the sample space to B P [ A B ] = P [ A | B ] P [ B ] = P [ B | A ] P [ A ] I Total
Intersections and Unions of Events
CS 70, Summer 2019 Lecture 17, 7/23/19
1 / 25
Last Time: Conditional Probability
I P[A|B]:restricting the sample space to B
P[A ∩ B] = P[A|B] P[B] = P[B|A] P[A]
I “Total probability rule:” probability by disjoint cases I “Bayes’ Rule”: definition of conditional probability +
total probability rule
I Lets you “flip” the conditioning 2 / 25
Computing Intersections
For any events A, B: P[A ∩ B] = What about any (three) events, A, B, C? P[A ∩ B ∩ C] =
3 / 25
PLA IB ]
. PCB] =PCBIA ]
. PCA](
)
Plan B/C ]
Pfc ]
=PCCIANB )
3970k!
④
=]
.]
Computing Intersections: Chaining
For any events A1, A2, . . . , An: P " n \
i=1
Ai # = P[A1] · P[A2|A1] · P[A3|A1 ∩ A2] · . . . Proof: Details are in the notes. General Idea: Key Insight: Treat (A1 ∩ A2 ∩ . . . ∩ An−1) as one event, treat An alone as another. Very similar to...
4 / 25
If
DEAN
ANANA
,]
'nofAi
As , given Hultz
Induction
! ! !
NAN
]
' Uwsenditiond .MTI
,induction
Drawing Cards I
I draw 4 cards sequentially from a standard deck, without
Ci = P[C1 ∩ C2 ∩ C3 ∩ C4] =
5 / 25
ith
card
is a
club
.counting
' 'i'
= " and "Rft
clubs ]
"
"f
=#
hands W/
49
.Ipcc , ]
.[ Calc , ]elP[ Csl oh Cz ]
it-and
,
= =1312-11-40527
5251.5049
¥48 !
Drawing Cards II
(Modified from notes.) I am dealt 5 cards. What is the probability that all five cards are the same suit, and none of them are face cards? C1 = For 2 ≤ i ≤ 5: Ci = P[C1 ∩ C2 ∩ C3 ∩ C4 ∩ C5] =
6 / 25
1st card
is
not face
.ith
card
is
not
face
AND
same
suit
as
first
=II.
IT
' Ea ' Eiscount
"by
ceases
cases
:by suit
.⇒
4
. IPC 5hearts
I
Cj
=
ith
card
is
A
non
spade
.'Fi 's
X 4
all
Independent Events
For any events A, B: P[A \ B] = P[A|B] · P[B] = P[B|A] · P[A] Two events A, B are independent if and only if: P[A \ B] = which is equivalent to both: P[A|B] = P[B|A] =
7 / 25
doe
skit
hate to be
independent
.PEA] PCB]
PEAT
PCB]
Independent or Not?
I Flipping two fair coins:
A = flip 1 is heads, B = flip 2 is tails.
I Rolling one red die, one blue die:
A = sum is 3, B = red die is 1.
8 / 25
"¥93
" Tanis ,
#
¥¥¥
check
:Fizz
PCA]
= 23-6 .If
PC
An
BT
136
PCB ]
= ITcheck
: IsX
Independent or Not?
I Rolling one red die, one blue die:
A = sum is 7, B = red die is 1.
I Throwing 3 labeled balls into 3 labeled bins:
A = Bin #1 is empty, B = Bin #2 is empty.
9 / 25
IDEA ]
PCANBT
1,13=6 ]
36
= 136DEBT
check
:To
. to✓
PEA ]
pCAhBI=PCbbifnm¥p¥y ]
PCB ]
Ime
=3
. IAlso
by
symmetry
.X
Independent or Not?
A, B are generic events. The table shows probabilities of the intersections of the row and column. Event A Event A Event B P[A \ B] = 0.4 P[A \ B] = 0.3 Event B P[A \ B] = 0.2 P[A \ B] = 0.1 What is P[A]? What is P[B]? Are A and B independent?
10 / 25
=IP [
An B ]
tPCA ABT
=0.4-10.2--0.6
=IPC An
B ]
tPEE
n B ]
=0.4-10.3
=0.7
0.4
I ( O
. 6)L 0.7 )X
Mutual Independence
How do we generalize independence from two events A, B, to multiple events A1, A2, . . . , An? Definition (Mutual Independence, Ver. 1) A1, A2, . . . , An are mutually independent if: For every I ✓ {1, 2, . . . , n}, with |I| 2, P "\
i∈I
Ai # = Y
i∈I
P[Ai] Ex: For 3 events:
11 / 25
any
subset
Of
{ I ,
2
, . . . , N }IPC ?eq
,, ,
Ai ]
=PCA it P[ Az ) PCA , ]
.Mutual Independence
Definition (Mutual Independence, Ver. 2) A1, A2, . . . , An are mutually independent if: For every choice of Bi 2 {Ai, Ai}: P[B1 \ B2 \ . . . \ Bn] =
n
Y
i=1
P[Bi] Ex: For 3 events:
12 / 25
P [
A
,n AT n At
, I =P CA it
P CAIT PEAT
.P [
AT
n Az
n AI I
=PC AT I IP E Aid PC AT
A Weaker Idea: Pairwise Independence
Definition (Pairwise Independence) A1, A2, . . . , An are pairwise independent if: For every i 6= j in {1, 2, . . . , n}: P[Ai \ Aj] = P[Ai] · P[Aj] Q: Does mutual imply pairwise? Q: Does pairwise imply mutual?
13 / 25
" everypossible
subset
"includes
pairs
NO
.↳ Discussion
Using (Mutual) Independence: Coin Flips
What is the probability that after n flips, we have k heads and (n k) tails?
14 / 25
Hair
K
n
H
T
. . . .T
ltfknheads
,biased)
#
sequences
k
H
,In
n
!
Winn
.k¥5
,
=PCSYemfifin.se?--PCmCaHnestPKmZas-cnesT---PCIItcnes ]
=@ynyPCspep99c.s.e.9.jsEfiu.p
,
What
if
biased ?
PCH ]
TH
nUsing (Mutual) Independence: Dice Rolls
We roll n red dice and n blue dice. What is the probability that all the red dice are even, and all the blue dice are 5?
15 / 25
Exercise
.Break
Back by popular demand... Would you rather only use spoons (no forks) or only use forks (no spoons) for the rest of your life? A joke... Why was 6 afraid of 7? Because seven ate nine. Now, why was 7 afraid of 8?
16 / 25
Unions of Events
Same exact story as in counting... P[A [ B] =
17 / 25
r
A
B
IP f AT
t PCB]
Unions of Events
Same exact story as in counting... P[A [ B [ C] =
18 / 25
r
.
A
n
Bnc
B
C
p [ AT
+ PCB] t IPCC ]n BT
n C ] t
IPCA A B n C ]
Unions Example: Rolling 3 Die
I roll a red die, a blue die, and a green die. What is the probability that at least one of these happen? A) The red die’s number is 3, or 4 B) The blue die’s number is 5. C) The green die’s number is 1 or 6. P[A] = P[B] = P[C] =
19 / 25
Inion
! !
I
f-
=I
63
Example: Rolling 3 Die
Continued... P[A \ B] = P[A \ C] = P[B \ C] = P[A \ B \ C] = P[A [ B [ C] =
20 / 25
then
= E- isI I KE )
subtract
!
I TX E)
=E
I ¥ ) (toX Z )
= If←
add
7
2 t 3 b t72
t 4
=Principle of Inclusion and Exclusion
Same exact story as in counting... For probability: Let A1, A2, . . . , An be events in our probability space. Denote {1, 2, . . . , n} by [n]. Then:
P " n [
i=1
Ai # = X
{i}✓[n]
P[Ai] X
{i,j}✓[n]
P[Ai \ Aj] + X
{i,j,k}✓[n]
P[Ai \ Aj \ Ak] . . . . . . + (1)n+1 P[A1 \ A2 \ . . . \ An]
21 / 25
.
u
.:*
."
"
" "
three
intersections
The Union Bound
Q: What is the maximum possible value of the following? P[A1 [ A2 [ . . . [ An] A: P[A1 [ A2 [ . . . [ An] is always upper bounded by
22 / 25
At Az
pfa ,uAzUA3 )
=pfADtPCAI
t PEAS ]
As
,
Pati ]
Union Bound Example: Rolling 3 Die
I roll a red die, a blue die, and a green die. What is an easy upper bound on the probability that at least one of these happen? A) The red die’s number is 3 or 4. B) The blue die’s number is 5. C) The green die’s number is 1 or 6.
23 / 25
EIPCATTPCBTHPKJ
puffed
'=Z+ttE'
'
Feer
Summary
I Computing event intersections = chaining conditional
probabilities
I Independent events = directly multiply probabilities I Mutual independence 6= pairwise independence
I Computing event unions = same exact strategy from
counting!
I Draw the Venn diagram for 2 events, 3 events I Principle of Inclusion-Exclusion for multiple events
I Union bound = worst case, the events are disjoint!
24 / 25
Tips for Counting and Probability
I Don’t overthink it! Consider one thing at a time. I Label your events!! Be cognizant of whether or not
you are conditioning.
I If you have time, try a different strategy and see if it
gets you the same answer (e.g. cases vs. complement)
I Try small examples to sanity-check your strategy! I Practice, practice, practice!
25 / 25