Lecture 5
Lecture 5
1 Recall
2 Birthday problem
3 Binomial coefficients
Suppose G and H are playing several games. G needs three more wins and H needs two more
wins to get the stakes. If the games are stopped at this point, what is the fair division of
stakes? Assume that the stakes are Rs. 64.
Pascal: Algorithmic
Involved Pascal’s identity
Fermat: combinatoric
This lecture: binomial (Pascal’s identity) and permutations and combinations
Birthday problem
Questions
Question
In a class of 200 students, what is the probability that two students share the same birthday?
Question
How big should a class be so that the probability of two students sharing the same birthday is
more than 50%?
Guess
Question
In a class of 200 students, what is the probability that two students share the same birthday?
Answer
200
Probablity is ≈ 365 = 0.55
Link:
https://www.menti.com/alyv6higa18m
Results
Sample space
Number of sequences
Permutation
Definition
Let A be any finite set. A permutation of A is a one-to-one mapping of A into itself.
Theorem
The total number of permutations of a set A of n elements is n!.
Definition
Let A be an n-element set and let k be an integer between 0 and n. Then a k-permutation of
A is an ordered listing of a subset of A of size k.
Theorem
n!
The total number of k-permutations of a set A of n elements is (n−k)!
Calculation
Probability
365·364·363···166
Thus, for 200 students, the probability is 365200
The probability that two students have the same birthday is closer to 1
Note: factorial and calculation of the same using Stirling’s approximation
Guess
Question
How big should a class be so that the probability of two students sharing the same birthday is
more than 50%?
Can we guess this number and verify the guess using a python script?
Binomial coefficients
Combinations
Binomial coefficients
n
Number of distinct subsets with j elements that can be chosen with n elements: j (n
choose j)
n
j : binomial coefficient
Assume n > 0
There is only one way to choose zero elements or n elements
For integers j and n, with 0 < j < n
Theorem
n n−1 n−1
j = j + j−1
Bernoulli trials
Definition
A Bernoulli trials process is a sequence of n chance experiments such that each experiment has
two possible outcomes with probabilities of p for ‘success’ and 1 − p for ’failure’
What is the probability that in n Bernoulli trials there are exactly j successes?
Probability b(n, p, j) = nj p j q n−j
Binomial distribution
Definition
Let n be a positive integer and 0 < p < 1. The random variable B which counts the number
of successes in a Bernoulli trials process with parameters n and p is distributed as binomial
distribution b(n, p, k)
Use of binomial distribution: Tutorials. For example, to check the number of trials needed to
determine the efficacy of a new medicine and simulation of Galton board
A problem
G and H have given a quiz to 300 students in their data analysis course. The quiz consisted of
10 true or false questions. If the students tossed a coin to answer the questions, how many
students would have scored ten on ten? How many zero on ten? If there are about 100
students who had scored 10 on 10 and about 5 scored 0 on 10, what can you conclude about
the difficulty level of the quiz?
n
p j q n−j
Probability b(n, p, j) = j
n = 10; p = 0.5; j = 0 and j = 10
from scipy.stats import binom
binom.pmf(0,10,0.5)
binom.pmf(10,10,0.5)
Probability: ≈ 0.001
Python script
x = binom.rvs(10,0.5,size=300)
plt.hist(x,bins=[0,1,2,3,4,5,6,7,8,9,10])
plt.show()
Question
Fixed points
Inclusion-Exclusion principle
Theorem
Let P be a probability measure on a sample space Ω and let (A1 , A2 , ...An ) be a finite set of
elements. Then,
n
X
P(A1 ∪ A2 ∪ · · · ∪ An ) = P(Ai ) (1)
i=1
X
− P(Ai ∩ Aj )
1≤i<j≤n
X
+ P(Ai ∩ Aj ∩ Ak )
1≤i<j<k≤n
−···
Inclusion-Exclusion principle
Other terms
Let (ai , aj ) be fixed
The permutations of remaining elements is (n − 1)!
Thus P(Ai ∩ Aj ) = (n−2)!
n!
1
= n(n−1)
There are n2 such terms
Solution
1 1 1
1− + − · · · (−1)n−1 (2)
2! 3! n!
P(no fixed point)
1 1 1
− + · · · (−1)n (3)
2! 3! n!
1
P(no fixed point) is the sum of the first n terms of the expansion for e
Summary
Permutations
Combinations
Bernoulli trials and binomial distribution
Next lecture: Conditional probability
THANK YOU!!!