Combinations

advertisement
Combinations
Combinations are very similar to
permutations with one key difference:
Order does not matter.
Combinations
Consider two very similar examples
that illustrate this difference.
Example 1: You have selected 5 cities to visit
on a vacation. How many possible itineraries
do you have? (In how many different orders
could you visit the 5 cities?
Example 2: You have a list of 15 cities that
you want to visit, but you can only fit 5 into
your schedule. How many different sets of 5
cities could you select?
Combinations
The first example is a permutation
problem, because order matters.
The second example is a
combination, because we are looking
only for a grouping, and order does
not matter.
Combinations
Because the problems are similar, it
might not surprise you that the
methods for solving them are also
similar.
Combinations
Let’s begin with an even simpler
problem.
Example: You have 5 movies that you want
to watch, but you only have time for 2 of
them. How many different pairs of movies
could you select?
Combinations
Select 2 out of 5 movies.
We could start the problem the same way
we would start a permutation problem.
You have 5 options for the first movie.
After picking 1 movie, you have 4 options
remaining for the second movie.
5*4 = 20, but we need to adjust this.
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
Consider the pairs where A is the first
movie:
AB
AC
AD
AE
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
Add the pairs where B is the first movie:
AB
BA
AC
AD
AE
BC
BD
BE
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
Add the pairs where C is the first movie:
AB
BA
CA
AC
AD
AE
BC
BD
BE
CB
CD
CE
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
Add the pairs where D is the first movie:
AB
BA
CA
DA
AC
AD
AE
BC
BD
BE
CB
CD
CE
DB
DC
DE
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
Add the pairs where E is the first movie:
AB
BA
CA
DA
EA
AC
AD
AE
BC
BD
BE
CB
CD
CE
DB
DC
DE
EB
EC
ED
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
Have you spotted the problem?
AB
BA
CA
DA
EA
AC
AD
AE
BC
BD
BE
CB
CD
CE
DB
DC
DE
EB
EC
ED
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
Every pair is listed twice.
AB
BA
CA
DA
EA
AC
AD
AE
BC
BD
BE
CB
CD
CE
DB
DC
DE
EB
EC
ED
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
We need to divide our answer by 2, to
account for the pairs being counted twice.
AB
BA
CA
DA
EA
AC
AD
AE
BC
BD
BE
CB
CD
CE
DB
DC
DE
EB
EC
ED
Combinations
Select 2 out of 5 movies.
Label the movies as A, B, C, D, and E.
(5*4) / 2 = 10 possible pairs of movies.
AB
BA
CA
DA
EA
AC
AD
AE
BC
BD
BE
CB
CD
CE
DB
DC
DE
EB
EC
ED
Combinations
Now say you want to select 3 out of 5
movies.
Use the labels again for the movies, and
begin by listing trios that start with A.
ABC ABD ABE ACB ACD ACE ADB ADC ADE AEB AEC AED
Combinations
Now say you want to select 3 out of 5
movies.
Add the trios that begin with B:
ABC ABD ABE ACB ACD ACE ADB ADC ADE AEB AEC AED
BAC BAD BAE BCA BCD BCE BDA BDC BDE BEA BEC BED
Combinations
Now say you want to select 3 out of 5
movies.
Add the trios that begin with C:
ABC ABD ABE ACB ACD ACE ADB ADC ADE AEB AEC AED
BAC BAD BAE BCA BCD BCE BDA BDC BDE BEA BEC BED
CAB CAD CAE CBA CBD CBE CDA CDB CDE CEA CEB CED
Combinations
Now say you want to select 3 out of 5
movies.
Add the trios that begin with D and E:
ABC
BAC
CAB
DAB
EAB
ABD
BAD
CAD
DAC
EAC
ABE
BAE
CAE
DAE
EAD
ACB ACD ACE
BCA BCD BCE
CBA CBD CBE
DBA DBC DBE
EBA EBC EBD
ADB
BDA
CDA
DCA
ECA
ADC ADE AEB
BDC BDE BEA
CDB CDE CEA
DCB DCE DEA
ECB ECD EDA
AEC
BEC
CEB
DEB
EDB
AED
BED
CED
DEC
EDC
Combinations
Now say you want to select 3 out of 5
movies.
How many times has each trio been counted?
ABC
BAC
CAB
DAB
EAB
ABD
BAD
CAD
DAC
EAC
ABE
BAE
CAE
DAE
EAD
ACB ACD ACE
BCA BCD BCE
CBA CBD CBE
DBA DBC DBE
EBA EBC EBD
ADB
BDA
CDA
DCA
ECA
ADC ADE AEB
BDC BDE BEA
CDB CDE CEA
DCB DCE DEA
ECB ECD EDA
AEC
BEC
CEB
DEB
EDB
AED
BED
CED
DEC
EDC
Combinations
Now say you want to select 3 out of 5
movies.
How many times has each trio been counted?
Not twice, not thrice, but 6 times!
ABC
BAC
CAB
DAB
EAB
ABD
BAD
CAD
DAC
EAC
ABE
BAE
CAE
DAE
EAD
ACB ACD ACE
BCA BCD BCE
CBA CBD CBE
DBA DBC DBE
EBA EBC EBD
ADB
BDA
CDA
DCA
ECA
ADC ADE AEB
BDC BDE BEA
CDB CDE CEA
DCB DCE DEA
ECB ECD EDA
AEC
BEC
CEB
DEB
EDB
AED
BED
CED
DEC
EDC
Combinations
Now say you want to select 3 out of 5
movies.
How many times has each trio been counted?
Look for example at the combination of A, B,
and C.
ABC
BAC
CAB
DAB
EAB
ABD
BAD
CAD
DAC
EAC
ABE
BAE
CAE
DAE
EAD
ACB ACD ACE
BCA BCD BCE
CBA CBD CBE
DBA DBC DBE
EBA EBC EBD
ADB
BDA
CDA
DCA
ECA
ADC ADE AEB
BDC BDE BEA
CDB CDE CEA
DCB DCE DEA
ECB ECD EDA
AEC
BEC
CEB
DEB
EDB
AED
BED
CED
DEC
EDC
Combinations
Now say you want to select 3 out of 5
movies.
How many times has each trio been counted?
We want to count this trio once, not 6 times.
ABC
BAC
CAB
DAB
EAB
ABD
BAD
CAD
DAC
EAC
ABE
BAE
CAE
DAE
EAD
ACB ACD ACE
BCA BCD BCE
CBA CBD CBE
DBA DBC DBE
EBA EBC EBD
ADB
BDA
CDA
DCA
ECA
ADC ADE AEB
BDC BDE BEA
CDB CDE CEA
DCB DCE DEA
ECB ECD EDA
AEC
BEC
CEB
DEB
EDB
AED
BED
CED
DEC
EDC
Combinations
Now say you want to select 3 out of 5
movies.
How many times has each trio been counted?
We want to count this trio once, not 6 times.
As a result, we must divide by 6.
ABC
BAC
CAB
DAB
EAB
ABD
BAD
CAD
DAC
EAC
ABE
BAE
CAE
DAE
EAD
ACB ACD ACE
BCA BCD BCE
CBA CBD CBE
DBA DBC DBE
EBA EBC EBD
ADB
BDA
CDA
DCA
ECA
ADC ADE AEB
BDC BDE BEA
CDB CDE CEA
DCB DCE DEA
ECB ECD EDA
AEC
BEC
CEB
DEB
EDB
AED
BED
CED
DEC
EDC
Combinations
Now say you want to select 3 out of 5
movies.
How many groups of 3 movies are possible?
(5*4*3) / 6 = 10 possible trios.
ABC
BAC
CAB
DAB
EAB
ABD
BAD
CAD
DAC
EAC
ABE
BAE
CAE
DAE
EAD
ACB ACD ACE
BCA BCD BCE
CBA CBD CBE
DBA DBC DBE
EBA EBC EBD
ADB
BDA
CDA
DCA
ECA
ADC ADE AEB
BDC BDE BEA
CDB CDE CEA
DCB DCE DEA
ECB ECD EDA
AEC
BEC
CEB
DEB
EDB
AED
BED
CED
DEC
EDC
Combinations
How do you decide the extent of
overcounting for these problems?
When we grouped 2 items, we had to divide
by 2. When we grouped 3 items, we had to
divide by 6. What about for 4 items?
Combinations
How do you decide the extent of
overcounting for these problems?
When we grouped 2 items, we had to divide
by 2. When we grouped 3 items, we had to
divide by 6. What about for 4 items?
You can answer that by answering this
question: In how many ways can you arrange
4 items? That’s how many times each group
will be counted, and we need to divide by
that factor.
Combinations
Do you need to list every possible
group in order to determine how
many times each group is counted?
Fortunately, no you do not need to list all
possible groups. The number of times a
group of 4 items will be counted, for example,
is simply the number of permutations for 4
items. We already have a nice formula to use
to calculate that number.
Combinations
Example: You have a stack of 10
books that you want to read. On your
next vacation you decide to take 4 of
them with you. In how many ways
can you pick 4 books out of the 10?
Combinations
Example: You have a stack of 10
books that you want to read. On your
next vacation you decide to take 4 of
them with you. In how many ways
can you pick 4 books out of the 10?
You could begin the same as you would with
a permutation problem:
P(10, 4) = __10!__ = 10!
(10-4)!
6!
Combinations
Pick 4 out of 10 books.
Next we need to consider how many times
each group of 4 will have been counted,
which is simply 4! times.
We need to divide by that factor to eliminate
the overcounting.
Combinations
Pick 4 out of 10 books.
10!
__6!__
4!
=
__10!__
6! 4!
Combinations
In general, the number of
combinations of m items out of n is:
__n!__
__(n-m)!__
m!
=
___n!____
(n-m)! m!
Combinations
As with permutations, we have some
common notations for combinations:
C(n, m)
nCm
Combinations
Once again, it is common for
graphing calculators and computer
spreadsheet programs to have a
function for combinations.
Graphing calculators typically have a
nCr function nearby the nPr function.
Combinations
Go back to our original examples.
Example 1: You have selected 5 cities to visit
on a vacation. How many possible itineraries
do you have? (In how many different orders
could you visit the 5 cities?
Example 2: You have a list of 15 cities that
you want to visit, but you can only fit 5 into
your schedule. How many different sets of 5
cities could you select?
Combinations
Go back to our original examples.
Example 1 is a straight forward permutation
problem. There are 5!, or 120 different ways
to arrange the order of visiting 5 cities.
Combinations
Go back to our original examples.
Example 2 is a combination problem where we
are picking 5 out of 15 cities, and are not
concerned with order.
C(15, 5) =
__15!__
10! 5!
Combinations
On a graphing calculator:
•Enter 15, the total number of items
•Press MATH
•Move the cursor to the PRB section
•Move the cursor down to the nCr function
•Press ENTER
•Enter 5, the number of items being chosen
•Press ENTER
•You should see an answer of 3,003
Combinations
Example: From a list of 5 candidates
for student council representative,
you are asked to vote for 2. In how
many ways can you do this?
Combinations
Example: From a list of 5 candidates
for student council representative,
you are asked to vote for 2. In how
many ways can you do this?
You are being asked to pick 2, not rank them,
so this is a combination problem.
C(5, 2) = 10
Combinations
Example: From a list of 5 candidates
for student council representative,
you are asked to vote for 3. In how
many ways can you do this?
Combinations
Example: From a list of 5 candidates
for student council representative,
you are asked to vote for 3. In how
many ways can you do this?
You are being asked to pick 3, not rank them,
so this is a combination problem.
C(5, 3) = 10
Combinations
Example: From a list of 5 candidates
for student council representative,
you are asked to vote for 3. In how
many ways can you do this?
You are being asked to pick 3, not rank them,
so this is a combination problem.
C(5, 3) = 10
Notice anything interesting?
Combinations
It appears that C(5, 2) = C(5, 3).
How could this be?
Combinations
C(5, 2) = C(5, 3)
Compare the formulas:
__5!__
3! 2!
vs.
__5!__
2! 3!
They’re the same thing! But why?
Combinations
C(5, 2) = C(5, 3)
This is another version of the old glass half full
/ glass half empty scenario.
Combinations
C(5, 2) = C(5, 3)
This is another version of the old glass half full
/ glass half empty scenario.
Choosing which 2 candidates out of 5 to
pick is really the same thing as choosing which
3 candidates not to pick.
Combinations
In some cases we can combine the
technique of combinations with other
techniques, such as permutations or
the multiplication or addition
principles.
Combinations
Example: At a certain ice cream store,
you can make a sundae with either 1
or 2 scoops of ice cream, combined
with 1 topping. This store has 20
flavors of ice cream, and 5 different
toppings. How many unique sundaes
are possible?
Combinations
First, consider the ice cream.
If you choose 1 scoop of ice cream, there are 20
options (20 flavors).
If you choose 2 scoops, there are (20*20) / 2, or
200 possibilities. (You have 20 options for the
first scoop, and 20 again for the second scoop,
because you could pick the same flavor for both
scoops. We have to divide by 2, because every
pair was counted twice.
Combinations
First, consider the ice cream.
Because we have 20 possibilities for 1 scoop,
and 200 possibilities for 2 scoops, we end up
with 200 + 20, or 220 possibilities for ice cream.
Combinations
Now consider the topping.
We have 5 options for the topping.
Combinations
Now multiply the options.
toppings
220*5 = 1100 total possible sundaes
ice cream
Download