0% found this document useful (0 votes)
51 views10 pages

6.S095 Lecture 1 Notes: Basic Counting

This document provides a summary of lecture notes on counting techniques in discrete mathematics. It introduces basic counting principles like the addition and multiplication principles. It discusses permutations, combinations, and binomial coefficients. It shows that there are n! permutations of n objects and n choose k combinations. The document provides examples applying these counting techniques to problems involving arrangements of objects and solutions to equations.

Uploaded by

Sebastian Jeon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
51 views10 pages

6.S095 Lecture 1 Notes: Basic Counting

This document provides a summary of lecture notes on counting techniques in discrete mathematics. It introduces basic counting principles like the addition and multiplication principles. It discusses permutations, combinations, and binomial coefficients. It shows that there are n! permutations of n objects and n choose k combinations. The document provides examples applying these counting techniques to problems involving arrangements of objects and solutions to equations.

Uploaded by

Sebastian Jeon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

6.

S095 Lecture 1 Notes

§1 Counting Techniques
This section introduces a variety of topics in discrete math with applications in probability.
We will discuss basic counting principles, permutations, combinations, and combinatorial
identities, and finally recurrences.

§1.1 Basic Counting


A set is a collection of distinct objects, which are called the elements of the set. In
this lecture, sets will often be used to count combinatorial occurrences that we wish to
study. To this end, we define the cardinality of a set S, denoted as |S|, as the number of
elements of S.

Given sets A, B, define their union A ∪ B to be the set containing elements in A


and elements in B. Also define their intersection A ∩ B to be the set containing ele-
ments in both A and B. Finally, we say A and B are disjoint if their intersection is
empty.

Lemma 1.1
(Addition principle) For n disjoint sets S1 , . . . , Sn , the cardinality of their union is:

|S1 ∪ . . . ∪ Sn | = |S1 | + |S2 | + · · · + |Sn |.

Remark 1.2. The addition principle states that, if it is possible to split a counting
problem into disjoint cases, one can simply sum the counts from all of the cases.
Exercise 1.3. Convince yourself that it is necessary for the Si to be disjoint.

Example 1.4
Find the number of solutions in positive integers (x, y) to

x2 + y 2 < 25.

Solution. Let A be the set of all solutions and let Ai be the set of solutions where x = i.
By definition, the Ai must be disjoint. Furthermore, since x ≥ 5 =⇒ 25 ≤ x2 + y 2 , it
follows that A = A1 ∪ A2 ∪ A3 ∪ A4 . Then
A1 = {(1, 1), (1, 2), (1, 3), (1, 4)}
A2 = {(2, 1), (2, 2), (2, 3), (2, 4)}
A3 = {(3, 1), (3, 2), (3, 3)}
A4 = {(4, 1), (4, 2)},

1
6.S095 Lecture 1 Notes

so by the addition principle,


|A| = |A1 | + |A2 | + |A3 | + |A4 | = 4 + 4 + 3 + 2 = 13.

Definition 1.5. (Cartesian product) Let S1 , . . . , Sn be finite sets. Their Cartesian


product is defined as
S1 × · · · × Sn := {(s1 , . . . , sn ) | s1 ∈ S1 , . . . , sn ∈ Sn }
For example, R × R contains all real pairs (x, y), which is why the real plane is sometimes
denoted as R2 . Another example is {0, 1} × R which corresponds to two copies of the
real line.

We will now see how the multiplication principle can be used to find the cardinality of
sets’ Cartesian product.

Lemma 1.6
(Multiplication principle) Let Si for i ∈ [n] be finite sets. Then the size of their
Cartesian product can be expressed as

|S1 × · · · × Sn | = |S1 | × · · · × |Sn |

Remark 1.7. Essentially, the multiplication principle states that to count a process
with n independent choices, it suffices to count the number of cases for each choice and
multiply.
Definition 1.8. Let [n] denote the set {1, 2, . . . , n}.

Example 1.9
Suppose we have a collection of objects where each object is one of n types. Further
suppose there are ki objects of each type for i ∈ [n]. We wish to form families of
objects, where each family has exactly one object of every type. How many distinct
families can we create?

