Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter 5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Combinatorics

5.1 Introduction

Combinatorics is a special branch of mathematics. It has many applications not


only in several interesting fields such as enumerative combinatorics (the classical
application), but also in other fields, for example in graph theory and optimization.
First, we try to motivate and understand the role of combinatorics in statistics.
Consider a simple example in which someone goes to a cafe. The person would
like a hot beverage and a cake. Assume that one can choose among three different
beverages, for example cappuccino, hot chocolate, and green tea, and three different
cakes, let us say carrot cake, chocolate cake, and lemon tart. The person may consider
different beverage and cake combinations when placing the order, for example carrot
cake and cappuccino, carrot cake and tea, and hot chocolate and lemon tart. From a
statistical perspective, the customer is evaluating the possible combinations before
making a decision. Depending on their preferences, the order will be placed by
choosing one of the combinations.
In this example, it is easy to calculate the number of possible combinations.
There are three different beverages and three different cakes to choose from, leading
to nine different (3 × 3) beverage and cake combinations. However, suppose there
is a choice of 15 hot beverages and 8 different cakes. How many orders can be
made? (Answer: 15 × 8) What if the person decides to order two cakes, how will it
affect the number of possible combinations of choices? It will be a tedious task to
count all the possibilities. So we need a systematic approach to count such possible
combinations. Combinatorics deals with the counting of different possibilities in a
systematic approach.
People often use the urn model to understand the system in the counting process.
The urn model deals with the drawing of balls from an urn. The balls in the urn

© Springer International Publishing Switzerland 2016 97


C. Heumann et al., Introduction to Statistics and Data Analysis,
DOI 10.1007/978-3-319-46162-5_5
98 5 Combinatorics

(a) (b) (c)

(d) – – – ...

(e) – –

Fig. 5.1 a Representation of the urn model. Drawing from the urn model b with replacement and c
without replacement. Compositions of three drawn balls: d all balls are distinguishable and e some
balls are not distinguishable

represent the units of a population, or the features of a population. The balls may
vary in colour or size to represent specific properties of a unit or feature. We illustrate
this concept in more detail in Fig. 5.1.
Suppose there are 5 balls of three different colours—two black, one grey, and two
white (see Fig. 5.1a). This can be generalized to a situation in which there are n balls
in the urn and we want to draw m balls. Suppose we want to know

• how many different possibilities exist to draw m out of n balls (thus determining
the number of distinguishable combinations).

To deal with such a question, we first need to decide whether a ball will be put back
into the urn after it is drawn or not. Figure 5.1b illustrates that a grey ball is drawn
from the urn and then placed back (illustrated by the two-headed arrow). We say the
ball is drawn with replacement. Figure 5.1c illustrates a different situation in which
the grey ball is drawn from the urn and is not placed back into the urn (illustrated by
the one-headed arrow). We say the ball is drawn without replacement.
Further, we may be interested in knowing the

• total number of ways in which the chosen set of balls can be arranged in a distin-
guishable order (which we will define as permutations later in this chapter).

To answer the question how many permutations exist, we first need to decide whether
all the chosen balls are distinguishable from each other or not. For example, in
Fig. 5.1d, the three chosen balls have different colours; therefore, they are distin-
guishable. There are many options on how they can be arranged. In contrast, some
5.1 Introduction 99

of the chosen balls in Fig. 5.1e are the same colour, they are therefore not distin-
guishable. Consequently, the number of combinations is much more limited. The
concept of balls and urns just represents the features of observations from a sample.
We illustrate this in more detail in the following example.

