Professional Documents
Culture Documents
Combinatorics
Combinatorics
Combinatorics
Ahsan Azhar
Counting
How many triangles are there?
Counting
How many triangles are there?
Counting
How many triangles are there?
Counting
How many triangles are there?
Basic Principles of Counting
List all possible dinners consisting of one main course and one beverage.
HT, HM, HC, HL, CT, CM, CC,CL, FT, FM, FC, FL
Solution:
• The first person has a choice of 5 seats and can sit in any one of those 5
seats. So there are 5 ways of occupying the first seat.
• The second person has a choice of 4 seats.
• Similarly, the third person has a choice of 3 seats.
• Hence, the required number of ways 5x4x3=60.
Counting: Product Rule
EXAMPLE 2 How many strings of length 4 can be formed using the letters ABCDE if
repetitions are not allowed?
EXAMPLE4 How many strings of part 1 do not begin with the letter B?
EXAMPLE5 In a digital picture, we wish to encode the amount of light at each point as an
eight bit string. How many values are possible at one point?
Counting: Product Rule
EXAMPLE 6 How many eight – bit strings begin either with 101 or 111?
Solution:
• An eight-bit string that begins 101 can be constructed in five successive
steps.
• Select forth bit; select fifth bit;…; select the eight bit. Since each bit can be
selected in two ways, by the multiplication principle,
• 2 × 2 × 2 × 2 × 2 = 25 = 32 eight-bit strings that begin 101.
• Same for 111.
• So the 32 + 32 = 64 eight-bit strings that begins either 101 or 111.
Counting: Sum Rule
DEFINITION
Suppose that 𝑋1, … 𝑋𝑡 are sets and that the ith set 𝑋𝑖 has 𝑛𝑖 elements. If {𝑋1, … 𝑋𝑡} is a
pairwise disjoint family, the number of possible elements that can be selected from 𝑋1
or 𝑋2 or … or 𝑋𝑡 is
𝑛1 + 𝑛2 + ⋯ + 𝑛𝑡.
Counting: Sum Rule
EXAMPLE 1 : if there are 14 boys and 12 girls in a class, find the number of ways of
selecting one student as class representative.
•
Sequences
Suppose we want to determine the number of strings of length 𝑛 consist of
How many such strings are possible?
We can observe that for the first element of the string, we can choose any of a, b and c, that
is, we have 3 choices. No matter what we choose, there are 3 choices for the second
element of the string, so the number of ways to choose the first two elements is 3 2 = 9.
Proceeding in a similar manner, we get that the number of ways to choose the whole string
is 3n.
THEOREM
The number of strings of length n composed of k given elements is kn.
Sequences
Let us generalize it !!!
Suppose we have a database with 4 fields:
Example: How many numbers are possible with 4 digits? e.g 1000 - 9999
𝟗 × 𝟏𝟎 × 𝟏𝟎 × 𝟏𝟎 = 𝟗 × 𝟏𝟎𝟑
Sequences
Example: How many numbers are possible with 𝒏 digits?
It is clear that the first digit can be any of 9 numbers (1, 2, . . . , 9), while the
second, third, etc., digits can be any of the 10 digits. Thus we get a special case of
the previous question with k1 = 9 and k2 = k3 = · · · = kn = 10. Thus the answer is
9 · 10n−1
Recap
There are some important results:
Number of subsets of an n–set
2𝑛
Number of leaf nodes in a complete binary tree with n levels
2𝑛
Number of binary strings of length 𝑛
2𝑛
Number of possible sequences of length 𝑛 from a set of 𝑘 elements
𝑘𝑛
Number of possible sequences of length 𝑛, if we have 𝑛 objects, each object having 𝑘1
possible symbols/types, 𝑘2 types, …, 𝑘𝑛 types
𝑘1 ⋅ 𝑘 2 ⋅ 𝑘 3 ⋯ 𝑘 𝑛
Thanks!
Do you have any questions?
Ahsan.azhar@ucp.edu.pk
F301 - Cab 2- Building A
University of Central Punjab Lahore