Solution. By the multiplication principle, there are ni=1 ki possible objects. Note that
Q
we disregard families with different orderings of the same n objects.

The following definition allows for a new way of counting. Suppose we wish to find |A|
for a complicated set A. If we can match elements of A one-on-one with elements of
another set B, it would suffice to count B. As shown below, a bijection can be used to
form this one-on-one matching between sets.
Definition 1.10 (Bijection). A function f : A → B between finite sets A and B is called
a bijection if the following statements hold:

1. (injectivity) f (a) = f (b) implies a = b


2. (surjectivity) for all b ∈ B, there is a ∈ A such that f (a) = b

These requirements guarantee that every element a ∈ A gets mapped to exactly one
element b ∈ B, which implies that |A| = |B|.

2
6.S095 Lecture 1 Notes

Example 1.11
Define the power set of a set A, denoted as P(A), to be the set containing all subsets
of A. What is P([n])?

Solution. Let B denote the set containing all binary strings of length n. By the multipli-
cation principle, |B| = 2n , as there are two choices for each of the n bits in the string.

Now let us form a bijection between P([n]) and B. Given a subset A ∈ P([n]), let
f map A to the string whose ith digit is 1 if i ∈ A and 0 otherwise for i ∈ [n]. This f
indeed defines a function from P(A) to B.

We now check that f is bijective. If f (A) = f (B), then i ∈ A ⇐⇒ i ∈ B, which


means A = B and that f is injective. For a given string b ∈ B, take the set of indices
I that are 1 in b. Then f (I) = b, so f is surjective. This establishes the bijection and
shows that |P([n])| = |B| = 2n .

§1.2 Permutations and Combinations


Let A be a set of n distinct objects c1 , . . . , cn . Informally, a permutation of A is a linear
arrangement of the objects in A where each object is used exactly once. If the new
linear arrangement is cp1 , . . . , cpn , the permutation can be summarized by a function
p : [n] → [n] satisfying p(i) = pi . As every ci must be represented in the list exactly once,
p must be a bijection. Thus, the mathematical definition of permutations is as follows:
Definition 1.12. (Permutations) A permutation is a bijection from [n] to itself.

Lemma 1.13
There are n! permutations on [n].

Proof. Consider the process of constructing p one element of a time. There are n choices
for p(1). Regardless of the choice for p(1), there are n − 1 choices for p(2), since p(1) is
no longer a valid option. Repeating this process and using the multiplication principle
for independent choices proves the lemma.

Lemma 1.14
Given n distinct objects and k with k ≤ n, the number of linear orderings of length
n!
k in which no object is used more than once is (n−k)! .

Proof. As above, there are n choices for the first object, n − 1 for the second, up to
n − k + 1 for the k th . Thus there are
n!
n(n − 1) . . . (n − k + 1) =
(n − k)!
orderings.
n!
Remark 1.15. Sometimes, (n)k or Pn,k will be used to denote (n−k)! .

3
6.S095 Lecture 1 Notes

Example 1.16
For an even positive integer n, count the number of permutations of [n] such that
the sum of every two consecutive elements in the permutation is odd.

Solution. A permutation on n elements πn will have this property if and only if the
elements are alternating between even and odd. There are two  cases depending on
n
whether the first element of π is odd. In either case, there are 2 ! ways to arrange the
n

even elements, and independently 2 ! ways to arrange the odd elements, leading to
n n

2 ! 2 ! permutations for each case by the multiplication principle. By the addition
principle, there are 2 n2 ! n2 ! total permutations.


Now we will discuss combinations, where we remove the linear ordering altogether and
consider only the constituents of the collection.

Definition 1.17. (Combinations) The number of k-element subsets of [n] is denoted as


n
as “n choose k”. nk is sometimes referred to as a binomial coefficient.

k and read

Lemma 1.18
For all nonnegative integers k ≤ n,
 
n (n)k n!
= = .
k k! k!(n − k)!

Proof. To choose an unordered k-element subset, first pick one of the (n)k k-element
linear orderings of [n]. For any such ordering, there are k! orderings with the same
constituents in different order, so each subset corresponds to k! linear orderings. Thus
there are (n)k n!
k! = k!(n−k)! orderings.

