Combinatorics - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Combinatorics

Description:

The Birthday Problem. Given n people in a room, what is the ... Also assume that birthdays are. evenly distributed. p( b1, b2, ..., bn ) = 1 /365n ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 12
Provided by: anniegro
Category:

less

Transcript and Presenter's Notes

Title: Combinatorics


1
Combinatorics
  • CS311
  • Western Washington University

2
What is Combinatorics?
The mathematics of combinations. What is a
combination? An ordered sequence. To start,
lets look at some elementary counting
techniques for both ordered and unordered sets
of data.
3
Permutations
How many different ways can we arrange
the elements of a set? To answer this question,
order is very important. If set S has n members,
then there are n choices for the first element,
n-1 choices for the second element, etc.
Therefore there are n(n-1)(n-2)1
possible arrangements n! These are called
permutations. What if we want to count the
number of permutations of r elements chosen from
an n element set? n(n-1)(n-r1) This is also
expressed as P(n, r) n!/(n-r)! If Sa, b, c,
d, how many 2 element permutations exist? P(4,2)
4!/(4-2)!
4
Permutations and Bags
In the previous examples, we were selecting from
a set without replacementwe couldnt pick the
same element more than once. What if we could
pick the same element more than once?
Arrangements with replacement. How do we handle
permutations when we are selecting from a
bag? Let B be an n-element bag with k
distinct elements. Let m1, m2, , mk denote the
number of occurrences of each element. The
number of permutations of the n elements of B
is n! / m1!m2!mk!
5
Using this information Build a code to
represent each of 29 distinct objects with a
binary string having the same minimal length n,
where each string has the same number of 0s and
1s. n!/k!k! gt 29 where k n/2. This can be
solved by trial and error.
6
Combinations
Combinations are used for counting when order
doesnt matter, I.e. when counting the number of
subsets. Combinations are C(n,r) P(n,r)/r!
n!/r!(n-r)! Where did this formula come
from? Start by counting the number of r element
permutations of n elements. In this count, we
have included r! distinct r-element
permutations. We need to remove these redundant
permutations from the count.
7
Naturally Occurring Combinations
The binomial coefficient is an example of a
Naturally occurring combination. (ab)4 a4
4a3b 6a2b2 4ab3 b4 C(4,0)a4 C(4,1)a3b
C(4,2)a2b2 C(4,3)ab3 C(4,4)b4 Pascals
triangle contains the binomial Coefficients for
(ab)n.
8
Bag Combinations
We may have the need to count bags of
things rather than sets. The number of k-element
bags whose distinct elements are chosen from an
n-element set is C(n k 1, k) Example In
how many ways can five people be selected from a
collection of democrats, republicans, and
independents? C(3 5 1, 5)
9
Probability Distributions
A probability distribution p on S is a
function PS -gt 0,1 Such that p(x1) p(x2)
p(xn) 1 For a coin toss, the 4 possible
outcomes are HH, TT, HT, TH , and p(HH)
p(TT) p(HT) p(TH) ¼ The probability of any
event E in S is denoted P(E) ?
p(x). Example Let E be the event that at least
1 coin in a toss Is a tail. Then E TT, HT, TH
and P(E) ¼ ¼ ¼ ¾
10
The Birthday Problem
Given n people in a room, what is the
probability that at least 2 of the people
have the same birthday(month and day)? Assume
365 days in the year, so there are 365n possible
n-tuples of birthdays for n people. Also assume
that birthdays are evenly distributed. p(ltb1,
b2, , bngt) 1 /365n E is the subset of S
consisting of all n-tuples that contain 2 or
more equal entries. We want to know what is
P(E). We can solve this using the complement E
S E. This is the case where no 2 of the n
people have the same birthday. The
probability that we want is P(E) 1 P(E).
11
P(E) Perm(365,n)/ 365n Thus, P(E) 1
Perm(365,n) / 365n
Write a Comment
User Comments (0)
About PowerShow.com