Previously... - jess::fortier

Previously...



Permutations and combinations
Binomial theorem
Special types of permutations and combinations
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
1
Today



Quiz #2 (really!)
More special types of permutations and combinations
Introduction to discrete probability
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
2
Permutations with
Indistinguishable Objects


Sometimes, elements in counting problems may be
indistinguishable, and we have to avoid double counting.
Example: How many different strings can be created by
reordering the letters of the word “MISSISSIPPI”?
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
3
Permutations with
Indistinguishable Objects


Sometimes, elements in counting problems may be
indistinguishable, and we have to avoid double counting.
Example: How many different strings can be created by
reordering the letters of the word “MISSISSIPPI”?







There are 11 letters total: 1 M, 2 Ps, 4 Ss, and 4 Is.
We need to make an 11-character string.
The M can be placed in C(11, 1) ways.
The Ps can be placed in C(10, 2) ways after placing the M.
The Ss can be placed in C(8, 4) ways after placing the Ps.
The Is can be placed in only 1 way after placing the other letters.
Total: C(11, 1) • C(10, 2) • C(8, 4) = 34,650
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
4
Permutations with
Indistinguishable Objects

In general, if we have n objects where n1 are of type 1,
n2 are of type 2, ..., and nk are of type k, the number of
possible permutations is:
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
5
Permutations with
Indistinguishable Objects

You are given six 6-sided dice, two 8-sided dice, two 10sided dice, a 4-sided die, two 12-sided dice, and three 20sided dice. If dice with the same number of sides are
indistinguishable, but the order in which dice are rolled is
important, how many ways are there to roll the 16 dice?
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
6
Permutations with
Indistinguishable Objects


You are given six 6-sided dice, two 8-sided dice, two 10sided dice, a 4-sided die, two 12-sided dice, and three 20sided dice. If dice with the same number of sides are
indistinguishable, but the order in which dice are rolled is
important, how many ways are there to roll the 16 dice?
There are 16 dice total, and 6 kinds of dice. The number of
ways to roll the 16 dice is therefore:
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
7
Combinations with Repetition



How many ways are there to generate combinations of a
set of objects where repetition is allowed?
Last time, we did an example with a cash drawer and an
example with a hat store.
New example:
How many different combinations of coins can I give you,
if I give you 50 U.S. coins chosen from a supply of
pennies, nickels, dimes, quarters, half dollars, and
dollars? Assume I have at least 50 of each coin to choose
from.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
8
Combinations with Repetition


How many different combinations of coins can I give you,
if I give you 50 U.S. coins chosen from a supply of
pennies, nickels, dimes, quarters, half dollars, and
dollars? Assume I have at least 50 of each coin to choose
from.
There are 6 types of coin, and we need 50 of them. If we
arrange all the coins in a line, we have 5 “dividers”
marking where the coin type changes. For instance:
******|*****|*******|**************|*********|*********
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
9
Combinations with Repetition



In this case, weʼre choosing either the locations of the 5
dividers, or the locations of the 50 coins, from among 55
possible locations.
The number of combinations, then, is
C(55, 5) = C(55, 50) = 3,478,761.
In general, there are C(n + r - 1, r) = C(n + r - 1, n - 1)
r-combinations of a set with n elements when repetition is
allowed.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
10
A Counting Problem


A ternary string contains only 0s, 1s and 2s.
How many 10-digit ternary strings are there that contain
exactly two 0s, three 1s, and five 2s?
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
11
A Counting Problem







A ternary string contains only 0s, 1s and 2s.
How many 10-digit ternary strings are there that contain
exactly two 0s, three 1s, and five 2s?
There are C(10, 2) ways to place the two 0s.
Once weʼve done that, there are C(8, 3) ways to place the
three 1s.
Once weʼve done that, thereʼs one way to place the 2s.
Thus, there are C(10, 2) • C(8, 3) = 2,520 such strings.
This is a permutation with indistinguishable objects.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
12
Distributing Objects into Boxes


Another common type of counting problem is distributing
objects into boxes.
For example: how many different ways are there to deal
hands of 5 cards to 5 players from a 52-card deck?
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
13
Distributing Objects into Boxes




Another common type of counting problem is distributing
objects into boxes.
For example: how many different ways are there to deal
hands of 5 cards to 5 players from a 52-card deck?
Clearly, the ordering of cards in the hands isnʼt important...
but the person who gets each hand is.
In this case, the objects (the cards) are distinguishable each card is different.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
14
Distributing Objects into Boxes




