cs2102: Discrete Mathematics
Class 26: Counting II + Probability
David Evans, Mohammad Mahmoody
Slide 2
Slide 2 text
Plan
Today:
– Counting II
– Intro to probability theory
Next Tuesday: Review
Next Thursday: Final Exam
Slide 3
Slide 3 text
Four basic counting problems
• Want to choose elements from {1, … , }
Repetition IS
allowed
Repetition is NOT
allowed
Ordered
(sequence)
!
− !
Not ordered
(set)
Slide 4
Slide 4 text
No content
Slide 5
Slide 5 text
Counting when order does not matter
• How many ways to select a -subset of 1, … , ?
• Namely:
= { ∣ ⊆ , = } what is
?
• Idea: define
to contain -sequences using 1, … , …
Slide 6
Slide 6 text
Recall Example 3 from last time
How many (at most) 16-bit numbers with exactly 4 ones?
Slide 7
Slide 7 text
Recall Example 4 from last time
How many ways to choose 12 doughnuts from 5 varieties.
Note: Order does not matter + Repetition is allowed.
Seems like a new (4th) type of counting problem.
We relate it to the previous problem (of no repetition) !
Slide 8
Slide 8 text
Relating the Examples
3. How many (at most) 16-bit numbers with exactly 4 ones?
4. How many ways to choose 12 doughnuts from 5 varieties.
Slide 9
Slide 9 text
Four basic counting problems
• Want to choose elements from {1, … , }
Repetition IS
allowed
Repetition is NOT
allowed
Ordered
(sequence)
!
− !
=
⋅ !
Not ordered
(set)
+ − 1
− 1
=
!
! − !
Slide 10
Slide 10 text
Using Counting In Proofs!
• Prove
=
−
Slide 11
Slide 11 text
“Binomial Coefficient”
• + = 1≤≤
−
Slide 12
Slide 12 text
Probability Theory
Slide 13
Slide 13 text
Examples of Questions
• A bag of 10 donuts and 5 bagels:
1. Remove one at random.
What is the “probability” that it is a bagel?
2. Pick another item: What is the probability that
it is a donut conditioned on 1st one being a bagel?
Slide 14
Slide 14 text
Sample Space
• The set of all outcomes of the experiment
• Each have its own probability, adding up to 1.
• Example: picking one of: 10 Donuts + 5 Bagels:
Slide 15
Slide 15 text
Event
• An Event ⊆ Ω: a subset of the outcomes Ω
• Probability of :
Pr =
∈
Pr[]
Slide 16
Slide 16 text
Examples of Questions
• A bag of 10 donuts and 5 bagels:
1. Remove one at random. “Probability” that it is a bagel?
2. Pick another item: What is the probability it is a donut
conditioned on 1st one being a bagel?
Slide 17
Slide 17 text
Conditional Probability
• Events , . The probability of conditioned
on happening is:
Pr | =
Pr ∩
Pr[]