0% found this document useful (0 votes)
18 views41 pages

2 Counting Methods

Uploaded by

rsmyrsmy14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views41 pages

2 Counting Methods

Uploaded by

rsmyrsmy14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

University of Benghazi

Faculty of Engineering
Electrical and Electronics Engineering Department

Probability and Random Process


EE277

Counting Methods
Salma Elkawafi
[email protected]
Counting Methods
In studying probability, it is usually effective to use
some counting methods to compute the possible
outcomes of a certain experiment.
The followings are some of the most important
methods of counting:
• Inclusion-exclusion principle
• The basic principle of counting (Multiplication): ordered
sampling with replacement
• Permutations: Ordered Sampling without Replacement
• Combinations: Unordered Sampling without Replacement
• Multinomial Coefficients
• Unordered Sampling with Replacement
Counting Methods
• Inclusion-exclusion principle
• The inclusion-exclusion principle says

|𝐴 ∪ 𝐵| = |𝐴| + |𝐵| − |𝐴 ∩ 𝐵|

𝑆 is all the dots, A is the dots in the blue circle, and B is


the dots in the red circle. |A| is the number of dots in A
and likewise for the other sets. The figure shows that
|A|+|B| double-counts |A ∩ B|, which is why |A ∩ B| is
subtracted off in the inclusion-exclusion
formula.

| A | = #A = n(A)
Counting Methods
|𝐴 ∪ 𝐵 ∪ 𝐶| = |𝐴| + |𝐵| + |𝐶| − |𝐴 ∩ 𝐵| − |𝐴 ∩ 𝐶| − |𝐵 ∩ 𝐶| + |𝐴 ∩ 𝐵 ∩ 𝐶|
Counting Methods
• Inclusion-exclusion principle
Example:
In a band of singers and pianists, seven people sing, four play the
piano, and two do both. How big is the band?
Solution:
Let S be the set singers and P be the set piano players. The inclusion
exclusion principle says size of band is

|𝑆 ∪ 𝑃| = |𝑆| + |𝑃| − |𝑆 ∩ 𝑃| = 7 + 4 − 2 = 9.
Counting Methods
• Inclusion-exclusion principle
Example:
50 students taking examinations in Mathematics, Physics and Chemistry, each of the student has
passed in at least one of the subject, 37 passed Mathematics, 24 Physics and 43 Chemistry. At most
19 passed Mathematics and Physics, at most 29 Mathematics and Chemistry and at most 20 Physics
and Chemistry. What is the largest possible number that could have passed all three examination?
Solution :
Let M be the set of students passing in Mathematics
P be the set of students passing in Physics
C be the set of students passing in Chemistry Now,
• 𝑛 𝑀 ∪ 𝑃 ∪ 𝐶 = 50, 𝑛 𝑀 = 37, 𝑛 𝑃 = 24, 𝑛 𝐶 = 43 , 𝑛 𝑀 ∩ 𝑃 ≤ 19, 𝑛(𝑀 ∩ 𝐶) ≤ 29
, 𝑛(𝑃 ∩ 𝐶) ≤ 20 (Given)

𝑛(𝑀 ∪ 𝑃 ∪ 𝐶)
= 𝑛(𝑀) + 𝑛(𝑃) + 𝑛(𝐶) – 𝑛(𝑀 ∩ 𝑃) – 𝑛(𝑀 ∩ 𝐶) – 𝑛(𝑃 ∩ 𝐶) + 𝑛(𝑀 ∩ 𝑃 ∩ 𝐶) ≤ 50
⇒ 37 + 24 + 43 – 19 – 29 – 20 + 𝑛(𝑀 ∩ 𝑃 ∩ 𝐶) ≤ 50
⇒ 𝑛 𝑀 ∩ 𝑃 ∩ 𝐶 ≤ 50 – 36
⇒ 𝑛(𝑀 ∩ 𝑃 ∩ 𝐶) ≤ 14
Counting Methods
• The basic principle of counting (Multiplication)
• If there are 𝑛 ways to perform action 1 and then by m ways to perform action
2, then there are 𝑛 · 𝑚 ways to perform action 1 followed by action 2.
Or
• It states that if one experiment can result in any of 𝑚 possible outcomes and if
another experiment can result in any of 𝑛 possible outcomes, then there are
𝑚𝑛 possible outcomes of the two experiments.
Counting Methods
• The basic principle of counting (Multiplication)

• Here is a formal statement of the multiplication principle