Example 5.1.1 Say a father promises his daughter three scoops of ice cream if she
cleans up her room. For simplicity, let us assume the daughter has a choice of four
flavours: chocolate, banana, cherry, and lemon. How many different choices does the
daughter have? If each scoop has to be a different flavour she obviously has much
less choice than if the scoops can have the same flavour. In the urn model, this is rep-
resented by the concept of “with/without replacement”. The urn contains 4 balls of 4
different colours which represent the ice cream flavours. For each of the three scoops,
a ball is drawn to determine the flavour. If we draw with replacement, each flavour
can be potentially chosen multiple times; however, if we draw without replacement
each flavour can be chosen only once. Then, the number of possible combinations
is easy to calculate: it is 4, i.e. (chocolate, banana, and cherry); (chocolate, banana,
and lemon); (chocolate, cherry, and lemon); and (banana, cherry, and lemon). But
what if we have more choices? Or if we can draw flavours multiple times? We then
need calculation rules which help us counting the number of options.
Now, let us assume that the daughter picked the flavours (chocolate [C], banana
[B], and lemon [L]). Like many other children, she prefers to eat her most favourite
flavour (chocolate) last, and her least favourite flavour (cherry) first. Therefore, the
order in which the scoops are placed on top of the cone are important! In how
many different ways can the scoops be placed on top of the cone? This relates
to the question of the number of distinguishable permutations. The answer is 6:
(C,B,L)–(C,L,B)–(B,L,C)–(B,C,L)–(L,B,C)–(L,C,B). But what if the daughter did
pick a flavour multiple times, e.g. (chocolate, chocolate, lemon)? Since the two
chocolate scoops are non-distinguishable, there are fewer permutations: (chocolate,
chocolate, and lemon)–(chocolate, lemon, and chocolate)–(lemon, chocolate, and
chocolate).
The bottom line of this example is that the number of combinations/options is
determined by (i) whether we draw with or without replacement (i.e. allow flavours
to be chosen more than once) and (ii) whether the arrangement in a particular order
(=permutation) is of any specific interest.

Consider the urn example again. Suppose three balls of different colours, black,
grey, and white, are drawn. Now there are two options: The first option is to take into
account the order in which the balls are drawn. In such a situation, two possible sets
of balls such as (black, grey, and white) and (white, black, and grey) constitute two
different sets. Such a set is called an ordered set. In the second option, we do not
take into account the order in which the balls are drawn. In such a situation, the two
possible sets of balls such as (black, grey, and white) and (white, black, and grey)
are the same sets and constitute an unordered set of balls.
100 5 Combinatorics

Definition 5.1.1 A group of elements is said to be ordered if the order in which


these elements are drawn is of relevance. Otherwise, it is called unordered.

Examples.

• Ordered samples:

– The first three places in an Olympic 100 m race are determined by the order
in which the athletes arrive at the finishing line. If 8 athletes are competing
with each other, the number of possible results for the first three places is of
interest. In the urn language, we are taking draws without replacement (since
every athlete can only have one distinct place).
– In a raffle with two prizes, the first drawn raffle ticket gets the first prize and the
second raffle ticket gets the second prize.
– There exist various esoteric tarot card games which claim to foretell someone’s
fortune with respect to several aspects of life. The order in which the cards are
shown on the table is important for the interpretation.

• Unordered samples:

– The selected members for a national football team. The order in which the
selected names are announced is irrelevant.
– Out of 10 economists, 10 medical doctors, and 10 statisticians, an advisory
committee consisting of 4 economists, 3 medical doctors, and 2 statisticians is
elected.
– Fishing 20 fish from a lake.
– A bunch of 10 flowers made from 21 flowers of 4 different colours.

Definition 5.1.2 The factorial function n! is defined as



1 for n = 0
n! = (5.1)
1 · 2 · 3 · · · n for n > 0.

Example 5.1.2 It follows from the definition of the factorial function that
0! = 1, 1! = 1 2! = 1 · 2 = 2, 3! = 1 · 2 · 3 = 6 .

This can be calculated in R as follows:


factorial(n)
5.2 Permutations 101

5.2 Permutations

Definition 5.2.1 Consider a set of n elements. Each ordered composition of these n


elements is called a permutation.

We distinguish between two cases: If all the elements are distinguishable, then we
speak of permutation without replacement. However, if some or all of the elements
are not distinguishable, then we speak of permutation with replacement. Please note
that the meaning of “replacement” here is just a convention and does not directly
refer to the drawings, e.g. from the urn model considered in Example 5.1.1.

5.2.1 Permutations without Replacement

If all the n elements are distinguishable, then there are


n! (5.2)
different compositions of these elements.

Example 5.2.1 There were three candidate cities for hosting the 2020 Olympic
Games: Tokyo (T), Istanbul (I), and Madrid (M). Before the election, there were
3! = 6 possible outcomes, regarding the final rankings of the cities:
(M, T, I), (M, I, T), (T, M, I), (T, I, M), (I, M, T), (I, T, M).

5.2.2 Permutations with Replacement

Assume that not all n elements are distinguishable. The elements are divided into
groups, and these groups are distinguishable. Suppose, there are s groups of sizes
n 1 , n 2 , . . . , n s . The total number of different ways to arrange the n elements in s
groups is:
n!
. (5.3)
n1! n2! n3! · · · ns !