Example 1.19
Let n be a positive integer. Determine the number of solutions to x + y + z = n
where x, y, z are nonnegative integers.

Solution. Consider the following analogy: let n indistinguishable balls be lined up. Then
we can allocate some number of balls on the left to x, some number of balls on the right
to z, and the rest to y. Pictorially, we can imagine placing two dividers between the
balls: Conversely, any linear arrangement of the n balls and 2 dividers corresponds to a

Figure 1: Depiction for the solution (3, 0, 6) for n = 9.

distinct solution (x, y, z). Thus the number of solutions is just the number of ways to
choose the positions of the 2 dividers, which is n+2

2 .

4
6.S095 Lecture 1 Notes

Lemma 1.20
(Multinomial coefficients) Let A be a multiset of n objects and k types, where there
are ai identical objects of each type for i ∈ [k], and suppose we wish to count the
number of distinct linear orderings of A. Clearly n! will overcount the number of
permutations of A since a new linear order cannot be generated simply by exchanging
two identical objects. Instead, we must divide by the number of ways to permute
each type of object, and the number of permutations of these objects is
 
n! def n
= .
a1 ! · a2 ! · . . . · ak ! a1 , . . . , a n

This is said to be a multinomial coefficient.

Remark 1.21. Stirling’s approximation can be used as an approximation of n!:


√  n n
n! ∼ 2πn
e
where the convergence implied by n! ∼ f (n) means that limn→∞ f n! (n) = 1. Stirling’s
approximation will later be used to measure the asymptotic growth of binomial coefficients.

§1.3 Simple combinatorial identities


In this section, we will prove some simple relationships between binomial coefficients.

Lemma 1.22
For positive integers n,
     
n n n
+ + ··· + = 2n .
0 1 n

Proof. By Example 1.11, the RHS counts the number of subsets of [n], and the LHS
counts the same by casework on the cardinality of the subset.

Theorem 1.23 (Pascal’s identity)


For nonnegative integers n, k,
     
n+1 n n
= + .
k+1 k k+1

Proof. Consider  the process of choosing a subset of size k + 1 of [n + 1]. On one hand,
n+1
there are k+1 such subsets. On the other hand, we can do casework as follows: if n + 1
n

is to be included in the subset, k more elements must be chosen from [n] in k ways.
n

Otherwise, all k + 1 elements must be chosen from [n] in k+1 ways. This establishes
the identity.

It is possible that k > m, in which case the expression mi is unclear.



Remark 1.24.
We define nk = 0 for k < 0 or k > n, since the number of subsets of [n] with size k is


5
6.S095 Lecture 1 Notes

zero in these cases. With this extension, Pascal’s identity (and all subsequent identities)
hold as written.

Example 1.25
For positive integers n,
⌊n/2⌋  
X n
= 2n−1 .
2k
k=0

Solution. The sum counts the number of subsets of [n] with even size. Notice that every
subset A of [n] with n ∈ A can be paired with A \ {n}. Every subset of [n] belongs to
exactly one of these pairs. But in each pair of subsets, exactly one has even size, so the
number of even size subsets is just the number of pairs which is 2n−1 .

Lemma 1.26
(Vandermonde’s Identity) For any m, n, k ∈ N0 , the following identity holds:
  Xk   
m+n m n
= .
k i k−i
i=0

Proof. We proceed with a counting argument. In an urn with m numbered red balls and
n numbered blue balls, the LHS counts the number of unordered subsets of size k from
all m + n balls. Another way to count is by casework on the the number of red balls,
 k balls total, we draw i red balls and n − i blue balls, which can
denoted as i. To draw
be done in mi k−i n
ways. Summing over all cases i produces the RHS.

Exercise 1.27. Prove Vandermonde’s identity using the binomial theorem.

§1.4 Binomial and Multinomial Theorems


Definition 1.28. (Binomial Theorem) Expanding the expression (x + y)n is a pretty
simple task for n = 2 or n = 3. The binomial theorem provides a way to generalize this
for arbitrary values of n:

