Counting
Counting
• Combinatorics
• Basic counting techniques
• Sum Rule
• Product Rule
• The Pigeonhole Principle
• Permutations
• Combinations
• Binomial Theorem
• Introduction to Finite Probability
• Properties of the Probability function
???Question???
• Example
• How many integers are in the set A = {5, 6, .., 21}?
• Solution
• The elements can be rewritten as
{4 + 1, 4 + 2, .., 4 + 17}
• So there are as many numbers in the list as there is in the list {1, 2, ..,
17}
• are 17 elements.
Elements in a list
• Theorem
• If m and n are integers and m n, then there are n – m + 1 integers from m
and n inclusive
• Example
• How many three digit numbers are divisible by 5?
• Solution
• Let A = {100, 101, .., 999}
• Then the numbers in A which are divisible by 5 are
• B = {20.5, 21.5, .., 199.5} Since the highest number is 995 = 199.5
• So f:B → {20,21,..,199} is a bijection
Example cont’d
• Card(A x B) = Card(A)*Card(B)
• This rule holds whether A and B are pairwise disjoint or not.
• The product rule can also be extended to an arbitrary finite number
of sets
Card(A1xA2x…xAn) = Card(A1)*Card(A2)*..*Card(An)
Example
• Suppose a pin number is set to have four digits beginning with a non-
zero digit. How many four-digit pin numbers are there?
• Soln
• Each pin has four positions with the first position having possibilities of 1 to 9
and the other positions taking 0 to 9
• The four-digit numbers are represented by AxAxAxA.
• By the Product rule
• Card(AxAxAxA ) = 9*10*10*10 = 9*103 combinations
Example
Note:
Let A = {0, 1, 2 .., 9} and A’ = A –{0}
Then all three-digit numbers belong to A’xAxA
Three-digit numbers ending with 0 belong to A’xAx{0}
|A’xAx{0}| = 9 x 10 x 1
= 90
Exercise
• The Sum Rule, also called the law of inclusions and exclusion simply
states that
Solution
One method was shown earlier. Here, we use the Addition rule.
Numbers divisible by 5 end with 5 or 0
Let A1 be three-digit numbers ending with 5
Let A2 be three-digit numbers ending with 0
Three-digit numbers divisible by 5 = A1A2
|A1A2| = |A1| + |A2| (Since A1A2 = )
= 90 + 90
= 180
The Sum Rule
|ABC| = |A| + |A x A| + |A x A x A|
= 26 +26x26 + 26x26x26
= 26(1 + 26(1 + 26))
= 26(1 + 26x27)
= 26(1 + 702)
= 26 x 703
= 18,278 possible passcords
Permutations
• Definition
• Let A be a finite set. A permutation is a bijection f:A → A
• This is basically the different ways in which elements of A can be arranged
without repetition.
• If |A| = n, How many such permutations exists?
• Let A = {a, b, c}. How many arrangements are there of the elements in
the set A?
• {a, b, c}, {a, c, b}, {b, a, c}, {b, c, a}, {c, a, b}, {c, b, a}
• We see that there are 6 permutations
• Each of these arrangements is an example of a permutation of the set A.
Permutations
• Let A = {a, b, c, d, e}
• How may 3 letter strings of A can you get
• Without repetitions?
• Have repetitions?
Factorial notation
• Ex: How many permutations can be formed from the letters in the
word NUMBER?
r-Permutations
• Definition
• Let A be a set with n elements, and let 0𝑟𝑛. An r-permutation of A is an
arrangement of r elements of A
• Example
• Consider set A = {a, b, c, d}. How many 2-permutations of A are there?
• Soln
• Use the tree diagram
r-Permutations
• Theorem
• The number of r-permutations of a set with n elements is
• P(n,r) = n(n-1)..[n-r+1] where 0 < r n
Combinations
• Let A = {a, b, c}
• a. Find all 3-combinations
• b. Find all 2-combinations
• Soln
• a. I 3-combination
• b. 3 2-combinations
r-Combinations
• Theorem
• C(n, r) = P(n,r)/r!
• Proof
• Note that for every r-combination of a set A, there are r! r-permutations
since there are r! arrangements of r elements.
• By the fundamental principle of counting, the number of r-permutations of A
is
• P(n,r) = C(n,r).r!
r-Combinations
• Example
• A Discrete Mathematics class has 13 sophomores and 7 juniors
• a. How many 5-person committees can be formed from this class?
• b. How many 5-person committees with 3 sophomores and 2 juniors can be formed in
this class
• Soln
• a. C(20,5)
• b. C(13,3) x C(7,2)
Exercise
• Example:
• Suppose a group of 12 members has 5 man and 7 women
• How many 5-person teams can be chosen that consist of 3 man and 2
women?
• How many five person team contain at least 1 man?
• How many five person team contain at most 1 man?
r-Combinations
• Example:
• Suppose two members of a group insist on working together. Both
picked or not both picked. How many teams possible?
R-Combinations
• Theorem
• C(n, r) = C(n-1, r-1) +C(n-1, r), 0<rn
• Proof: Show that rhs = lhs
The Binomial Theorem
• Theorem
𝑛
𝑛 𝑛
• 𝑥+𝑎 = 𝑘
𝑥 𝑘 𝑎𝑛−𝑘
𝑘=0
• Proof: Exercise
• The Binomial coefficients are displayed in the well-known Pascal’s
Triangle.
• Ex:
• In the expansion (x + y)7, what is the coefficient of the term that has y4?
Introduction to Finite
Probability
Introduction
• Defn
• An event is a subset of the sample space S
• Defn
• A simple event is a singleton set.
• E.g. {1} for the dice experiment is the event in which 1 is the upper face value
of rolling a dice.
• Defn
• An impossible event is an event with an empty set.
• For an event E, the sample points are called favourable outcomes
• An event E is said to occur whenever the outcome is in an element of
event E
• Two events A and B in a sample space are mutually exclusive if A B
=
Probability Function cont’d
• Note that events B and C are not mutually exclusive while B and D
are.
• Theorem
|𝐸|
• Let S be a finite equiprobable sample space. For a given event E, Pr 𝐸 = |𝑆|
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
Properties of the Probability Function
• Pr:P(S) → [0,1]
1. Pr(S) = 1
2. 0 Pr(E) 1 for any event E in S
3. If A and B are mutually exclusive events, then Pr(A B) = Pr(A) + Pr(B)
• Property 3 is referred to as the additive law for mutually exclusive
events
• Theorem
• Pr(A’) = 1 – Pr(A)
• Proof
• S = A A’
• P(S) = P(A B) =P(A) + P(A’) = 1
• P(A’) = 1 - P(A)
• Ex: Show that Pr() = 0
Example
• Theorem
• Pr(A B) = Pr(A) + Pr(B) – Pr(A B)
• Proof
• Note that A B = (A – B) (A B) (B – A) and the events A – B, A B and
B – A are mutually exclusive
• Pr(A B) = Pr((A – B) (A B) (B – A) )
=Pr(A – B) + Pr((A B) (B – A) )
=Pr(A – B) + Pr(A B) + Pr(B – A) ………(i)
• Let A = (A – B) (A B) and B = (B – A) (A B)
• So Pr(A) = Pr((A – B) (A B) ) and Pr(B) = Pr((B – A) (A B))
• Pr(A) = Pr(A – B) + Pr(A B) and Pr(B) = Pr(B – A) + Pr (A B)
• Thus Pr(A – B) = Pr(A) – Pr(A B) and Pr(B – A) = Pr(B) – Pr(A B)
• Substituting in (i) completes the proof
Example
• Example
• Suppose you belong to a class of 23 students. A team of 5 is to be
constituted. What is the probability the you will be included in the
team?
Solution
|S| = 9
|E| = 2
+ 1 2 3 4 5 6
P(E) = 2/9
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
Example
• Example
• A pair of fair dice, one blue and the other gray, are rolled. What is the
probability that the sum of the numbers showing face up is 8, given that both
of the numbers are even?
Conditional Probability
• Example
• In a bag with 5 red marbles and 7 blue marbles. Two marbles are picked one
after the other, without replacing. Let R = picking a red marble
• B = picking a blue marble
• What is P(B|R)?
• Solution
• If the first ball that was picked was red then there will be 11 marbles
remaining of which 7 will be blue.
• P(B|R) = 7/11
Conditional Probability
• Defn
• Let A and B be events in a sample space S. If P(A) 0, then the conditional
probability of B given A , denoted by P(B|A) is
Pr(𝐴 ∩ 𝐵)
𝑃𝑟 𝐵 𝐴 =
𝑃𝑟(𝐴)
Example
• An urn contains 5 blue and 7 gray marbles. Let us say that 2 are
chosen at random, one after the other, without replacement. Find
the following probabilities:
• the probability that both marbles are blue
• the probability that the first ball is blue and the second is not blue
• the probability that the first ball is not blue and the second ball is blue, and
the probability that neither ball is blue.
• What is the probability that the second ball is blue?
• What is the probability that at least one of the balls is blue?
• If the experiment of choosing two balls from the urn were repeated many
times over, what would be the expected value of the number of blue balls?
• Example in the book
Summary
• Counting
• Probability
• End!