Multiplication Principle
• Suppose that we perform 𝑟 experiments such that the 𝑘𝑡ℎ experiment
has 𝑛𝑘 possible outcomes, for 𝑘 = 1,2, ⋯ , 𝑟. Then there are a total of
𝑛1 × 𝑛2 × 𝑛3 × ⋯ × 𝑛𝑟 possible outcomes for the sequence of 𝑟
experiments.

Multiplication rule or Rule of product


Counting Methods
• The basic principle of counting (Multiplication)
Example:
Small community consists of 10 women, each of whom has 3
children. If one woman and one of her children are to be chosen
as mother and child of the year, how many different choices are
possible?
Solution :
we see from the basic principle that there are 10 * 3 = 30 .
possible choices. .
Counting Methods
• The basic principle of counting (Multiplication)
Example:
• How many different 7-place license plates are possible if the first 3 places
are to be occupied by letters and the final 4 by numbers?
• How many license plates would be possible if repetition among letters or
numbers were prohibited?
Solution :
The answer is 26 × 26 × 26 × 10 × 10 × 10 × 10 = 175,760,000.

In the second case, there would be 26 · 25 · 24 · 10 · 9 · 8 · 7 = 78,624,000


possible license plates.
Some general terminology for the counting problems

• Sampling: sampling from a set means choosing an element from that set. We often draw a sample at
random from a given set in which each element of the set has equal chance of being chosen.

• With or without replacement: usually we draw multiple samples from a set. If we put each object back
after each draw, we call this sampling with replacement. In this case a single object can be possibly
chosen multiple times. For example, if 𝐴 = {𝑎1 , 𝑎2 , 𝑎3 , 𝑎4 } and we pick 3 elements with replacement, a
possible choice might be (𝑎3 , 𝑎1 , 𝑎3 ). Thus "with replacement" means "repetition is allowed." On the
other hand, if repetition is not allowed, we call it sampling without replacement.

• Ordered or unordered: If ordering matters 𝑖. 𝑒. : 𝑎1 , 𝑎2 , 𝑎3 ≠ 𝑎2 , 𝑎3 , 𝑎1 this is called ordered


sampling. Otherwise, it is called unordered.

Thus when we talk about sampling from sets, we can talk about four possibilities.

• ordered sampling with replacement


• ordered sampling without replacement
• unordered sampling without replacement
• unordered sampling with replacement
Counting Methods
• Ordered Sampling with Replacement
• Here we have a set with 𝑛 elements (𝑒. 𝑔. : 𝐴 = {1,2,3, ⋯ . 𝑛}), and we want to draw 𝑘 samples
from the set such that ordering matters and repetition is allowed. For example, if 𝐴 = {1,2,3}
and 𝑘 = 2, there are 9 different possibilities:
(1,1); (1,2); (1,3);
(2,1); (2,2); (2,3);
(3,1); (3,2); (3,3).
• In general, we can argue that there are 𝑘 positions in the chosen list: (Position 1, Position 2, ...,
Position 𝑘). There are 𝑛 options for each position. Thus, when ordering matters and repetition is
allowed, the total number of ways to choose k objects from a set with 𝑛 elements is
𝑛 × 𝑛 × ⋯ × 𝑛 = 𝑛𝑘
• Note that this is a special case of the multiplication principle where there are 𝑘 "experiments"
and each experiment has 𝑛 possible outcomes
Counting Methods
• Permutations (‫)التبادلية‬: Ordered Sampling without Replacement:
• if 𝐴 = {1,2,3} and 𝑘 = 2, there are 6 different possibilities:
(1,2); (1,3); (2,1); (2,3); (3,1); (3,2).
• In general, we can argue that there are k positions in the chosen list: (Position 1, Position
2, ..., Position 𝑘). There are 𝑛 options for the first position, (𝑛 − 1) options for the second
position (since one element has already been allocated to the first position and cannot
be chosen here), (𝑛 − 2) options for the third position, … (𝑛 − 𝑘 + 1) options for the 𝑘𝑡ℎ
position. Thus, when ordering matters and repetition is not allowed, the total number of
ways to choose k objects from a set with n elements is
𝑛 × (𝑛 − 1) × ⋯ × (𝑛 − 𝑘 + 1).
• Any of the chosen lists in the above setting (choose 𝑘 elements, ordered and no
repetition) is called a k-permutation of the elements in set 𝐴. We use the following
notation to show the number of k-permutations of an n-element set:
Counting Methods
• Permutations (‫)التبادلية‬: Ordered Sampling without Replacement:
• Simply, a permutation is an arrangement in a definite order of a number of
objects taken some or all at a time. Counting permutations is merely
counting the number of ways in which some or all objects at a time are
rearranged
• When we are counting the number of subgroups of size 𝑘 from a larger
group of size 𝑛 considering ORDER, we use permutations. We define
permutations as
𝑛 𝑛!
𝑃𝑘 = 𝑓𝑜𝑟 0 ≤ 𝑘 ≤ 𝑛
𝑛−𝑘 !
Numerical Example: if 𝑛 = 5 and 𝑘 = 3
5×4×3×2×1
𝑃35 =
2×1
Counting Methods
• Permutations
• Example:
• How many different ordered arrangements of the letters a, b, and c are
possible?
• By direct enumeration we see that there are 6, namely, abc, acb, bac, bca,
cab, and cba.
• Each arrangement is known as a permutation. Thus, there are 6 possible
permutations of a set of 3 objects. This result could also have been obtained
from the basic principle, since the first object in the permutation can be any
of the 3, the second object can then be chosen from any of the remaining 2,
and the third object is then the remaining 1.
• Thus, there are 3 × 2 × 1 = 6 possible
Counting Methods
• Permutations
Example:
• A class in probability theory consists of 6 men and 4 women. An examination is given, and the
students are ranked according to their performance. Assume that no two students obtain the same
score.
a) How many different rankings are possible?
b) If the men are ranked just among themselves and the women just among themselves, how many
different rankings are possible?
c) How many different top-three rankings are possible?
Solution:
a) There are 𝑃10
10
possible rankings = 10 × 9 × 8 × ⋯ × 2 × 1
b) There are 𝑃6 possible rankings among men and 𝑃44 possible rankings among women,
6

