se_counting
se_counting
Permutations and combinations are the two most common and most elementary counting
models, which readers should be familiar with.
Prn = n × (n − 1) ×" × (n − r + 1)
Pnn = n × (n − 1) × " × 2 × 1 = n !
Combination also concerns the number of ways of choosing r objects from a collection of n
objects, but in this case the order by which the r objects are chosen does not matter. Consequently,
the formula for computing combinations is given by
Prn n × (n − 1) ×" × (n − r + 1) n!
Crn = = =
r! r! r !(n − r )!
In addition to the permutation and combination models, we frequently come across other
counting models. Some counting problems can be solved by applying the permutation and
combination models together with the additive and multiplicative rules. But if we adopt other
counting models, the calculation can be simplified. The principles behind these counting models are
fairly simple, so it is beneficial for us to learn and grasp them. Some common counting models are
given below.
Page 1 of 5
Theorem. (Combination with repetition)
The number of ways of choosing r objects (with repetition allowed) from a collection of n types of
objects (each type has at least r copies) is given by
H rn = Crn + r −1 .
We first count the number of ways to place r identical balls into n different boxes, where
empty boxes are allowed. Suppose the boxes have x1 , x2 , …, xn balls respectively, where
x1 + x2 + " + xn = r . This can be represented as
Ο
" Ο + Ο
" Ο + " + Ο
" Ο
x1 balls x2 balls xn balls
This may be regarded as arranging r ‘O’s and n − 1 ‘+’s in a row. Each arrangement
corresponds to a way of placing the balls, and there are Crn + r −1 such arrangements (this
corresponds to the combination model as we are choosing r among n + r − 1 spaces to place the
‘O’s).
With this ‘placing ball’ problem, we see that the equation x1 + x2 + " + xn = r has Crn + r −1
non-negative integer solutions. This is itself a common counting model.
Next we consider combinations with repetitions. Suppose there are n different types of objects,
a1 , a2 , …, an , where each type has at least r copies, and we are to choose r of them (With
repetition allowed). Suppose we have chosen x1 copies of object a1 , x2 copies of object a2 , and
so on, and xn copies of object an . Consequently we have x1 + x2 + " + xn = r , and each
non-negative integer solution to the equation corresponds to a choice. So there are altogether
Crn + r −1 ways of choosing the objects.
Q.E.D.
In addition to the above counting models, there is yet another common model. This is the
model for permutations of objects, some of which may be identical. To make the presentation clear
we first consider the simplest situation. Suppose there are m white balls and n black balls, to be
arranged in a row. How many different arrangements are there? This appears to be a problem
concerning permutations, but actually it concerns combinations. This is because we are actually
choosing m places among m + n places to put the white balls (or choosing n places to put the black
balls). So the number of ways is Cmm + n (or Cnm + n ).
Page 2 of 5
Now we try to generalize our conclusion. Suppose we have balls of k different colours, the
number of balls of each colour being n1 , n2 , …, nk respectively, and the total number of balls is
m. How many different ways are there to arrange these balls? We can think in this way: we first
choose n1 positions among the m positions to place the balls of the first colour. Then we choose
n2 positions among the remaining m − n1 positions to place the balls of the second colour, and so
on. Thus the total number of arrangements is
m !
Cnm1 × Cnm2 − n1 ×" × Cnnkk = .
n1 !n2 !" nk !
After learning these counting models, we need to learn to apply them to practical problems.
First of all we must determine to which counting model the problem belongs, and then apply the
related formulae. In dealing with some more complicated problems, we may even need to apply
more than one counting models simultaneously.
Example 1.
How many unlike terms are there in the expansion of (a + b + c)7 ?
Solution.
Each unlike term corresponds to a choice of 7 objects from a collection of 3 types of objects
(combination with repetition model). So the number of unlike terms is equal to H 73 = C79 = C29 = 36 .
Example 2.
How many positive integer solutions are there to the equation x1 + x2 + " + x10 = 100 ?
Solution.
Imagine that 100 identical balls are listed in a row. There are 99 spaces between adjacent balls. We
choose among these 9 spaces to put the symbol ‘+’, and each choice corresponds to a solution to the
equation. For instance, each solution of the equation can be represented as
Ο
" Ο + Ο
" Ο + " + Ο
" Ο
x1 balls x2 balls x10 balls
Page 3 of 5
Alternative Solution.
Let xi = yi + 1 (i = 1, 2, …, 10). Consequently each positive integer solution to the equation
x1 + x2 + " + x10 = 100 corresponds to a non-negative integer solution to y1 + y2 + " + y10 = 90
10
(the number of which has already been counted). Thus the answer is H 90 = C9099 = C999 .
Example 3.
Four different dice are thrown. In how many different situations will a sum not exceeding 9 occur?
Solution.
Let x, y, z, u be the four numbers on the dice. Then each situation in which the sum of the numbers
on the four dice does not exceed 9 corresponds to a positive integer solution to the inequality
x + y + z + u ≤ 9 , and to a non-negative integer solution to the inequality x′ + y′ + z ′ + u′ ≤ 5 .
Introducing a non-negative variable t, the inequality can be transformed to the equation
x′ + y′ + z′ + u′ + t = 5 , which has H 55 = C59 = C 49 = 126 non-negative integer solutions. This is also
the answer to the original problem.
Example 4.
There are n different books to be given to r people. They are to get k1 , k2 , …, kr books
respectively, where k1 + k2 + " + kr = n . In how many different ways can this be done?
Solution.
This precisely is the model for permutations with some identical objects. So the number of ways is
n !
equal to .
k1 !k2 !" kr !
Example 5.
Teams A and B each send 7 members to compete in a chess competition. Member 1 of both teams
first compete. The loser is eliminated and the winner proceeds to compete with member 2 of the
other team. This process is continued until all members of one team are eliminated. In how many
different ways can the competition proceed?
Solution.
Consider the case where 7 A’s and 7 B’s are arranged in a row. Each letter represents a member of
the respective teams in the preassigned order. Each arrangement of letters thus corresponds to a way
Page 4 of 5
in which the competition proceeds. For example, the permutation ABBABBBAAAABAB corresponds
to the situation in which member 1 of Team A is defeated by member 1 of Team B, and then
member 2 Team A win two consecutive matches, and so on.
From this, we see that the number of ways is equal to C714 .
Page 5 of 5