You are on page 1of 4

‫بسم هللا الرحمن الرحيم‬

Chapter 2
Techniques of Counting
The task of determining the cardinality of a set (number of its elements) is important in
many problems encountered when computing probabilities. Techniques of counting are
techniques that are used to determine the cardinality of a set without enumerating or
listing its elements. The value of these techniques is apparent when huge sets are dealt
with. First, we list two fundamental principles of counting and then proceed to
permutations and combinations as useful tools for counting.

2.1 Multiplication Principle


If an operation can be described as a sequence of k steps, then if the number of ways of
completing step 1 is n1 , and if the number of ways of completing step 2 is n 2 for each
way of completing step 1 and so forth, then the total number of ways of completing the
operation is
n1  n 2  n 3  n k

Example 1: Consider the random experiment of flipping 2 coins and then a fair dice is
tossed. Determine the number of possible outcomes in this experiment.
2  2  6  24

Example 2: A computer system uses passwords that are 6 characters long and each
character is one of the 26 letters (a-z) or the 10 integers (0-9). Uppercase letters are not
used. Let the event A denote the event that a password ends with a vowel (either a,e,i,o,
or u) and let B denote the event that a password starts with an odd number (either
1,3,5,7, or 9). Suppose a user selects a password at random. Determine the probability
that the selected password starts with an odd number or ends with a vowel.

The number of elements in the sample space (set of possible 6 characters passwords) is
N S  (36) 6 . The number of elements in event A is given by N A  5  (36)5 and
similarly the number of elements in event B is N B  5  (36)5 . Finally, the number of
elements in the event A  B , passwords starting with an odd number and ending with a
vowel, is given by N A  B  52  (36) 4 .
The required probability is P(A  B) and can be computed as follows:
P(A  B)  P(A)  P(B)  P(A  B)
5 5 25
    0.26
(36) (36) (36) 2

2.2 Addition Principle


If a process can be performed based on any of k distinct procedures and each procedure
can be performed in n i different ways, then the process can be performed in
n1  n 2  n 3    n k ways.
For example, an engineering student deciding on his major field must choose first a
department and then choose his major. If he decided to join electrical engineering
department then he has only two choices, surely not including construction.

1
Example 3: A driver from city A can directly reach city B using four different roads.
Moreover, he can also reach city B by passing by city C first. In this latter case, he can
drive along any of three roads connecting cities A and C, and choose any of the five
roads from C to B. How many different choices are available to the driver?
4  3 5  19

2.3 Permutations (Ordered Selection Without Repetition)


A permutation of the elements is an arrangement or ordered sequence of all or part of
a set of objects in a given order.
The number of all possible permutations (arrangements) of n distinct objects is
n  (n  1)   3  2 1  n !
For example, the number of ways of arranging a set of 5 students in a queue is 5!.

Example 4: Nine professors are to give talks at a certain conference. Each one will
give only one talk. Three of them are French, two are American and four are Egyptian.
In how many ways can their talks be scheduled such that professors of the same
nationality follow each other?
3 !  (3 !  2 !  4 !)

More generally, the number of arrangements of only a subset of r objects out of a set
of n distinct objects is given by
n!
n  (n  1)    (n  r  1)   n Pr
n  r!

Example 5: A dice is tossed three times. Find the probability of obtaining distinct
faces.

Of course, in this case we cannot list all the elements of S ( N S  63 ) and therefore we
use techniques of counting to solve this problem.
S  {(1,1,1),, (6,6,6)}
Define the event A of obtaining distinct faces in the 3 tosses and the number of its
elements is the number of permutations of 3 distinct objects out of 6 objects (ordered
tuples), that is, N A  6 P3
6
P3
P(A ) 
63

Example 6: A password in a certain computer system consists of exactly five distinct


lowercase letters. Determine the probability that a hacker succeeds in guessing your
password.
1
P(A) 
26
P5

The number of permutations of n  n1  n 2   n k objects of which n1 are of one


type, n 2 of a second type, …. , n k of a kth type is given by

n!  n 
   (multinomial coefficient)
n1! n 2 !n k !  n1 , n 2 ,, n k 

2
The division by n i ! is to cancel out order, since it is meaningless to arrange identical
objects.

Example 7: A part is labeled by printing with 4 thick lines, 3 medium lines and 2 thin
lines. If each ordering of the 9 lines represents a different label, how many different
labels can be generated using this scheme?
9!
3!4!2!

2.4 Combinations (Unordered Selection Without Repetition)


In many problems, we are interested in the number of ways of selecting r objects from n
objects without regard to order.

Subsets of r elements that can be selected from a set of n distinct elements are called
combinations. The number of possible combinations of r objects is
n  (n  1)    (n  r  1) n!
  n C r (binomial coefficient)
r! r! n  r!
n
Pr
It is clear that n C r  (since there are r! arrangements of r objects). The following
r!
table further demonstrates this fact. The combinations and permutations of the letters
{ a,b,c,d } taken three at a time are compared.

Combinations Permutations
abc abc, acb, bac, bca, cab, cba
abd abd, adb, bad, bda, dab, dba
acd acd, adc, cad, cda, dac, dca
bcd bcd, bdc, cbd, cdb, dbc, dcb

Example 8: A printed circuit board has 8 different locations in which a component can
be placed. If 5 components are to be placed on board, how many different designs are
possible if
(a) the components are identical?
(b) the components are different?

In part(a), since the components are identical, we just select a subset of 5 locations out
of the available 8 different locations to place the components. The number of possible
designs in this case is given by 8 C 5 .
As for part(b), the components are different which we means that we choose 5 locations
and in each location we choose which component to place. Consequently, the number
of different designs possible is 8 P5 .

Example 9: An 8-bit codeword is selected at random. What is the probability that it


contains at least 3 zero bits?

In this problem, we are counting the number of possible positions that are assigned zero
value. Here, we have a composite event
A  A 3  A 4    A8
where A i denotes the event that the selected codeword contains exactly i zero bits.
However, it is easier to work with the complementary event in this problem; that is,
3
A c  A 0  A1  A 2

The number of 8-bit codewords containing exactly two 0-bits is equal to 8 C 2 .


8
C2  1  8
The required probability is P(A )  1  .
28

Example 10: A bin of 50 manufactured parts contains 3 defective items. A sample of


size six is selected at random from the bin. What is the probability that the sample
contains exactly 2 defective parts?

For the sample space to be equi-probable, we need to assume that the contents of the lot
are distinct, equally likely elements {G1 ,, G 47 , D1 , D 2 , D3} , where Gi denotes a
good (non-defective) item and Di denotes a defective one. The two items are selected
in succession without replacement, since it has not been otherwise stated.

The sample space contains 50 C 6 elements (unordered selection), which is the number
of subsets of six elements out of fifty.

Define A as the event of obtaining two defective items and four good ones. The number
of elements in A is 3C 2  47 C 4 . The required probability is thus computed as
3
C 2  47 C 4
P( A ) 
50
C6

You might also like