Theorem 1.29 (Binomial theorem)


For any n ∈ N0 ,
n  
n
X n
(x + y) = xk y n−k
k
k=1

Proof. In the expansion of (x + y)n as (x + y)(x + y) . . . (x + y), each term will be chosen
by choosing either an x or a y from each x + y. Thus, (x + y)n will be a sum of terms of
the form xk y n−k . For a fixed k, it suffices to choose the k factors that yield an x, which
can be done in nk ways. This proves that the coefficient of the xk y n−k term will be nk ,


which is why nk earns the name of binomial coefficient.

6
6.S095 Lecture 1 Notes

Theorem 1.30 (Multinomial theorem)


Analogously, the multinomial theorem provides a way to handle (x1 + . . . + xk )n for
an arbitrary n. For any n ∈ N0 ,
 
X n
(x1 + . . . + xk )n = xa11 · · · xakk
a +...+a =n
a1 , . . . , a k
1 k

where the summation ranges over all solutions ai ≥ 0 to a1 + . . . + ak = n.

Proof. This proof is of a similar flavor to the binomial theorem, and is left as an
exercise.

§2 Principle of Inclusion-Exclusion (PIE)


Suppose we are given finite sets A1 , . . . , An that are not necessarily disjoint, and we wish
to determine the size of their union |A1 ∪ . . . ∪ An |.

For the case n = 2, it well-known that |A1 ∪ A2 | = |A1 | + |A2 | − |A1 ∩ A2 |. Indeed, we can
determine |A1 ∪ A2 | by counting the elements in A1 and A2 separately, then removing
the elements in A1 ∩ A2 that were counted twice in A1 and A2 . We now generalize this
principle to arbitrary n:

Lemma 2.1 (Principle of Inclusion-Exclusion)


Let A1 , A2 , . . . , An be finite sets. Then:
n
X X
|A1 ∪ A2 ∪ . . . ∪ An | = (−1)j−1 |Ai1 ∩ Ai2 ∩ . . . ∩ Aij |
j=1 i1 ,i2 ,...,ij

where i1 , i2 , . . . , ij ranges over all j-element subsets of [n].

Although this equation may seem complex, the intuition is fairly straightforward: we
seek to ensure that each element in |A1 ∪ A2 ∪ . . . ∪ An | is counted exactly once, which
we accomplish by removing over-counts and adding back under-counts.

Proof. The proof of the Principle of Inclusion-Exclusion is left as an exercise on Problem


Set 1.

Example 2.2
A permutation on n elements πn is called a derangement if π(i) ̸= i for any i ∈ [n].
If Sn is the set containing all n-permutations, and D(n) denotes the number of
derangements in Sn , prove that
n
X n!
D(n) = (−1)k .
k!
k=0

7
6.S095 Lecture 1 Notes

Solution. Define a fixed point of a permutation p to be any k with p(k) = k. Then an


derangement is a permutation with no fixed points. We will instead count permutations
with at least one fixed point as follows: let Ai be the set of permutations that fix i; then

D(n) = n! − |A1 ∪ A2 · · · ∪ An |.

In the formula for PIE, we must calculate |Ai1 ∩ Ai2 ∩ . . . Aik |, or the number of permuta-
tions that fix i1 , i2 , . . . , ik . But for any such permutation, it suffice to permute the n − k
remaining indices among themselves, so there are (n − k)! such permutations. Then since
there are nk such intersections represented in the sum,


n
X X
|A1 ∪ A2 ∪ . . . An | = (−1)k−1 (n − k)!
k=1 i1 ,i2 ,...,ik
n  
k−1 n
X
= (−1) (n − k)!
k
k=1
n
X n!
= (−1)k−1 ,
k!
k=1

so
n n
n! X n! X n!
D(n) = − (−1)k−1 = (−1)k ,
0! k! k!
k=1 k=0

as claimed.

§3 Recurrences and generating functions


Recurrence relations are common in combinatorial problems involving counting. While
useful on their own, they are even more powerful when solved in terms of a closed form
solution. This section introduces several common recurrence relations, and subsequently
shows how generating functions can be used to find a closed form solution.

