Disc-1-Ch-1 lectureDZ Final
Disc-1-Ch-1 lectureDZ Final
Chapter-1
12/23/24 3
Outline
• Introduction
• Basic Counting principles:
– Product rule, sum rule, Principal of Inclusion Exclusion (PIE)
• Permutations
• Combinations
• Pigeonhole principle
– Generalized forms
• Binomial Coefficients
• Binomial Theorems
• More Examples
12/23/24 4
Introduction
• This chapter develops some techniques for
determing, with out direct enumeration, the
number of possible outcomes of a particular
event or the number of elements in a set.
1.1 Basic counting principle
There are two basic counting principle such as sum
rule principle and product rule principle
12/23/24 5
Sum Rule principle: Suppose some event E can
occur in m ways and a second event F can
occur in n ways, and suppose both events can
not occur simultaneously. Then E or F can
occur in m+n ways.
Product rule principle: Suppose some event E
can occur in m ways and independent of this
event, there is a second event F which can
occur in n ways. Then the combination of E
and F can occur in m*n ways
12/23/24 6
• The above principles can be extended to three or
more events. That is , Suppose an event E1 can
occur in n1 ways, a second event E2 can occur in
n2 ways, and so on. Then:
• sum rule: If no two events can occur at the same
time, then one of the events occur in
n1 + n2 + … + nm-1 + nm
• Product rule: If the events occur one after the
other, then all the events can occur in the order
indicated in n1 * n2 * … * nm-1 * nm
• ways.
12/23/24 7
Example
Suppose a college has 3 different history courses, 4
different literature courses, and 2 different
sociology courses . Find the number of way a
A.Student can choose one of each kind of courses
B.Student can choose just one of the courses
12/23/24 8
1.2 Permutation & Combination
1.2.1: Factorial Function
The product of the positive integers from 1 to n
inclusive is denoted by n!,
read as “n factorial”
n!=n*(n-1)*(n-2)*…3*2*1
Example: 4!=4*3*2*1=24
Note: 0!=1 and 1!=1
12/23/24 9
Example
Compute and simplify the following:
1.6!, 7!,8!&9!
2.
12/23/24 10
1.2.2 Permutation
Defn: Any arrangement of a set of n objects in a
given order is called a permutation of the objects
[taken all at a time]
• Any arrangement of a set of r n objects in a
given order is called r-permutation of the objects
or a permutation the n objects taken r at a time
12/23/24 11
Example
• Consider the set of letters A,B,C&D. Then
1.BDCA,DCBA & ACDB are permutation of 4 letters
taken all at a time
2.BAD,ACB,DBC are permutation of the 4 letters
taken 3 at a time
3.AD, BC, CA are permutation of the 4 Letters taken
2 at a time.
The number of permutation of n objects taken r at
a time is denoted by P(n, r),given by
12/23/24 12
Example
Find the number of permutation of six objects, say
A,B,C,D,E,F, taken 3 at a time.
Ans:
Corollary: There are n! permutation of n objects
taken all at a time.[prove class work]
For example: There are 3!=6 permutation of the
letters A,B &C. These are ABC,ACB,CAB,CBA,BAC
& BCA
12/23/24 13
Permutations: Example
Example
In how many ways can six pupils stand in a line or linearly
arranged to pay their college fees at the finance office
counter? Ans: 6P6 = 6!
12/23/24 18
Combinations: Example
• How many committees of 5 people can be chosen from 20 men and 12 women
– If exactly 3men must be on each committee?
– If at least 4 women must be on each committee?
12/23/24 19
Combinations
• A useful fact about combinations is that they
are symmetric
12/23/24 20
Combination with repetition
• Assume that A with n elements .Any selection
of r objects from A, where each object can be
selected more than once, is called a
combination of n objects taken r at a time
with repetition.
• Example: The combinations of the letters
a,b,c,d taken 3 at a time with repetition are:
aaa,aab,aac,abb,…,ddd
12/23/24 21
Note: The following are
equivalent
12/23/24 22
Example
12/23/24 23
1.3 The inclusion-exclusion
principles
Let A and B be any sets. Then
12/23/24 24
We include n(A),n(B),n(C),We exclude n(AnB),
n(AnC), n(BnC) and finally include n(AnBnC)
Example: Find the number of mathematics student
at a college taking at least one of the
languages ,French, German and Russian given
the following data:
65 study french,45 study german,42 study
Russian,20 study French and German,25 study
French and Russian,15 study German and Russian,8
study all three languages
12/23/24 25
General form of inclusion-
exclusion
• We can give another formulation in terms of sets.
Let A1, A2, …, Am be pairwise disjoint sets. Then
|A1 A2 … Am | = |A1| |A2| … |Am|
12/23/24 26
• More generally, we have the following
• Lemma: Let A, B, be subsets of a finite set U. Then
1. |AB| = |A| + |B| - |AB|
2. |A B| min {|A|, |B|}
3. |A\B| = |A| - |AB| |A|-|B|
4. |A| = |U| - |A|
5. |AB| =|AB|-|AB|= |A|+|B|-2|AB|= |A\B|+ |B\
A|
6. |A B| = |A||B|
12/23/24 27
• Theorem: Let A1,A2, …,An be finite sets, then
|A1 A2 ...An|= i|Ai|
- i<j|Ai Aj|
+ i<j<k|Ai Aj Ak|
-…
+(-1)n+1 |A1A2...An|
Each summation is over
• all i,
• pairs i,j with i<j,
• triples with i<j<k, etc.
12/23/24 28
PIE Theorem: Example 1
• To illustrate, when n=3, we have
|A1 A2 A3|= |A1|+ |A2| +|A3|
- [|A1A2|+|A1A3|+|A2A3|]
+|A1 A2 A3|
12/23/24 29
PIE Theorem: Example 2
• To illustrate, when n=4, we have
|A1A2A3A4|= |A1|+|A2|+|A3|+|A4|
- [|A1A2|+|A1A3|+|A1A4|
+|A2A3|+|A2A4|+|A3A4|]
+ [|A1A2A3|+|A1A2A4|
+|A1A3A4|+|A2A3A4|]
- |A1 A2 A3 A4|
12/23/24 30
Application of PIE: Example A (1)
• How many integers between 1 and 300 (inclusive) are
– Divisible by at least one of 3,5,7?
– Divisible by 3 and by 5 but not by 7?
– Divisible by 5 but by neither 3 or 7?
• Let
A = {nZ | (1 n 300) (3|n)}
B = {nZ | (1 n 300) (5|n)}
C = {nZ | (1 n 300) (7|n)}
• How big are these sets? We use the floor function
|A| = 300/3 = 100
|B| = 300/5 = 60
|C| = 300/7 = 42
12/23/24 31
Application of PIE: Example A (2)
• How many integers between 1 and 300 (inclusive) are divisible by at least
one of 3,5,7?
Answer: |AB C|
• By the principle of inclusion-exclusion
|AB C|= |A|+|B|+|C|-[|AB|+|AC|+|BC|]+|ABC|
• How big are these sets? We use the floor function
|A| = 300/3 = 100 |AB| = 300/15 = 20
|B| = 300/5 = 60 |AC| = 300/21 = 100
|C| = 300/7 = 42 |BC| = 300/35 = 8
|ABC| = 300/105 = 2
• Therefore:
|AB C| = 100 + 60 + 42 - (20+14+8) + 2 = 162
12/23/24 32
Application of PIE: Example A (3)
• How many integers between 1 and 300 (inclusive) are divisible by 3 and
by 5 but not by 7?
Answer: |(A B)\C|
• By the definition of set-minus
|(A B)\C| = |A B| - |A B C| = 20 – 2 = 18
• Knowing that
|A| = 300/3 = 100 |AB| = 300/15 = 20
|B| = 300/5 = 60 |AC| = 300/21 = 100
|C| = 300/7 = 42 |BC| = 300/35 = 8
|ABC| = 300/105 = 2
12/23/24 33
Application of PIE: Example A (4)
• How many integers between 1 and 300 (inclusive) are divisible by 5 but by
neither 3 or 7?
Answer: |B\(A C)| = |B| - |B (A C)|
• Distributing B over the intersection
|B (A C)| = |(B A) (B C)|
= |B A| + |B C| - | (B A) (B C) |
= |B A| + |B C| - | B A C |
= 20 + 8 – 2 = 26
• Knowing that
|A| = 300/3 = 100 |AB| = 300/15 = 20
|B| = 300/5 = 60 |AC| = 300/21 = 100
|C| = 300/7 = 42 |BC| = 300/35 = 8
|ABC| = 300/105 = 2
12/23/24 34
1.4 Pigeonhole Principle
• If n pigeonholes are occupied by n+1 or more
pigeons, then at least one pigeonhole is occupied by
more than one pigeon
• Theorem: If k+1 or more objects are placed in k
boxes, then there is at least one box containing two
or more objects
• This principal is a fundamental tool of elementary
discrete mathematics.
• It is also known as the Dirichlet Drawer Principle or
Dirichlet Box Pinciple
12/23/24 35
Pigeonhole Principle (2)
• It is seemingly simple but very powerful
• The difficulty comes in where and how to apply it
• Some simple applications in Computer Science
– Calculating the probability of hash functions having a
collision
– Proving that there can be no lossless compression
algorithm compressing all files to within a certain ration
12/23/24 36
Generalized Pigeonhole Principle (1)
• Theorem: If N objects are placed into k boxes then
there is at least one box containing at least
12/23/24 37
Example
Find the minimum number of students in a class to
be sure that three of them are born in the same
month.
Solution: n = 12, number of months in a year
(pigeonholes) k+1 = 3 → k= 2.
Hence k*n+1 = 2*12+1=25
• Therefore the minimum number of students in a
class to be sure that three of them are in the
same class is 25.
12/23/24 38
1.5 Binomial Theorem
• The number of r-combinations is also called the
binomial coefficient
12/23/24 39
Binomial Coefficients
• Theorem: Binomial Theorem
Let x, y, be variables and let n be a nonnegative integer. Then
Example
12/23/24 40
Binomial Coefficients: Example
• What is the coefficient of the term x8y12 in the
expansion of (3x+4y)20?
– By the binomial theorem, we have
– The coefficient is
12/23/24 41
Binomial Coefficients (3)
• Many useful identities and facts come from the
Binomial Theorem
• Corollary:
12/23/24 42
Binomial Coefficients (4)
• Theorem: Vandermonde’s Identity
Let m,n,r be nonnegative integers with r not exceeding either
m or n. Then
12/23/24 43
Binomial Coefficients: Pascal’s Identity & Triangle
12/23/24 44
Pascal’s Triangle
12/23/24 45