Discrete Mathematics (H) Lecture 13 Notes
Counting
Counting is the process of determining the number of some objects with certain properties.
The Sum Rule and The Product Rule
Example
- the number of steps in a computer program
- the number of passwords between 6~10 characters
- the number of telephone numbers with 8 digits
We usually simplify the solution of nontrivial counting problems by decomposing them into smaller ones:
Product Rule
If a count of elements can be broken down into a sequence of
dependent counts where the first count yields
Example
- how many different bit strings of length 7 are there?
- how many different functinos are there from a set with
elements to a set with elements? - how many one-to-one functions are there from a set with
elements to a set with elements?
Solution 1. Using the product rule, since each bit in the
bit string has two possibilities, we have
Solution 2. Each of the
Sum Rule
If a count of elements can be broken down into a set of
independent counts where the first count yields
Example
You need to travel from city A to B. You may either fly, take a train, or a bus. There are 12 different flights, 5 different trains and 10 buses. How many options do you have to get from A to B?
Solution. We may use the sum rule, so
More complex counting typically requires a combination of the sum and product rules.
Tree Diagrams
A tree is a structure that consists of a root, branches and leaves. We can use trees to represent counting problems and record the choices we made for alternatives.
Example
What is the number of bit strings of length 4 that do not have two consecutive 1’s?
Solution. 
Pigeonhole Principle
Assume that there are a set of objects and a set of bins to store them. The pigeonhole principle states that if there are more objects than bins then there is at least one bin with more than one object. More formally:
Pigeonhole Principle
If there are
Generalized Pigeonhole Principle
If
Bijections and Permutations
Definition: Permutation
A bijection from a set onto itself is called a permutation.
The following loop is a part of program to determine the number of
triangles formed by
1 | trianglecount = 0 |
Solution. Since there is a triple for loop, and
- the second loop begins with
and increases up to . - the third loop begins with
and increases up to .
Thus each triple
- one-to-one: if
, then . - onto: if
is a 3-element subset then it can be written as where , so .
Bijection Principle
Two sets have the same size iff there is a one-to-one function from one set onto the other.
Inclusion-Exclusion Principle
Inclusion-Exclusion Principle
Suppose
Proof by induction.
- Base case:
- Inductive step. The inductive hypothesis is
Permutations and Combinations
Definition:
The number of lists of
Definition:
The number of sets of
Some properties of binomial coefficients:
is the number of -element subsets of an -element set. since there are only one set of size . since there are only one set of size . obvious from equation.
To prove the last property, we use the sum rule and the power sets:
Let
Binomial Coefficients
The Pascal’s Triangle (or 杨辉三角):
From the
Pascal’s triangle, we can observe the identity:
Pascal Identity
Each (non-
Combinatorial Proof.
represents the number of -subsets of an -element set. represents the number of -subsets of an -element set.
Observe that the set
: set of -element subsets that contain . : set of -element subsets that don’t contain .
Where
The Binomial Theorem
Binomial Theorem
For any integer
Proof by induction.
- Base case:
- Inductive step: Assume that some integers
, the binomial theorem holds, then
Trinomial Coefficients
Question
Suppose we have
Solution. There are
When
The Birthday Paradox
Question
Suppose that 25 students are in a room. What is the probability that at least two of them share a birthday?
Solution. Let
For the probability:
Euclidean Algorithm
The number of divisions requires to find
Proof idea. See the key steps in the Euclidean algorithm:
- Case 1.
: then - Case 2.
: then
- Title: Discrete Mathematics (H) Lecture 13 Notes
- Author: Zhige Chen
- Created at : 2025-11-24 21:42:08
- Updated at : 2025-12-08 23:56:14
- Link: https://nofe1248.github.io/2025/11/24/discrete-math-lec-13/
- License: This work is licensed under CC BY-NC-SA 4.0.