Example 5.2.2 Consider the data in Fig. 5.1e. There are two groups consisting of two
black balls (n 1 = 2) and one white ball (n 2 = 1). So there are the following three
possible combinations to arrange the balls: (black, black, and white), (black, white,
and black), and (white, black, and black). This can be determined by calculating
3! 3·2·1
= = 3.
2! 1! 2·1·1
102 5 Combinatorics

5.3 Combinations

Definition 5.3.1 The Binomial coefficient for any integers m and n with n ≥ m ≥ 0
is denoted and defined as  
n n!
= . (5.4)
m m! (n − m)!
It is read as “n choose m” and can be calculated in R using the following command:

choose(n,m)

There are several calculation rules for the binomial coefficient:


           m
n n n n n n+1−i
= 1, = n, = , = . (5.5)
0 1 m n−m m i
i=1
We now answer the question of how many different possibilities exist to draw m
out of n elements, i.e. m out of n balls from an urn. It is necessary to distinguish
between the following four cases:

(1) Combinations without replacement and without consideration of the order of


the elements.
(2) Combinations without replacement and with consideration of the order of the
elements.
(3) Combinations with replacement and without consideration of the order of the
elements.
(4) Combinations with replacement and with consideration of the order of the ele-
ments.

5.3.1 Combinations without Replacement and without


Consideration of the Order

When there is no replacement and the order of the elements is also not relevant, then
the total number of distinguishable combinations in drawing m out of n elements is
 
n
. (5.6)
m

Example 5.3.1 Suppose a company elects a new board of directors. The board con-
sists of 5 members and 15 people are eligible to be elected. How many combinations
for the board of directors exist? Since a person cannot be elected twice, we have a
5.3 Combinations 103

situation where there is no replacement. The order is also of no importance: either


one is elected or not. We can thus apply (5.6) which yields
 
15 15!
= = 3003
5 10!5!
possible combinations. This result can be obtained in R by using the command
choose(15,5).

5.3.2 Combinations without Replacement and with Consideration


of the Order

The total number of different combinations for the setting without replacement and
with consideration of the order is
 
n! n
= m! . (5.7)
(n − m)! m

Example 5.3.2 Consider a horse race with 12 horses. A possible bet is to forecast
the winner of the race, the second horse of the race, and the third horse of the race.
The total number of different combinations for the horses in the first three places is
12!
= 12 · 11 · 10 = 1320 .
(12 − 3)!
This result can be explained intuitively: for the first place, there is a choice of 12
different horses. For the second place, there is a choice of 11 different horses (12
horses minus the winner). For the third place, there is a choice of 10 different horses
(12 horses minus the first and second horses). The total number of combinations is
the product 12 · 11 · 10. This can be calculated in R as follows:

12 ∗ 11 ∗ 10

5.3.3 Combinations with Replacement and without Consideration


of the Order

The total number of different combinations with replacement and without consider-
ation of the order is
   
n+m−1 (n + m − 1)! n+m−1
= = . (5.8)
m m! (n − 1)! n−1
Note that these are the two representations which follow from the definition of the
binomial coefficient but typically only the first representation is used in textbooks.
We will motivate the second representation after Example 5.3.3.
104 5 Combinatorics

Example 5.3.3 A farmer has 2 fields and aspires to cultivate one out of 4 different
organic products per field. Then, the total number of choices he has is
   
4+2−1 5 5! 3! · 4 · 5
= = = = 10. (5.9)
2 2 2! 3! 1 · 2 · 3!
If 4 different organic products are denoted as a, b, c, and d, then the following
combinations are possible:
(a, a) (a, b) (a, c) (a, d)
(b, b) (b, c) (b, d)
(c, c) (c, d)
(d, d)
Please note that, for example, (a,b) is identical to (b,a) because the order in which
the products a and b are cultivated on the first or second field is not important in this
example.

We now try to give an intuitive explanation of formula (5.9) using Example 5.3.3.
We have n = 4 products and m = 2 fields and apply the following technical “trick”:
we sort the combinations by the product symbols (a, b, c, or d). When we switch from
one product to the next (e.g. from b to c), we make a note by adding a vertical line
|. Whenever a product is skipped, we add a line too. For example, the combination
(a, c) is denoted by a||c|, the combination (d, d) by |||dd, (c, c) by ||cc|, and (a, a)
by aa|||. Therefore, the number of characters equates to the 2 chosen symbols of the
set (a, b, c, d) plus the 3 vertical lines, in summary (4 + 2) − 1 = 5 places where
3 = n − 1 places are selected for the vertical line |. How many different line/letter
combinations exist? There are 3 out of 5 possible positions for |, i.e. 53 = 10 possible


