Intro to Discrete Probability
CS 70, Summer 2019 Lecture 15, 7/18/19
1 / 24
Intro to Discrete Probability CS 70, Summer 2019 Lecture 15, - - PowerPoint PPT Presentation
Intro to Discrete Probability CS 70, Summer 2019 Lecture 15, 7/18/19 1 / 24 Why Learn Probability? I Uncertainty 6 = nothing is known I Many decisions are made under uncertainty I Understanding probability gives a precise , unambiguous ,
Intro to Discrete Probability
CS 70, Summer 2019 Lecture 15, 7/18/19
1 / 24Why Learn Probability?
I Uncertainty 6= “nothing is known” I Many decisions are made under uncertainty
I Understanding probability gives a precise, unambiguous, logical way to reason about uncertainty I Also learn about good yet simple models for many real world situations
I Uncertainty can also be your friend!
I We use artificial uncertainty to design good algorithms
2 / 24Flipping Coins
I flip three coins. What is the set of outcomes? Now, I flip n different coins. What is the set of outcomes? How many outcomes are there?
3 / 24HHHt8
④ springs w/ HM
,Iengthn
.2N
Outcomes
.Probability Spaces
We formalize “experimental outcomes” or “samples”: A probability space is a sample space Ω, with a probability function P[·] such that: I For each sample ω 2 Ω, we have 0 P(ω) 1 I The sum of probabilities over all ω 2 Ω is 1.
4 / 24Pr
Example: Flipping Coins
I flip three fair coins. What is the sample space? What are the probabilities? Now, I flip n different fair coins. What is the sample space? What are the probabilities?
5 / 24← ¥
is'un
Example: Flipping Coins
I flip three biased coins, with heads probability p 6= 1
2.What is the sample space? What are the probabilities? Why were we able to multiply? We’ll see next week...
6 / 24PCTHT)
Pll
=p ( I
iii¥ka⇒a⇒
=( I
Events
An event A is a subset of outcomes ω 2 Ω. The probability of an event A is P[A] = X
ω∈AP[ω]
7 / 24*
er
me →sum
probabilities
all
in
A
.Example: Flipping Coins
Let A be the event where I flip at least 2 heads. I flip three fair coins. What is P[A]? I flip three biased coins, with heads probability p. What is P[A]?
8 / 24A :
HHH THH
IPCAJ
HTH
=L
HHT
2
A
:HHH
P[HHHI=p3
THH
HTH
}
'PCTHHJHHT
PLAT
Uniform Probability Spaces
We use “uniform” to describe probability spaces where all
For all ω 2 Ω, we have: P[ω] = 1 |Ω| As a result, for an event A: P[A] = |A| |Ω| This is helpful for larger probability spaces!
9 / 24size
←
space
.CAT
"
Yet
,
I
Rolling Dice
I roll 2 fair dice. What is the probability that both of my rolls are even? What is the probability that both rolls are greater than 2?
10 / 24unique
.?s⇒
⇐ i' ⇐ 2--36=154
2,4 , 6
24.6#
A
IAH
/¥Y
PIAF
956=4
.EE
8¥
IAI
PEAT
Rolling Dice
What is the probability that at least one roll is less than 3? What is the probability that the first roll is strictly greater than the second?
11 / 24¢
A =IAI
#
whey
.se1) tf
# Y.YFZDiceg-f.gg =2×6+6×2
12
PFA)
£6
Ai
1)
first
>second >
sameIAH IAI -16=154
2)
second
>first
size
15
3)
first
6
WAYS
PCA]=}Iy=5Tz
Drawing Marbles I
I have an urn with 100 marbles. Exactly 50 of them are blue and 50 of them are red. If I draw 8 marbles from the urn without replacement, what is the probability I get 6 red and 2 blue?
12 / 24Drawing
all atinfo
=ioo÷
IAI
RRR.EE?aYgInmenis:ofz,=C8 )
Ed Yue
.IAH II )
¥49
play
=l58K
=i8tI%÷*s÷
I
1189
Drawing Marbles I
If I draw 8 marbles from the urn with replacement, what is the probability I get 6 red and 2 blue?
13 / 24Go
sequentially
Irl
1008
sequentially
⇒8mA
Hers :e¥EBntrrbrthRR
and
⇒( Sf)
RRRRRRBB
Fixt
:TE
IA 1=1861508
REAL 1¥
,
= 1815081008Drawing Marbles II
I have an urn with 100 marbles. 50 of them are blue, 50 of them are red, and 50 of them are yellow. If I draw 8 marbles from the urn without replacement, what is the probability I get 3 red, 3 blue, and 2 yellow?
14 / 24Exercise
.Drawing Marbles II
If I draw 8 marbles from the urn with replacement, what is the probability I get 3 red, 3 blue, and 2 yellow? Why didn’t we use stars and bars? Discuss.
15 / 24Why No Stars and Bars?
If we are running an experiment where we sample a set of objects, the outcomes counted by stars-and-bars is a non-uniform probability space.
16 / 24One
The Birthday Problem
If there are n people in a room, what is the probability that at least two people share the same birthday? First (naive) attempt:
17 / 242
people
same
:"
me
same
:}Y%m
!The Birthday Problem
Second attempt:
18 / 24complement
:count ways
nohas same
birthday
.Ir
)
=3-65×-365×-365
. .365N
.complement
y
nI AT
=356×3-64×-363
. . 365-+4=3651n
IA I
=Irl
( 365
PEA ]
=I
The Birthday Problem: Some Stats
For n = 10, the probability is 0.11. For n = 23, the probability is 0.5. For n = 70, the probability is 0.999.
19 / 24The Monty Hall Problem
You’re on a game show. There are 3 doors you can choose from. Two of the doors lead to GOATS! One of them has a PRIZE! You pick a door. The host then opens a different door that leads to a goat. He now gives you the option of switching to the other unopened door. Poll: Should you switch?
20 / 24Monty Hall: Sample Space
Each game, there are three implicit choices (C1, C2, C3):
Tree of Outcomes:
21 / 24C ,
\
Rattans
.I
2 3c.
113%47
,
↳
Isbt
's !! ! ! 'm
Monty Hall: Probabilities
Two cases: (1) You initially choose the prize door (2) You initially choose a goat (1) (2)
22 / 24prob
.a
yellow
leaf
:sum
to
2 ?
⇐HIKE)
bits ) -16ft)
prob
blue
leaf
It
}
=L
t.sk?XH= 'T
a-
✓
Cl
I 2 3 c .113%47
,
↳
Is ! !
'shttp
Monty Hall: Events
Let W1 = the contestant switches doors and wins. Let W2 = the contestant stays and wins.
23 / 2443
43
IN
C l
l z 3 c .113.93
Ad,
Cs
L's !
L
's % ! ! t.azSummary
I Proceed methodically.
I What are the possible outcomes? I What is the probability for each outcome? I Is the sample space uniform or non-uniform?
I For uniform probability spaces, boils down to counting!
24 / 24