Lecture 1
Lecture 1
1. Basic Combinatorics
Combinatorics is a very old subject and can be traced back to the 16th century BC to
the ancient Egyptians. The term combinatorics is essentially just a fancy way of saying
counting. There are many applications of combinatorics, such as to engineering, computer
science, cryptography, biology, etc, some of which we will see in this course.
1.1. Permutations.
The rule of sum: If there are m choices for one action and n choices for another action,
and the two actions cannot be done simultaneously, then there are m + n ways to choose one
of these actions.
The rule of product: If a procedure can be broken down into k stages and if there are ni
possible outcomes for stage i, then the total procedure can be carried out in the designated
order in n1 · n2 · · · nk−1 · nk ways.
Motivating question: In how many ways can one choose k objects from a collection of n
different objects?
Example 1.1. Using only the letters A, B, C, D and E, how many strings of length 3 can
you produce,
(a) if repetition is allowed?
(a) without repetition?
Solution: (a) 5 · 5 · 5 = 125. (b) 5 · 4 · 3 = 60.
In general, if we had n letters, the number of strings of length k would be nk , if repetition
is allowed, and the number of strings of length k without repetition is
n!
n(n − 1)(n − 2) · · · (n − k + 1) = .
(n − k)!
Definition 1.2. Let Ω = {a1 , . . . , an } be a given set with n elements (note that if i 6= j then
ai 6= aj ). A permutation of Ω is an ordered set containing exactly the same elements as Ω.
For 0 ≤ k ≤ n, a k-permutation (ai1 , . . . , aik ) of Ω is a permutation containing k elements
from Ω.
Example 1.3. The ordered subsets (1, 6, 4), (1, 2, 4) and (1, 4, 6) are three different 3-
permutations of the set Ω = {1, 2, 4, 6, 8, 9}.
Theorem 1.4. Let n, k ∈ Z≥0 be such that 0 ≤ k ≤ n and let Ω = {a1 , . . . , an } be a set of n
n!
elements. Then the number of all k-permutations of Ω is (n−k)! .
Proof. To determine a k-permutation of Ω, we must choose k elements from Ω in a given
order.
The first element can be chosen in n ways.
1
2 LECTURE 1
n!
Proof. According to Theorem 1.4, the number of k-permutations is P (n, k) = (n−k)! . Each
k-combination is associated to k! different k-permutations. Hence
P (n, k) n!
C(n, k) = = ,
k! (n − k)! k!
is the number of k-combinations.
1.3. Binomial Theorem.
Theorem 1.14 (Binomial Theorem). For variables a, b and any positive integer n,
n
n
X n k n−k
(a + b) = a b .
k
k=0
Proof. Now
(a + b)n = (a + b)(a + b) · · · (a + b).
The coefficient of ak equals the number of ways to choose k factors from which we use a.
n
This is k , and the term involved is
n k n−k
a b
k
where we note that we must choose b from the remaining n − k factors.
Remark 1.15. Observe that nk = n−k n
.
The above binomial theorem has a more general form:
Theorem 1.16 (Multinomial Theorem). For variables a, b, c and any positive integer n,
n
X n
(a + b + c) = ak1 bk2 ck3 .
k1 , k2 , k3
k1 +k2 +k3 =n
Example 1.17. In how many ways can we distribute ten (identical) apples among 4 children
Carl, Theo, Sarah and Olga?
Solution: Each distribution corresponds to a string of ten x’s and three |’s, for example
xx| xxx| xxxx| x
Carl Theo Sarah Olga
which is equivalent to saying: 2 apples for Carl, 3 apples for Theo, 4 apples for Sarah and 1
apple for Olga. Another example is | | | x x x x x x x x x x, where Olga gets all the apples.
So the number of distributions of apples equals the number of words in ten x’s and three
|’s, which equals
13! 13
= .
10! 3! 3
[Compare Examples 1.7 and 1.8.]
More generally, the number of ways to distribute k identical objects among n different
containers is
k+n−1 n+k−1
= ;
n−1 k
compare Remark 1.15. In the above example, the apples are the identical objects, and the
children are the different containers.
4 LECTURE 1
Example 1.18. How many integer solutions (x1 , . . . , x6 ) does the following problem have?
x1 + x2 + · · · + x6 = 24,
0 ≤ x , x , x ,
1 2 3
(∗)
1 ≤ x 4 , x5 ,
2 ≤ x6 .
Solution. The problem (∗) has exactly as many solutions as the following:
x1 + x2 + · · · + x6 = 24 + (−1) + (−1) + (−2) = 20,
0 ≤ x1 , x2 , . . . , x6 .
The number is the same as the number of ways of distributing 20 apples amongst 6 children:
20 + 6 − 1 25
= = 53130.
6−1 5
1.4. The pigeonhole principle. Let m, n ∈ N be such that m > n. If m objects are placed
in n containers, then there exists at least one container containing at least two objects.
Example 1.19. Let ACE be an equivalent triangle in the plane such that |AC| = 1.
C
B D
A F E
Let P1 , P2 , . . . , P5 be five points inside ACE. Then, by the pigeonhole principle, there exists
i, j such that |Pi Pj | < 1/2.
Example 1.20. Let p be a prime number such that p 6= 2, 5. Show that p divides at least
one of the numbers 1, 11, 111, 1111, . . . .
Solution. Write ak = 1. k. .1. Let rk be the remainder when we divide ak with p, so
r1 , r2 , . . . , rk , . . . ∈ {0, 1, . . . , p − 1}.
Thus, by the pigeonhole principle, there exist ri = rj with i 6= j. Therefore p divides
. . .1 · 10j , and hence p divides ai−j , since p 6= 2, 5.
ai − aj = 1i−j