Download slides

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Chapter 2
Combinatorial Methods
Wen-Guey Tzeng
Computer Science Department
National Chiao Tung University
Introduction
• If the sample space is finite and outcomes are all
equally likely, then
P(A)= N(A)/N(S)
• We study combinatorial analysis with the method
of counting.
2016 Fall
2
Counting principle
• Ei has ni elements, 1  i  m.
There are n1n2…nm ways of choosing an element
from each set Ei
2016 Fall
3
• How many outcomes are there if we throw 5 dice?
Sol:
• Let Ei = {1, 2, 3, 4, 5, 6}, 1  i 5
2016 Fall
4
• In tossing 4 fair dice,
P(at least one 3 among these 4 dice)=?
Sol:
• Let A = at least one 3 among these 4 dice
• Consider Ac =
2016 Fall
5
• Virginia wants to give her son, Brian, 14 different
baseball cards within a 7-day period. If Virginia
gives Brian cards no more than once a day, in how
many ways can this be done?
• Sol:
• Each card is given in a day.
• Ei={1, 2, …, 7}, 1  i  14.
• Sample space
2016 Fall
6
• Standard birthday problem
P(at least two among n people have the same
birthday)=?
• S = {(d1, d2, …, dn) | 1  di  365}
• A = at least two share the same birthday
• Ac =
2016 Fall
7
2016 Fall
8
Tree diagram method:events occur in temporal order
•
Bill and John keep playing chess until one wins two games in
a row or three games altogether.
How many ways that Bill wins without winning two in a row?
Note: not all branches are equiprobable.
2016 Fall
9
• Mark has $4. He decides to bet $1 on the flip of a fair
coin 4 times. What is the probability that
•
•
2016 Fall
He breaks even.
He wins money.
10
Permutations
• r-element arrangement nPr:
an ordered arrangement of r objects from a set A
containing n different objects.
nPr = n(n-1)(n-2)…(n-r+1) = n!/(n-r)!
• The order is important.
2016 Fall
11
• 3 people, Brown, Smith, and Jones, must be
scheduled for job interviews. In how many
different orders can this be done?
2016 Fall
12
• 2 anthropology, 4 computer science, 3 statistics, 3
biology, and 5 music books are put on a bookshelf with
a random arrangement. What is the probability that the
books of the same subject are together?
2016 Fall
13
• If 5 boys and 5 girls sit in a row in a random order,
P(no two children of the same sex sit together)=?
2016 Fall
14
Theorem: The number of distinguishable
permutations of n objects of k different types,
where type i has ni objects, and n=n1+n2+…+nk,
is
n!
n1! n2!... nk !
2016 Fall
15
• How many different 10-letter codes can be made
using 3 a’s, 4 b’s, and 3 c’s?
2016 Fall
16
• A fair coin is flipped 10 times.
P(exactly 3 heads)=?
2016 Fall
17
Combinations
• r-element combination nCr:
an un-ordered arrangement of r objects from a set A
containing n different objects,
nCr
= n!/(n-r)!r!
• The order is not important.
2016 Fall
18
• In how many ways can 2 math and 3 biology books
be selected from 8 math and 6 biology books?
2016 Fall
19
• In a small town, 11 of the 25 school teachers are
against abortion, 8 are for abortion, and the rest are
indifferent. A random sample of 5 school teachers is
selected for an interview.
• P(all 5 are for abortion) = ?
• P(all 5 have the same opinion) = ?
2016 Fall
20
• In Maryland’s lottery, player pick 6 integers between 1
and 49, order of selection being irrelevant.
• P(Grand prize)=?
• P(2nd prize)=?
• P(3rd prize)=?
2016 Fall
21
• A professor wrote n letters and sealed them in n
envelopes randomly.
P(at least one letter was addressed correctly)=?
Hint:
• Consider n=1, 2, 3, …
• Let Ei be the event that the ith letter is addressed correctly.
• Compute P(E1E2  …  En) by inclusion-exclusion principle
.
2016 Fall
22