so there are a 𝑃66 × 𝑃44 = 720 × 24 of possible rankings in total (basic principle of
counting)
10! 10×9×8×7×6×5×4×3×2×1
c) There are 𝑃310 possible rankings = = = 10 × 9 × 8 = 720
10−3 ! 7×6×5×4×3×2×1
Counting Methods
• Combinations: Unordered Sampling without Replacement
Here we have a set with 𝑛 elements, e.g., 𝐴 = {1,2,3, … . 𝑛} and we want to
draw 𝑘 samples from the set such that ordering does not matter and
repetition is not allowed. Thus, we basically want to choose a 𝑘-element
subset of 𝐴, which we also call a 𝑘-combination of the set 𝐴. For example if 𝐴
= {1,2,3} and 𝑘 = 2, there are 3 different possibilities:
{1,2};
{1,3};
{2,3}.
We show the number of k-element subsets of A by
𝑛
.
𝑘
This is read "n choose k."
Counting Methods
• Combinations: Unordered Sampling without Replacement
Simply, when we are counting the number of subgroups of size 𝑘 from a
larger group of size n considering NO ORDER, we use combinations.
We define combinations as
𝑛 𝑛 𝑛!
𝐶𝑘 = =
𝑘 𝑘! 𝑛 − 𝑘 !

Numerical Example: if 𝑛 = 5 and 𝑘 = 3

5! 5×4×3×2×1
𝐶35 = =
3! 5 − 3 ! 3×2×1×2×1
Counting Methods
• Combinations
Example:
A committee of 3 is to be formed from a group of 20 people. How many
different committees are possible?

Solution
20! 20×19×18
There are 𝐶320 = 20
3
= = = 1140 possible
3! 20−3 ! 3×2×1
committees can be formed
Counting Methods
• Combinations
Example:
From a group of 5 women and 7 men
a) How many different committees consisting of 2 women and 3 men can be formed?
b) What if 2 of the men are refusing to work together in one committee?
Solution
a) There are 𝐶25 of possible groups of women and 𝐶37 of possible groups of men. So, the total
number of possible committees is
5×4 7×6×5×4
𝐶25 × 𝐶37 = ( )( ) = 350
2×1 3×2×1
b) Now, for two men to be together, there are 𝐶22 × 𝐶15 = 1 × 5 ways.
We remove these 5 ways from 𝐶37 of total possible groups of men, so there are now 35-5=30
of possible groups of men and by considering the number of women groups, we have a total
of 𝐶25 × 30 = 10 × 30 or 300 different possible committees.
Counting Methods
• Combinations
Example:
What is the number of ways of choosing 4 cards from a pack of 52 playing cards? In how many of
these
(i) four cards are of the same suit, (ii) four cards belong to four different suits,
Solution
• There will be as many ways of choosing 4 cards from 52 cards as there are combinations of 52
different things, taken 4 at a time. Therefore The required number of ways = 𝐶452 = 270725
(i) There are four suits: diamond, club, spade, heart and there are 13 cards of each suit. Therefore, The
required number of ways = 𝐶413 + 𝐶413 + 𝐶413 + 𝐶413 = 2860
(ii) There are13 cards in each suit. Therefore, there are 𝐶113 ways of choosing 1 card from 13 cards of
diamond, 𝐶113 ways of choosing 1 card from 13 cards of hearts, 𝐶113 ways of choosing 1 card from 13
cards of clubs, 𝐶113 ways of choosing 1 card from 13 cards of spades. Hence, by multiplication principle,
the required number of ways = 𝐶113 × 𝐶113 × 𝐶113 × 𝐶113 = 134
Counting Methods
• Multinomial Coefficients