combinations, and this is nothing but the right-hand side of (5.9).

5.3.4 Combinations with Replacement and with Consideration of


the Order

The total number of different combinations for the integers m and n with replacement
and when the order is of relevance is
nm . (5.10)

Example 5.3.4 Consider a credit card with a four-digit personal identification num-
ber (PIN) code. The total number of possible combinations for the PIN is
n m = 104 = 10, 000.
Note that every digit in the first, second, third, and fourth places (m = 4) can be
chosen out of ten digits from 0 to 9 (n = 10).
5.4 Key Points and Further Issues 105

5.4 Key Points and Further Issues

Note:

 The rules of combinatorics are as follows:

Combinations without replacement with replacement


   
n n+m−1
without order
m m
 
n
with order m! nm
m

 Combinations with and without replacement are also often called com-
binations with and without repetition.

 The permutation rules are as follows:


without replacement with replacement
n!
Permutations n!
n1! · · · ns !

5.5 Exercises

Exercise 5.1 At a party with 10 guests, every guest shakes hands with each other
guest. How many handshakes can be counted in total?

Exercise 5.2 A language teacher is concerned about the vocabularies of his students.
He thus tests 5 students in each lecture. What are the total number of possible
combinations

(a) if a student is tested only once per lecture and


(b) if a student is tested more than once per lecture?

Use R to quantify numbers which you cannot calculate manually.

Exercise 5.3 “Gobang” is a popular game in which two players set counters on a
board with 381 knots. One needs to place 5 consecutive counters in a row to win
the game. There are also rules on how to remove counters from the other player.
Consider a match where 64 counters have already been placed on the board. How
many possible combinations exist to place 64 counters on the board?
106 5 Combinatorics

Exercise 5.4 A shop offers a special tray of beer: “Munich’s favourites”. Customers
are allowed to fill the tray, which holds 20 bottles, with any combination of Munich’s
6 most popular beers (from 6 different breweries).

(a) What are the number of possible combinations to fill the tray?
(b) A customer insists of having at least one beer from each brewery in his tray.
How many options does he have to fill the tray?

Exercise 5.5 The FIFA World Cup 2018 in Russia consists of 32 teams. How many
combinations for the top 3 teams exist when

(a) taking into account the order of these top 3 teams and
(b) without taking into account the order of these top 3 teams?

Exercise 5.6 An online book store assigns membership codes to each member. For
administrative reasons, these codes consist of four letters between “A” and “L”.
A special discount period increased the total number of members from 18, 200 to
20, 500. Are there enough combinations of codes left to be assigned for the new
membership codes?

Exercise 5.7 In the old scoring system of ice skating (valid until 2004), each member
of a jury of 9 people judged the performance of the skaters on a scale between 0 and
6. It was a decimal scale and thus scores such as 5.1 and 5.2 were possible. Calculate
the number of possible score combinations from the jury.

Exercise 5.8 It is possible in Pascal’s triangle (Fig. 5.2, left) to view each entry as
the sum of the two entries directly above it. For example, the 3 on the fourth line

0

1 0

1 1

1 1 0 1

2 2 2

1 2 1 0 1 2

3 3 3 3

1 3 3 1 0 1 2 3

4 4 4 4 4

1 4 6 4 1 0 1 2 3 4

5 5 5 5 5 5

1 5 10 10 5 1 0 1 2 3 4 5

Fig. 5.2 Excerpt from Pascal’s triangle (left) and its representation by means of binomial coeffi-
cients (right)
5.5 Exercises 107

from the top is the sum of the 1 and 2 above the 3. Another   interpretation refers
to a geometric representation of the binomial coefficient, nk (Fig. 5.2, right) with
k = 0, 1, 2, . . . being the column index and n = 0, 1, 2, . . . being the row index.

(a) Show that each entry in the bold third diagonal line can be represented via n2 .
 

(b) Now show that the sum of two consecutive entries in the bold third diagonal line
always corresponds to quadratic numbers.

→ Solutions to all exercises in this chapter can be found on p. 358

You might also like