6 Counting Techniques
6 Counting Techniques
COUNTING TECHNIQUES
This chapter introduces the different techniques on how to determine the number of elements contained
in a finite set or simply the cardinality of a finite set. These techniques will be very useful in the obtained
probabilities of events using the classical or a priori approach. Furthermore, this chapter also discussed the
difference between a denumerable and a non-denumerable set which is related to the two main types of
random variables such as discrete and continuous. This will be explained further in Stat 121.
6.1 Cardinality
Definition:
Theorems:
1. A={1,2,3,4,5} B={2,4,6,8,10}
2. A = {1,2,3} B={1,2}
A is not equivalent to B.
Note: Two finite sets are equivalent if and only if they contain the same number of elements.
6. A = [0,1] B = (0,1)
1
Let f(x) = xID(x) + 1/2I{0}(x) + 1/3I{1}(x) + I C {0,1} ( x).
1
2
x
f:AB is both one to one and onto.
1. A = (0,1) B = (c,d)
2. A = [c,d] B = (c,d)
3. A = [0,1] B = [0,1)
4. A = [0,1) B = [c,d)
5. A = [c,d] B = [c,d)
6. A = set of positive integers B = set of negative integers
7. A = set of positive integers B = set of even integers
8. A = set of positive integers B = set of odd integers
9. A = set of positive integers B = set of positive rational numbers
10. A = set of positive integers B = set of all rational numbers
Definition:
A set A is infinite iff there exists a set B such that B is a proper subset of A and B~A. Otherwise, a
set is finite.
Examples:
1. A=[0,1] is an infinite set. Consider B=(0,1). B is equivalent to A as shown in the previous section. B is a
proper subset of A because all elements in B are in A; however, 0 and 1 belong in A but are not in B.
Remarks:
If A is a finite set then it is impossible for us to find a proper subset of A that is equivalent to A. This is
because two finite sets will be equivalent if and only if they have the same number of elements. But the
number of elements in any proper subset of A will always be smaller than the number of elements in A
because there are elements in A that are not in its proper subset.
Definition:
If a set D is equivalent to the set of positive integers then D is called denumerable or countably
infinite. A set is called non-denumerable if it is infinite and if it is not equivalent to the set of positive
integers.
Examples:
Denumerable Sets Non-denumerable sets
Set of positive integers Set of all real numbers
Set of negative integers (0,1) [0,1] [0,1) (0,1]
Set of nonnegative integers (x,y) [x,y] [x,y) (x,y], x<y
Set of all integers (-,x) (-,x] (x,) [x, )
Set of even integers
Set of odd integers
Set of positive rational numbers
Set of negative rational numbers
Set of all rational numbers
Definition:
The cardinal number of a set A (or, simply, cardinal) is denoted by #(A) or n(A). If A is a finite set
then n(A) is called a finite cardinal and is equal to the number of elements in A. The cardinal of any set
equivalent to the set of positive integers is denoted by o (read as aleph null). The cardinal of sets
equivalent to [0,1] is c and is said to have the power of the continuum.
Suppose an experiment can be divided into 2 stages. Then if the first stage of the experiment can
result in n distinct possible outcomes and if, for each outcome of the first stage, there are m distinct possible
outcomes, then there are nm possible outcomes of this experiment.
Define A = {(x,y) | x {1,2,…,n} and y{1,2,…,m}}. Hence, A is the set of all possible outcomes of an
experiment divided into 2 stages. Then, n(A) = nm.
More generally, suppose an experiment can be divided into r stages. If the first stage may result in any
of n1 possible outcomes, and if for each of these n1 possible outcomes there are n2 possible outcomes in the
second stage, and if for each of the possible outcomes of the first 2 stages, there are n3 possible outcomes in
the third stage, and if,…, then there are a total of n1n2n3…nr possible outcomes of the experiment.
Define B = {(x1,x2,…,xr) | xi {1,2,…,ni} for all i = 1,2,…r }. Hence, B is the set of all possible outcomes
r
of an experiment divided into r stages. Then, n(B) = n1n2…nr = n .
j 1
j
Examples:
1. If a man has red, green and gold shirts and red, green and gold neckties, how many ways can he choose
different colors for his shirt and necktie?
A = {(x,y): x{R,G,Au} and y{R,G, Au}}. The first coordinate of the ordered pair, x, represents the color of
the shirt selected while the second coordinate, y, represents the color of the necktie selected.
2. From a menu containing 3 soups, 2 salads, 6 entrées, and 3 desserts, how many different dinners can be
ordered?
3. How many 3-digit numbers can be formed from the digits 1,2,5,6 and 9
b) how many ways can a student answer all the 5 questions incorrectly?
Exercise:
1. How many different 7-place license plates are possible if the first 2 places are for letters and the other 5 for
numbers? what about if no letter or no number can be repeated in a single license plate?
2. John, Jim, Jay and Jack have formed a band consisting of 4 instruments. If each of the boys can play all 4
instruments, how many different arrangements are possible? What if John and Jim can play all 4 instruments
but Jay and Jack can play only the piano and drums?
3. How many different ways can a true-false test consisting of 10 questions be answered?
4. A child psychologist prepares four-letter words to be used in a memory test. How many words can she
construct if she does not repeat letters and limits her choices to the letters a, b, d, e, i, l, o, and p? How many
of these words begin with the letter a? How many have vowels as the second and fourth letters?
5. A freshman business student planning for his career has a choice of four fields of specialization –
accounting, economics, management, and marketing – and after graduation a choice of two services –
government and private. What is the total number of service-careers open to this student?
6. How many four-letter code words can be formed from the letters of the English alphabet if consonants and
vowels are to alternate and repetitions are not allowed?
7. How many five-digit numbers can be formed from the digits 1, 2, 3, 4, 5, and 6 if no repetitions are allowed?
Definition:
An ordered k-tuple of elements of a nonempty set Z, say (z1,z2,…,zk), with distinct components
(that is, zi zj) is called a permutation of k elements of Z.
A subset {z1, z2, …,zk} with k distinct elements of a nonempty set Z, is called a combination of k
elements of Z.
{1,2,3} {1,2,4} {1,2,5} {1,3,4} {1,3,5} {1,4,5} {2,3,4} {2,3,5} {2,4,5} {3,4,5}
There are k! distinct permutations associated with each combination. Here, k! represents the number of
ways in which you can arrange the elements that were included in the combination. In the previous example,
the 3! = 6 permutations associated with the combination {1,2,3} are: (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2),
(3,2,1).
If we are interested in determining the number of different ordered arrangements of k objects selected from n
distinct objects then we count the number of distinct permutations. However, if we are interested in
determining the number of different groups of k objects (where the order of selection is ignored) that can be
formed from n distinct objects then we count the number of distinct combinations.
Theorem.
Let Z be a set containing n> 1 distinct elements, and let k>1 be an integer. Then there are nk distinct
ordered k-tuples (z1,z2,…,zk) with ziZ, i=1,2,…,k,
Theorem.
Let Z be a set containing n> 1 distinct elements and let k<n, then there are (n)k permutations of k
elements of Z or distinct ordered k-tuples with distinct components of Z.
Theorem.
Let Z be a set containing n> 0 distinct elements and let k be an integer for which 0<k<n then there are
n
combinations of k elements of Z or distinct subsets of Z of size k.
k
Take note that is a collection of ordered 4-tuples whose coordinates are elements of Z. Thus n=6 (number
of elements of Z) and k=4 (number of coordinates in the ordered tuple).
n() = nk = 64
b) How many possible outcomes are there for which no two dice show the same number of spots?
Take note that A is a collection of distinct ordered 4-tuples with distinct components of Z.
c) How many possible outcomes are there for which all the spots are even?
d) How many possible outcomes are there for which no two dice show the same number of spots and no toss
results in a 1?
Since we are counting the number of different groups of k=5 objects that could be formed from a total of n=12
objects then we are counting the number of combinations. Therefore, the number of possible committees of
n 12
size 5 that can be formed is .
k 5
The experiment can be divided into 2 stages: (a) the selection of the men and (b) the selection of the women.
Then by the basic principle of counting, there are n1n2 possible committees where n1 = number of ways that the
men can be selected and n2 = number of ways that the women can be selected.
Exercise:
2. A class consists of 10 men and 20 women. An examination is given, and the students are ranked
according to their performance. Assume that no two students obtain the same score.
3. Five separate awards (best scholarship, best leadership qualities, and so on) are to be presented to
selected student from a class of 30. How many different outcomes are possible if
4. The game of bridge is played by 4 players, each of whom is dealt 13 cards. How many bridge deals are
possible?
Theorem.
The number of permutations of n distinct objects in a circle is (n-1)!
Theorem.
The number of distinct permutations of n things of which r1 are of the 1st kind, r2 are of the 2nd kind,…,rk
k
n!
are of the kth kind is
r1!r2 !...rk !
where r
i 1
i n.
Example: How many different letter arrangements can be formed using the letters P E P P E R?
n! 6!
There are possible letter arrangements
r1 !r2 !r3 ! 3!2!1!
However, if the 3 P’s cannot be distinguished from each other and the 2 E’s cannot be distinguished from each
other then the resultant letter arrangement would still be of the same form even if we permute the P’s among
themselves and the E’s among themselves. For instance, the same letter arrangement, PPPERE, can be
formed by any one of the following 3!2! = 12 permutations of the distinct P’s and E’s:
This is true for all the possible letter arrangements. That is, for each arrangement of the 6 letters, we can
always associate 3!2!1!=12 permutations if the 3P’s and the 2E’s can be distinguished from each other.
Theorem.
Let Z be a set which contains n distinct elements, and let r1, r2,…,rk be nonnegative integers such that Z
k
contains r elements.
i 1
i Suppose {Z1, Z2, …, Zk} is a distinct partition of Z where Zi contains ri elements,
n!
i=1,2,…,k then there are distinct partitions {Z1, Z2, …, Zk} of Z where Zi contains ri elements,
r1!r2 !...rk !
i=1,2,…,k.
Example:
Suppose Z={1,2,3,4}. How many distinct partitions {Z1,Z2,Z3} of Z can be formed if Z1 and Z3 contain 1 element
each and Z2 contains 2 elements?
n! 4!
There are =12 partitions where n = number of elements in Z
r1 !r2 !r3 ! 1!2!1!
ri=number of elements in the ith set of the partition, i=1,2,3
Take note that there are 4! permutations of the 4 elements of Z. Each partition is always associated with
1!2!1!=2 of these permutations. For instance, the two permutations, (1,2,3,4) and (1,3,2,4), are represented by
the partition {{1},{2,3},{4}}.
Exercise:
1. How many different signals, each consisting of 9 flags hung in a line, can be made from a set of 4 white
flags, 3 red flags, and 2 blue flags, if all flags of the same color are identical?
2. How many ways can twenty new applicants be assigned to the 5 committees of an organization so that
each committee will get 4 new applicants each?
4. How many ways can a man divide 7 gifts among his 3 children if the eldest is to receive 3 gifts and the
others 2 each?
5. In how many ways can 3 Americans, 4 Frenchmen, 4 Danes, and 2 Italians be seated at a round table so
that those of the same nationality sit together?
6. Consider the grid of points shown below. Suppose that starting at the point labeled A you can go one step
up or one step to the right at each move. This is continued until the point labeled B is reached. How many
different paths from A to B are possible?
7. How many ways can you order the letters of TORONTO if it begins with exactly two O’s?
8. How many ways can you order the letters from the word TREES if a vowel must be at the beginning?
9. How many ways can you order the letters from the word TREES if the R must be in the middle?
10. How many ways can you order the letters from the word TREES if consonants and vowels alternative?
Theorem.
If A1, A2, …, Ak are pairwise disjoint sets and n(Ai) = ni elements, i=1,2,…,k. then
k k k
n Ai n( Ai ) ni elements.
i 1 i 1 i 1
Corollary.
k k k
If each n(Ai) = n, then n Ai n( Ai ) n kn.
i 1 i 1 i 1
The corollary can also be proven using the basic principle of counting. The first stage involves selecting one
of the k sets (with k possible outcomes) while the second stage involves selecting one of the elements in the
selected set in Stage 1 (with n possible outcomes.) Thus, the total number of elements is kn.
1. If set Z = {1, 2,…,n}, how many sets belong in the power set of Z?
Let 2Z = power set of Z. The power set of Z can be expressed as the union of the following pairwise disjoint
classes: A i =class containing i elements of Z, i=0,1,…,n. That is, A 0 = {} , A 1 ={{1}, {2},…{n}},….An =
n
{Z}. The cardinality of each class, A i , is . Thus,
i
n n n
n
n(2Z) = n( Ai ) = n
n (A ) = i = (1 + 1)
i = 2n.
i 0 i 0 i 0
2. a) How many 3-digit numbers can be formed from the digits 1,2,3,4,5,6 if each digit can be used only
once?
b) How many among the 3-digit numbers in (a) are greater than 334?
3. Four married couples bought 8 seats in a row for a concert. In how many ways can they be seated:
a) with no restrictions?
A = {(x1,x2,…,x8): xi {A1, A2, B1, B2, C1, C2, D1, D2}, xixj for ij i,j=1,2,..,8}
where A1=male in Pair 1, A2=female in Pair 1, B1=male in Pair 2, B2=female in Pair 2, and so on
n(A) = 8!
B = set of ordered 8-tuples s.t. the A’s are together, and so with the B’s,C’s, D’s
Let k = number of ways of arranging the couples, that is, the number of possible ways of permuting A,B,C,D
n(B) = kn = 4!(2!2!2!2!)
d) If all the men sit together and all the women sit together?
D = set of ordered 8-tuples where A2,B2,C2,D2 are together and A1,B1,C1,D1 are together
Let k = number of ways of arranging the genders, that is, the number of ways of permuting M,F where M is
male and F is female
n(D) = kn = (2!)(4!4!)
Exercise:
1. How many ways can 3 boys and 3 girls line up for a bus,
a) without restrictions;
b) if the boys and the girls must be together;
c) if only the boys must be together;
d) if no two people of the same sex are allowed to be next to each other?
2. How many ways can 3 novels, 2 mathematics books, and 1 chemistry book be arranged on a bookshelf if”
4. A woman has 8 friends, of whom she will invite 5 to a party. How many choices does she have if 2 of the
friends are feuding and will not attend together? How many choices does she have if 2 of her friends will
only attend together?
a) How many 4-digit numbers can be formed from this set of digits if a digit can be used only once?
b) How many of the 4-digit numbers in (a) are less than 4000?
c) How many of the 4-digit numbers in (a) are greater than 4327?
Theorem.
Suppose is the universal set containing finite number of elements. If A and B are finite sets then
Example: An insurance company classifies its policy holders according to age, sex, and marital status. Of
500 policy holders, it was found that
Find n(M).
Find n(SCMCU).
Exercise:
1. A certain town of 100,000 has 3 newspapers: I, II, and III. The number of townspeople that read these
papers are as follows:
2. Suppose that in a freshman college class of 500 students, it is found out that 210 smoke, 258 drink
alcoholic beverages, 216 eat between meals, 122 smoke and drink alcoholic beverages, 83 eat between
meals and drink alcoholic beverages, 97 smoke and eat between meals, and 52 engage in all three of
these bad health practices.
Theorem.
Suppose an urn contains M balls, labeled 1 to M, and a sample of size n is drawn, then: there are:
Theorem.
Suppose an urn contains M balls, labeled 1 to M, and those labeled from 1 to K (K<M) are defective.
Define Ak=the set containing all possible ordered samples of size n which contains k defectives, k=0,1,2,…n.
Thus, Ak={(x1.x2,…xn) | k xi’s belong to {1,2,…,K} and n-k xi’s belong to {K+1,K+2,…,M}}.
n
(i) under sampling with replacement, n(Ak)= K k ( M K ) n k
k
n
(ii) under sampling without replacement, n(Ak)= ( K ) k ( M K ) n k
k
Illustration:
Suppose there are 30 balls and 10 of them are defective. Let the sample size be 15.
15
Under sampling without replacement, n(A2) = (10) 2 (20)13
2 .
Example:
1. Suppose an urn contains 10 balls, labeled 1 to 10, and those labeled from 1 to 4 are defective. Define
A2=the set containing all possible ordered samples of size 5 which contains 2 defectives.
5
n(A2) = (4) 2 (6) 3 = 34560
2
A2 is actually a set of ordered 5-tuples where 2 of the coordinates are defectives and the remaining 3 are non-
defectives.
n(A2) = kn
5
But k = (The process is like selecting 2 elements (positions) from Z = set containing all possible
2
placements = {1,2,3,4,5}.)
Consider the following arrangement, DDNNN , where D=defective and N=nondefective. The number of ways
of selecting the 2 defectives and 3 nondefectives is (4)(4)(6)(6)(6)= 3456. This is the same for all possible
arrangements of the defectives. Thus, n = 3456.
5
n(A2) = kn = (3456) 34560
2
5
n(A2) = (4) 2 (6) 3 = 14400
2
Using the basic principle of counting,
5
But k = .
2
Consider the following arrangement, DDNNN , where D=defective and N=nondefective. Since sampling is this
time performed without replacement, the number of ways of selecting the 2 defectives and 3 nondefectives is
(4)(3)(6)(5)(4)= (4)2(6)3 This is the same for all possible arrangements of the defectives.
5
n(A2) = kn = (4) 2 (6) 3
2
2. If a multiple-choice test consists of 10 questions each with 4 possible answers of which only 1 is correct,
how many possible ways can a student answer such that
The possible answers to a question will now serve as the balls. A correct answer is considered a defective ball
while an incorrect answer is a nondefective ball.
10 10 10
i 10i
n(A7 U A8 U A9 U A10) =
i 7
n ( Ai ) (1) (3)
i 7 i
n n
Note that Ak’s are pairwise disjoint. So, n Ak = n( A ).
k
k 1 k 1
7 7
10 i 10i
n(A0 U A1 U … U A7) =
i 0
n ( Ai ) (1) (3)
i 0 i
Exercise:
1. Suppose a group of 20 undergraduate students and 10 graduate students are available to fill certain
student government posts. If 6 students are to be randomly selected from this group,
2. Suppose a precinct consists of 150 voters, 100 of whom are women and the remaining 50 are men.
Suppose a sample of 25 voters will be selected in this precinct, how many possible (you may leave your
answer in formula form)
3. A die is tossed 100 times and the number of dots is recorded at each toss.
4. A lot of 7 articles contain one that is defective. In how many ways can one select 4 articles such that the
defective article is included? The defective article is not included?
Remarks:
If the n balls were distinguishable then there are rn possible ways of distributing these n balls. The outcomes
here are represented by ordered n-tuples whose ith coordinate indicates which urn the ith ball was placed.
o Illustration:
Let the number of distinct balls n=4 and the number of urns r=3. Thus, we have an ordered 4-tuple
(x1,x2,x3,x4) where xi represents which urn the ith ball was placed. For instance, (x1,x2,x3,x4)=(2,3,1,2).
This means that the first ball was placed to urn 2, the second ball was placed to urn 3, the third ball
was placed to urn 1 and the last ball was placed to urn 2.
If the n balls are now indistinguishable then an outcome can be represented by an ordered r-tuple
(x1,x2,…,xr), where xi denotes the number of balls that are distributed into the ith urn. Thus, the problem of
counting outcomes reduces to counting the number of ordered r-tuples where the coordinates xi are
r
nonnegative integers such that x
i 1
i n.
o Illustration:
Let the number of indistinguishable balls n=4 and the number of urns r=3. Thus, we have an ordered
3-tuple (x1,x2,x3) where xi denotes the number of balls that are distributed into the ith urn. For instance,
(x1,x2,x3)=(2,1,1). This means that there were 2 balls in urn 1, 1 ball in urn 2 and 1 ball in urn 3. Take
note that the total number of balls in the 3 urns is n=4.
In order to solve this problem, we begin by considering the experiment where n indistinguishable objects lined up in a
row are divided into r nonempty groups (that is, we are only considering the case where the coordinates xi > 0).
For example, n= 5 and r = 3. The possible ways of dividing these 5 objects in 3 groups are as follows:
x | x | xxx x | xx | xx x | xxx | x
xx | x | xx xx | xx | x xxx | x | x
These outcomes are represented by (1,1,3), (1,2,2), (1,3,1), (2,1,2), (2,2,1), and (3,1,1), respectively. What we
actually have done in each outcome is to select (r-1)=2 of the (n-1)=4 possible spaces between adjacent objects as
n 1
our dividing points. Thus, there are . The following theorem thus follows from this argument:
r 1
Theorem.
n 1
There are distinct ordered r-tuples, (x1,x2,…,xr), where xi is a positive integer, i=1,2,…,r that satisfies
r 1
r
x
i 1
i n.
r r
r r
x i n (y i 1) n y i r n yi n r .
i 1 i 1 i 1 i 1
n r 1 n r 1
Using the previous theorem, there are distinct ordered r-tuples, (y1,y2,…,yr) where yi is
r 1 n
r
a positive integer, i=1,2,…,r that satisfies y
i 1
i =n + r. This result can be stated as follows:
Theorem.
n r 1
There are distinct ordered r-tuples, (x1,x2,…,xr), where xi is a nonegative integer, i=1,2,…,r that
n
r
satisfies x
i 1
i n.
Example:
An investor has 20 thousand pesos to invest among 4 possible investments. Each investment must be in units of a
thousand pesos. If the total 20 thousand is to be invested, how many different investment strategies are possible?
What if not all the money need to be invested?
The 4 possible investments may be viewed as 4 distinguishable urn. A ball is a thousand pesos. Thus, there are 20
balls in this problem. We are actually counting the number of ordered 4-tuples (x1,x2,x3,x4) where the xi’s are
4
nonnegative integers such that x
i 1
i 20.
n r 1 20 4 1 23
Therefore, there are = 1771 possible investment strategies.
n 20 20
Let x5=amount that will not be invested. This time we are counting ordered 5-tuples where the xi’s are
5
nonnegative integers such that x i 1
i 20.
n r 1 20 5 1 24
Hence, there are =10626 possible strategies.
n 20 20
1. Ten identical apples are to be distributed among 4 children, how many divisions are possible? How many,
if each child must receive at least one apple.
3. If 8 identical blackboards are to be divided among 4 schools, how many divisions are possible? How
many, if each school must receive at least 1 blackboard?
4. If 8 new teachers are to be divided among 4 schools (each school must receive at least one teacher), how
many divisions are possible? What if each school must receive 2 teachers?
5. An elevator starts at the basement with 8 people (not including the elevator operator) and discharges them
all by the time it reaches the top floor, number 6. In how many ways could the operator have perceived the
people leaving the elevator if all people look alike to him? What if the 8 people consisted of 5 men and 3
women and the operator could tell a man from a woman?
6. Suppose there are 20 red apples, 15 green apples and 10 yellow apples. Let us assume that apples of the
same color cannot be distinguished from each other.