• When we are counting the number of


different arrangements of a group of
size n, where 𝑛 has 𝑛1 , 𝑛2 , …, and 𝑛𝑟 of
similar subgroups, we use the
multinomial coefficients method.
• So, if 𝑛1 + 𝑛2 + ⋯ + 𝑛𝑟 = 𝑛, then
the possible arrangements are

𝑛 𝑛!
=
𝑛1 , 𝑛2 , ⋯ , 𝑛𝑟 𝑛1 ! 𝑛2 ! … . 𝑛𝑟 !
Counting Methods
• Multinomial Coefficients
Example: How many different letter arrangements can be formed from the letters
PEPPER?

Solution
6!
There are 6
3 ,2,1
= 3!2!1! = 60 possible letter arrangements can be formed
Counting Methods
• Multinomial Coefficients
Example:
A police department consists of 10 officers, 5 of them work in streets, 3 in cars,
and 2 in the building. How many different divisions of the 10 officers into the
three groups are possible?

Solution:
10!
There are 10
5 ,3,2
= 5!3!2! = 2520 possible divisions
Counting Methods
• Unordered Sampling with Replacement
• Suppose that we want to sample from the set 𝐴 = {𝑎1 , 𝑎2 , … , 𝑎𝑛 } 𝑘 times such
that repetition is allowed and ordering does not matter. For example, if 𝐴
= {1,2,3} and 𝑘 = 2, then there are 6 different ways of doing this

1,1; 1,2; 1,3; 2,2; 2,3; 3,3;

The number of different ways of picking 𝑘 objects from a set of 𝑛 distinct objects
with replacement and without ordering is given by= 𝑛+𝑘−1𝑘
.

Self-Study
Summary
End of Lecture 2
A total of 36 members of a club play tennis, 28 play squash, and 18
play badminton. Furthermore, 22 of the members play both tennis
and squash, 12 play both tennis and badminton, 9 play both squash
and badminton. How many members play all three sports if 43
members of this club play at least one of the three sports?
Exercise

A college planning committee consists of 3 freshmen, 4 sophomores, 5


juniors, and 2 seniors. A subcommittee of 4, consisting of 1 person from each
class, is to be chosen. How many different subcommittees are possible?

Answer:
There are 3 × 4 × 5 × 2 = 120 possible subcommittees
Exercise

How many functions defined on n points are possible if each


functional value is either 0 or 1?

Answer:
Let the points be 1, 2, . . . , 𝑛. Since 𝑓(𝑖) must be either 0 or 1 for each i
= 1, 2, . . . , n, it follows that there are 2𝑛 possible functions.
Exercise

There are 5 competitors in the 100m final at the Olympics. In how many
ways can the gold, silver, and bronze medals be awarded?