§3.1 Recurrences
Definition 3.1. A recurrence is a sequence {an }n≥0 such that each element aj can be
computed from the previous terms in the sequence a0 , a1 , . . . , aj−1 .

Example 3.2
The Fibonacci sequence Fn = Fn−1 + Fn−2 with F0 = 0 and F1 = 1 has a plethora
of applications in probability and combinatorics. It also describes several biological
phenomena, such as the flower of an artichoke, an uncurling fern, and the arrangement
of a pine cone’s bracts.

One way to find the closed form for a recursive sequence is by inferring the closed form
and proving by induction. More concretely, if an is a recursive sequence and f (n) is a
closed form of an , one could first verify a0 = f (0) (the base case), and then prove that
a0 = f (0), a1 = f (1), . . . , an = f (n) implies an+1 = f (n + 1) for all n (the inductive step).
This would prove that an = f (n) for all n.

8
6.S095 Lecture 1 Notes

Example 3.3
Let an = an−1 + 2n+1 and let a1 = 3. Prove that an = 2n+1 − 1 for all n ≥ 1.

Proof. For the base case of n = 1, we can check that a1 = 21+1 − 1 = 3.

For the inductive step, assume that an = 2n+1 − 1 holds for 1 ≤ n ≤ k, in partic-
ular, that ak = 2k+1 − 1. We must prove validity for k + 1. By the recurrence relation
and inductive hypothesis,

ak+1 = ak + 2k+1 = (2k+1 − 1) + 2k+1 = 2(k+1)+1 − 1,

which is exactly the proposition for n = k + 1. This completes the induction.

§3.2 Generating functions


This section will introduce generating functions, which are important objects in combina-
torics and probability.

Suppose that a recursive sequence an is given. As n becomes large, using the recursion
to compute an from its previous values (which must also be calculated) can become
intractable. To avoid this, one can instead reason about the generating function of the
sequence, which encodes all of the terms into one object, and in some cases, leads to a
closed form.
Definition 3.4. The generating function A(x) of a sequence {an }n≥0 is the formal power
series
X∞
A(x) = an xn .
n=0
We will not be concerned with the convergence of this series in this class.

Example 3.5
Find an explicit formula for the Fibonacci sequence {fn } defined as f0 = 0, f1 = 1,
and fn+1 = fn + fn−1 for n ≥ 2.

Solution. Let F (x) = n≥0 fn xn be the generating function of the Fibonacci sequence.
P

By multiplying the recurrence formula by xn+1 , one gets fn+1 xn+1 = fn xn+1 + fn−1 xn+1 .
Summing over all n ≥ 1 yields

X ∞
X ∞
X
fn+1 xn+1 = fn xn+1 + fn−1 xn+1 .
n=1 n=1 n=1
P∞
The LHS can be written as n=0 fn xn − f0 x0 − f1 x1 = F (x) − x. Similarly expressing
the RHS in terms of F (x) yields
−x
F (x) − x = xF (x) + x2 F (x) =⇒ F (x) = .
+x−1 x2
To simplify this, we use the method of partial fractional decomposition. Denoting the
roots of x2 + x − 1 as α and β, we wish to find constants A, B such that
 
−x A B
F (x) = 2 =− + .
x +x−1 x−α x−β

9
6.S095 Lecture 1 Notes

α β
With standard methods, we find that A = α−β and B = β−α . This means that

x −1
 
A B 1  x −1 1
F (x) = + = 1− + 1−
α−x β−x α−β α β−α β
1 P∞ n
Since 1−x = n=0 x ,

∞ ∞ ∞   ∞ 
1 X x n X α−n β −n

X
n 1 X  x n
fn x = F (x) = + = + xn ,
α−β α β−α β α−β β−α
n=0 n=0 n=0 n=0

implying that
α−n − β −n
fn = .
α−β
√ √
Since {α, β} = { −1+2 5 −1− 5
, 2 }, it follows that
√ !n √ !n
1 1+ 5 1 1− 5
fn = √ −√ .
5 2 5 2

10

You might also like