The first person can be dealt cards in C(52, 5) ways,
leaving 47 cards.
The second person can now be dealt cards in C(47, 5)
ways, leaving 42 cards.
Continuing this process, we have C(42, 5), C(37, 5), and C
(32, 5) ways of dealing to persons 3, 4, and 5.
Thus, the total number is
C(52, 5) • C(47, 5) • C(42, 5) • C(37, 5) • C(32, 5) =
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
15
Distributing Objects into Boxes

In general, the number of ways to distribute n
distinguishable objects into k distinguishable boxes so that
ni objects are placed into box i for 1 ≤ i ≤ k is:

In our card example there were 6 boxes - 5 for the playersʼ
hands (with 5 cards each) and one for the leftover cards
(with 27 cards).
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
16
Distributing Objects into Boxes


How do we count the number of ways to distribute
indistinguishable objects into distinguishable boxes?
Example: I give you 10 boxes, numbered 1 through 10,
and a bag of 20 marbles, all alike. How many different
ways are there for you to put the marbles in the boxes?
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
17
Distributing Objects into Boxes




How do we count the number of ways to distribute
indistinguishable objects into distinguishable boxes?
Example: I give you 10 boxes, numbered 1 through 10,
and a bag of 20 marbles, all alike. How many different
ways are there for you to put the marbles in the boxes?
This is basically the same as picking a box out of a set of
10 boxes, 20 times, with repetition allowed. Each time you
pick a box, you drop a marble in it.
We already have a formula for this...
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
18
Distributing Objects into Boxes


The number of ways to distribute r indistinguishable
objects into n distinguishable boxes is the same as the
number of r-combinations for a set with n elements with
repetition allowed: C(n + r - 1, r) = C(n + r - 1, n - 1).
So there are C(29, 20) = C(29, 9) = 10,015,005 ways to
distribute the 20 marbles in the 10 boxes.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
19
Distributing Objects into Boxes


Unfortunately, there are no simple closed-form solutions
for the number of ways to distribute objects into
indistinguishable boxes, whether the objects are
distinguishable or not.
The end of section 5.5 has more about this, if youʼre
curious; we wonʼt discuss it in class.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
20
Discrete Probability


We can use what weʼve learned about counting
combinations and permutations for computing the
probabilities of things.
First, some terminology:




An experiment is a procedure that gives one of a specific set of
possible outcomes.
The sample space of an experiment is the set of possible
outcomes. It may be finite or infinite (but weʼll stick to finite).
An event is a subset of the sample space.
A probability of an event is a real number between 0 and 1,
inclusive, where 0 means the event never happens and 1 means
the event always happens.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
21
Discrete Probability

If S is a finite sample space of possible outcomes, and all
of them are equally likely, then the probability of event E
(E ⊆S) is:

If you pick a marble at random from a box with 7 green
marbles, 7 yellow marbles, and 7 blue marbles, what are
the probabilities of:


Picking a green marble?
Picking a blue or yellow marble?
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
22
Discrete Probability

If S is a finite sample space of possible outcomes, and all
of them are equally likely, then the probability of event E
(E ⊆S) is:

If you pick a marble at random from a box with 7 green
marbles, 7 yellow marbles, and 7 blue marbles, what are
the probabilities of:


Picking a green marble?
Picking a blue or yellow marble?

7/21 = 1/3
14/21 = 2/3
Notice that these two sets are disjoint, and their union is S therefore their probabilities must add up to 1 (and they do).
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
23
Discrete Probability

What is the probability of winning a Pick-6 lottery, where
the lottery numbers range from 1 to 50? (in a lottery,
typically the numbers need not be picked in order)
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
24
Discrete Probability



What is the probability of winning a Pick-6 lottery, where
the lottery numbers range from 1 to 50? (in a lottery,
typically the numbers need not be picked in order)
There are C(50,6) = 15,890,700 possible combinations.
There is one winning combination. So the probability of
winning is therefore 1/15,890,700 ≈ 6.292988981 x 10-8.
Playing the lottery is therefore not likely to be a winning
proposition.
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
25
Next Class

Discrete probability
TCSS 322 - Discrete Structures II!
http://moodle.insttech.washington.edu/!
More Counting, Intro to Discrete Probability
12 October 2010
26