Answer:
There are 5 ways to award the gold. Once that is awarded there are 4
ways to award the silver and then 3 ways to award the bronze: answer
5 · 4 · 3 = 60 ways.
Exercise
Ms Jones has 4 math, 3 physics, 2 chemistry and 1 language books. She wants to
arrange these books on a bookshelf so that all books of the same subject are kept
together. How many different arrangements are possible?
Answer:
There are 𝑃44 possible arrangements for math books , 𝑃33 possible arrangements for
physics books, 𝑃22 possible arrangements for physics books, and 𝑃11 possible
arrangements for language book. Also, we have 4 subjects that can have
𝑃44 possible arrangements . So, there are 𝑃44 ×𝑃44 × 𝑃33 × 𝑃22 × 𝑃11 = 6912 possible
arrangements in total ( generalized basic principle of counting)
Exercise
How many numbers lying between 100 and 1000 can be formed with the digits 0, 1, 2,
3, 4, 5, if the repetition of the digits is not allowed?
Answer:
Every number between 100 and 1000 is a 3-digit number. We, first, have to count
the permutations of 6 digits taken 3 at a time 𝑃36 . But, these permutations will
include those also where 0 is at the 100’s place. For example, 092, 042, . . ., etc
are such numbers which are actually 2-digit numbers and hence the number
of such numbers has to be subtracted from 𝑃36 to get the required number.
To get the number of such numbers, we fix 0 at the 100’s place and rearrange
the remaining 5 digits taking 2 at a time.
6! 5!
So The required number 𝑃36 − 𝑃25 = − = 100
3! 3!
Exercise
Count the following:
(i) The number of ways to choose 2 out of 4 things (order does not matter).
(ii) The number of ways to list 2 out of 4 things.
(iii) The number of ways to choose 3 out of 10 things.

Answer:

4! 4!
(i) This is asking for combinations: C24 = = =6
2! 4−2 ! 2!×2!
4! 4!
(ii) This is asking for permutations: 𝑃24 = = = 12
4−2 ! 2!
10! 10! 10×9×8
(iii) This is asking for combinations: C310 = = = = 120
3! 10−3 ! 3! × 7! 3×2×1
Exercise
Count the number of ways to get 3 heads in a sequence of 10 flips of a
coin.
Answer:

This asks for the number sequences of 10 flips (heads or tails) with exactly
3 heads. That is, we have to choose exactly 3 out of 10 flips to be heads.
This is the same question as in the previous example:

10! 10! 10×9×8


C310 = = = = 120
3! 10−3 ! 3! × 7! 3×2×1
Exercise
Twenty workers are to be assigned to 20 different jobs, one to each job.
How many different assignments are possible?

Answer:

There are 20! different possible assignments


Exercise
A child has 12 blocks, of which 6 are black, 4 are red, 1 is white, and 1 is
blue. If the child puts the blocks in a line, how many arrangements are
possible?

Answer:

12!
There are = 27720 arrangements
6!4!
.
Exercise
A maths debating team consists of 4 speakers

a) In how many ways can all 4 speakers be arranged in a row for a photo?
b) How many ways can the captain and vice-captain be chosen?

Answer:
4
a) 4 × 3 × 2 × 1 = 4! 𝑜𝑟 𝑃4
4
b) 4 × 3 = 12 or 𝑃2
Exercise
Consider the following data among 110 students in a college dormitory: 30 students are on a
list A (taking Accounting), 35 students are on a list B (taking Biology), 20 students are on both
lists. Find the number of students:
(a) on list or B,
( b) on exactly one of the two lists,
( c) on neither list.
Answer:
(a) 𝑛(𝐴 𝑈 𝐵) = 𝑛(𝐴) + 𝑛(𝐵) − 𝑛(𝐴 𝑛 𝐵) = 30 + 35 − 20 = 45

(b) 𝑛(𝐴\B) = 𝑛(𝐴) − 𝑛(𝐴 𝑈 𝐵) = 30 − 20 = 10


𝑛(𝐵\A) = 𝑛(𝐵) − 𝑛(𝐴 𝑈 𝐵) = 35 − 20 = 15
Thus there are 10 + 15 = 25 students on exactly one of the two lists.

(c) 𝐴𝑐 ∩ 𝐵𝑐 = 𝐴 ∪ 𝐵 𝑐 = 𝑛(𝑆) − 𝑛(𝐴 𝑈 𝐵) = 110 − 45 = 65


Exercise
In how many ways can 8 people be seated in a row if
(a) there are no restrictions on the seating arrangement?
(b) persons A and B must sit next to each other?

Answer:

(𝑎) 8! = 40,320
(𝑏) 2 ⋅ 7! = 10,080
Exercise
In how many ways can 5 boys and 4 girls be arranged on a bench if:
(a) boys and girls alternate?
(b) boys and girls are in separate groups?

Answer:
(a) 𝐵𝐺𝐵𝐺𝐵𝐺𝐵𝐺𝐵 = 5 × 4 × 4 × 3 × 3 × 2 × 2 × 1 × 1 = 5! × 4!
(b) Boys & Girls or Girls & Boys
= 5! × 4! + 4! × 5! = 5! × 4! × 2

You might also like