# 27

Document Sample

```					    CSci 2011
Discrete
Mathematics
Lecture 27 – ch 5.4, 5.5

Fall 2008
Yongdae Kim

CSci 2011 Fall 2008
Assignment
 Assignment 11 will be posted.
E-mail
 CC TA for all of your e-mails.
 Put [2011] in front.
Quiz 5: Nov 21th, Covering Ch 4.1 ~ 5.2 (not 5.3)

New office hour
 M: 12:30 ~ 1:30 pm (before 11:00 ~ 12:00)
 T: 3:00 ~ 4:00 pm
 W, F: Same as before

CSci 2011 Fall
Recap
 If there are n1 ways to do task 1, and n2 ways to do task 2
 Then there are n1n2 ways to do both tasks in sequence
 If these tasks can be done at the same time, then there are n1+n2 ways to
do one of the two tasks
 The inclusion-exclusion principle: |A1UA2| = |A1|+|A2|-|A1∩A2|
 Pigeon-hole principle: If N objects are placed into k boxes, then there
is at least one box containing N/k objects
 A permutation is an ordered arrangement of the elements of some set
S: P(n, r) = n! / (n-r)!.
 When order does not matter, it is called combination: C(n, r) = n! /
(r! (n-r)!)
 Let n and r be integers with 0 ≤ r ≤ n. Then C(n,r)=C(n,n-r).
 (x+y)n = i=0n nCi xi yn-i
 Let n and k be positive integers with n ≥ k. Then n+1Ck= nCk+nCk-1.

CSci 2011 Fall
Pascal’s Identity
By Pascal’s identity: 7C5= 6C5+6C4 or 21=15+6

Let n and k be positive integers with n ≥ k.
Then n+1Ck= nCk+nCk-1

We will prove this via two ways:
 Combinatorial proof
 Using the formula for nCk

CSci 2011 Fall
Combinatorial proof of Pascal’s
identity
Prove C(n+1,k) = C(n,k-1) + C(n,k)
Consider a set T of n+1 elements
 We want to choose a subset of k elements
 We will count the number of subsets of k elements via 2 methods
Method 1: There are C(n+1,k) ways to choose such a
subset
Method 2: Let a be an element of set T
Two cases
 a is in such a subset
 There are C(n,k-1) ways to choose such a subset
 a is not in such a subset
 There are C(n,k) ways to choose such a subset
Thus, there are C(n,k-1) + C(n,k) ways to choose a
subset of k elements
Therefore, C(n+1,k) = C(n,k-1) + C(n,k)

CSci 2011 Fall
Algebraic proof of Pascal’s identity
(n + 1)!               n!               n!
=                      +
k!(n + 1 - k )! (k - 1)!(n - (k - 1))! k!(n - k )!
(n + 1)n!                         n!                       n!
=                            +
k (k - 1)!(n + 1 - k )(n - k )! (k - 1)!(n - k + 1)(n - k )! k (k - 1)!(n - k )!
(n + 1)          1        1                                        Substitutions:
=            +
k (n + 1 - k ) (n - k + 1) k
(n + 1 - k )!= (n + 1 - k ) * (n - k )!
(n + 1)           k         (n - k + 1)
=             +                                   (n + 1)!= (n + 1)n!
k (n + 1 - k ) k (n - k + 1) k (n - k + 1)
(n - k + 1) = (n - k + 1)(n - k )!
n +1 = k + n - k +1
n +1 = n +1

CSci 2011 Fall
Pascal’s triangle
n= 0                  sum = 1
= 2n
1                        2

2                        4

3                        8

4                       16

5                       32

6                       64

7                       128

8                       256

CSci 2011 Fall
Proof practice: corollary 1
Let n be a non-negative integer. Then
i=0n nCi = 2n

Algebraic proof
Binomial equation: (x+y)n = i=0n nCi xiyn-i

Put x=1, and y = 1
2n = i=0n nCi

CSci 2011 Fall
Proof practice: corollary 1
Let n be a non-negative integer. Then i=0n nCi =2i

Combinatorial proof
 A set with n elements has 2n subsets
By definition of power set
 Each subset has either 0 or 1 or 2 or … or n elements
There are nC0 subsets with 0 elements, nC1 subsets with 1
element, … and nCn subsets with n elements
Thus, the total number of subsets is i=0n nCi

 Thus, i=0n nCi =2i.

CSci 2011 Fall
Proof practice: corollary 2
Let n be a non-negative integer. Then
i=0n (-1)nnCi = 0

Algebraic proof
Binomial equation: (x+y)n = i=0n nCi xiyn-i

Put x=-1, and y = 1
0 = i=0n (-1)nnCi

CSci 2011 Fall
Vandermonde’s identity
Let m, n, and r be non-negative integers with r not
exceeding either m or n. Then
m+rCn = i=0 (mCr-i nCi)
r

Consider two sets, one with m items and one
with n items
 Then there are m+rCn ways to choose r items from the union
of those two sets
Next, we’ll find that value via a different means
 Pick i elements from the set with n elements
 Pick the remaining r-i elements from the set with m
elements
 Via the product rule, there are mCr-i nCi ways to do that for
EACH value of i
 Lastly, consider this for all values of i.

CSci 2011 Fall
Examples
How many bit strings of length 10 contain exactly
four 1’s?
 Find the positions of the four 1’s
 The order of those positions does not matter
Positions 2, 3, 5, 7 is the same as positions 7, 5, 3, 2
 Thus, the answer is C(10,4) = 210

Generalization of this result:
 There are C(n,r) possibilities of bit strings of length n
containing r ones

CSci 2011 Fall
ch 6.1
Discrete Probability
Fall 2008
Yongdae Kim

CSci 2011 Fall 2008
Terminology
Experiment
A repeatable procedure that yields one of a given
set of outcomes
Rolling a die, for example
Sample space
The range of outcomes possible
For a die, that would be values 1 to 6
Event
One of the sample outcomes that occurred
If you rolled a 4 on the die, the event is the 4

CSci 2011 Fall
Probability definition
The probability of an event occurring is:
p(E) = |E| / |S|
Where E is the set of desired events (outcomes)
Where S is the set of all possible events
(outcomes)
Note that 0 ≤ |E| ≤ |S|
Thus, the probability will always between 0 and 1
An event that will never happen has probability 0
An event that will always happen has probability 1

CSci 2011 Fall
Dice probability
What is the probability of getting “snake-eyes” (two
1’s) on two six-sided dice?
 Probability of getting a 1 on a 6-sided die is 1/6
 Via product rule, probability of getting two 1’s is the
probability of getting a 1 AND the probability of getting a
second 1
 Thus, it’s 1/6 * 1/6 = 1/36
What is the probability of getting a 7 by rolling two
dice?
 There are six combinations that can yield 7: (1,6), (2,5),
(3,4), (4,3), (5,2), (6,1)
 Thus, |E| = 6, |S| = 36, P(E) = 6/36 = 1/6

CSci 2011 Fall
Poker

CSci 2011 Fall 2008
Playing Card

CSci 2011 Fall
The game of poker
 You are given 5 cards (this is 5-card stud poker)
 The goal is to obtain the best hand you can
 The possible poker hands are (in increasing order):
 No pair
 One pair (two cards of the same face)
 Two pair (two sets of two cards of the same face)
 Three of a kind (three cards of the same face)
 Straight (all five cards sequentially – ace is either high or low)
 Flush (all five cards of the same suit)
 Full house (a three of a kind of one face and a pair of another
face)
 Four of a kind (four cards of the same face)
 Straight flush (both a straight and a flush)
 Royal flush (a straight flush that is 10, J, K, Q, A)

CSci 2011 Fall
Poker probability: royal flush
What is the chance of
getting a royal flush?
 That’s the cards 10, J, Q, K,
and A of the same suit

There are only 4 possible
royal flushes

Possibilities for 5 cards: C(52,5) = 2,598,960

Probability = 4/2,598,960 = 0.0000015
 Or about 1 in 650,000

CSci 2011 Fall
Poker probability: four of a kind
What is the chance of getting 4 of a kind when dealt
5 cards?
 Possibilities for 5 cards: C(52,5) = 2,598,960

Possible hands that have four of a kind:
 There are 13 possible four of a kind hands
 The fifth card can be any of the remaining 48 cards
 Thus, total possibilities is 13*48 = 624

Probability = 624/2,598,960 = 0.00024
 Or 1 in 4165

CSci 2011 Fall
Poker probability: flush
What is the chance of getting a flush?
 That’s all 5 cards of the same suit
We must do ALL of the following:
 Pick the suit for the flush: C(4,1)
 Pick the 5 cards in that suit: C(13,5)
As we must do all of these, we multiply the values
out (via the product rule)

This yields C(4,1) C(13,5) = 5148

Possibilities for 5 cards: C(52,5) = 2,598,960
Probability = 5148/2,598,960 = 0.00198
 Or about 1 in 505

CSci 2011 Fall
Inclusion-exclusion principle
 The possible poker hands are (in increasing order):
 Nothing
 One pair cannot include two pair, three of a kind, four of a kind, or
full house
 Two pair cannot include three of a kind, four of a kind, or full
house
 Three of a kind cannot include four of a kind or full house
 Straight cannot include straight flush or royal flush
 Flush cannot include straight flush or royal flush
 Full house
 Four of a kind
 Straight flush cannot include royal flush
 Royal flush

CSci 2011 Fall
Poker probability: three of a kind
What is the chance of getting a three of a kind?
 That’s three cards of one face
 Can’t include a full house or four of a kind
We must do ALL of the following:
 Pick the face for the three of a kind: C(13,1)
 Pick the 3 of the 4 cards to be used: C(4,3)
 Pick the two other cards’ face values: C(12,2)
 We can’t pick two cards of the same face!
 Pick the suits for the two other cards: C(4,1)*C(4,1)
As we must do all of these, we multiply the values out
(via the product rule)

This yields C(13,1) C(4,3) C(12,2) C(4,1) C(4,1) = 54,912

Possibilities for 5 cards: C(52,5) = 2,598,960
Probability = 54,912/2,598,960 = 0.0211
 Or about 1 in 47

CSci 2011 Fall
Poker hand odds
The possible poker hands are (in increasing order):
 Nothing               1,302,540   0.5012
 One pair              1,098,240   0.4226
 Two pair              123,552     0.0475
 Three of a kind 54,9120.0211
 Straight        10,2000.00392
 Flush                 5,140       0.00197
 Full house            3,744       0.00144
 Four of a kind        624         0.000240
 Straight flush        36          0.0000139
 Royal flush           4           0.00000154

CSci 2011 Fall
More on probabilities
Let E be an event in a sample space S. The
probability of the complement of E is:


p E = 1 - p( E )

Recall the probability for getting a royal flush is
0.0000015
 The probability of not getting a royal flush is
1-0.0000015 or 0.9999985
Recall the probability for getting a four of a kind is
0.00024
 The probability of not getting a four of a kind is
1-0.00024 or 0.99976

CSci 2011 Fall
Probability of the union of two events
Let E1 and E2 be events in sample space S

Then p(E1 U E2) = p(E1) + p(E2) – p(E1 ∩ E2)

Consider a Venn diagram dart-board

CSci 2011 Fall
Probability of the union of two events

p(E1 U E2)

S

E1                E2

CSci 2011 Fall
Probability of the union of two events
If you choose a number between 1 and 100,
what is the probability that it is divisible by 2
or 5 or both?
Let n be the number chosen
p(2|n)   = 50/100 (all the even numbers)
p(5|n)   = 20/100
p(2|n)   and p(5|n) = p(10|n) = 10/100
p(2|n)   or p(5|n) = p(2|n) + p(5|n) - p(10|n)
= 50/100 + 20/100 – 10/100
= 3/5

CSci 2011 Fall
Dealing cards
Consider a dealt hand of cards
Assume they have not been seen yet
What is the chance of drawing a flush?
Does that chance change if I speak words after
the experiment has completed?

No!
Words spoken after an experiment has
completed do not change the chance of an event
happening by that experiment
No matter what is said

CSci 2011 Fall

CSci 2011 Fall 2008
What’s behind door number three?
Consider a game show where a prize (a car) is behind
one of three doors
The other two doors do not have prizes (goats
After picking one of the doors, the host (Monty Hall)
opens a different door to show you that the door he
opened is not the prize
Your initial probability to win (i.e. pick the right door)
is 1/3
What is your chance of winning if you change your
choice after Monty opens a wrong door?
After Monty opens a wrong door, if you change your
choice, your chance of winning is 2/3
Thus, your chance of winning doubles if you change
Huh?

CSci 2011 Fall
What’s behind door number one hundred?
Consider 100 doors
 You choose one
 Monty opens 98 wrong doors
 Do you switch?
Your initial chance of being right is 1/100
still 1/100
 You didn’t know this info beforehand!
Your final chance of being right is 99/100 if you switch
 You have two choices: your original door and the new door
 The original door still has 1/100 chance of being right
 Thus, the new door has 99/100 chance of being right
 The 98 doors that were opened were not chosen at random!
 Monty Hall knows which door the car is behind

Reference:
http://en.wikipedia.org/wiki/Monty_Hall_problem
CSci 2011 Fall

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 2 posted: 8/31/2011 language: English pages: 33