You are on page 1of 13

Topic X Counting

8
LEARNING OUTCOMES
By the end of this topic, you should be able to:
1. Explain the principles of counting and pigeonhole principle;
2. Use the principles of counting and pigeonhole principle in solving
some problems in Information Technology; and
3. Solve recurrence relation.

X INTRODUCTION
The second application of integer is for counting. In solving some
problems in Information Technology, we need to do some counting. For
example, we need to count the number of routes from one node in a
computer network to another node. In this topic, we will discuss several
tools for counting. The last section of this topic discusses briefly the concept
of recurrence relation since this concept is sometimes being used in counting.

8.1 BASIC PRINCIPLE OF COUNTING

SELF-CHECK 8.1
Is counting only about counting as „one‰, „two‰, „three?‰ Counting is
more than what you knew.

Two basic counting principles are M ultiplication Principles and Addition


Principles.
TOPIC 8 COUNTING W 99

8.1.1 Multiplication Principle

ACTIVITY 8.1
How can you apply the principles in this chapter in any gambling
game? Express your ideas.

Multiplication Principle:
If an activity can be constructed in t successive steps and step 1 can be done in
n1 ways, step 2 can then be done in n2 ways,  abd step t can then be done in nt
ways, then the number of different possible activities is n1. n2 . nt.

Example 8.1a

Suppose that a school has four academic societies (English Club, Mathematical
Society, Science Society and History Society) and three non-academic societies
(Police Cadette, Red Crescent and Debating Society). Suppose that every student
has to join one academic society and one non-academic society. How many
possible options is available to a student to choose?

Solution: This problem involves a two-step process.

First step is „select an academic society‰.


Second step is „select a non-academic society‰.
There are n1 = 4 ways to select the academic society and n2 = 3 ways to
select the non-academic society.

By the Multiplication Principle, there are 4 . 3 = 12 options. As confirmation, we


list the 12 options

English Police, English Red Crescent, English Debate,


Math Police, Math Red Crescent, Math Debate,
Science Police, Science Red Crescent, Science Debate,
History Police, Histroy Red Crescent, History Debate
100 X TOPIC 8 COUNTING

8.1.2 Addition Principle

Addition Principle:
Suppose that X1  Xt are sets and that the ith set X1 has n1 elements.
If {X1  Xt} is a pairwise disjoint family (i.e. if i z j, ) the number of possible
elements that can be selected from X1 or X2 or .. Xt is

n1 + n2 + . + nt

Example 8.1b

In how many ways can we select one book from different subjects among five
distinct computer science books, three distinct mathematics books, and two
distinct arts books?

Solution: Since these sets of selection are pairwise disjoint, we may use the
Addition Principle to conclude that there are

5 + 3 + 2 = 10

ways to selecting one book from different subjects among the computer
science, mathematics and art books.

8.1.3 Combining Principles


If we count objects that are constructed in successive steps, we use the
Multiplication Principle. If we have disjoint sets of objects and we want to know
the total number of objects, we use the Addition Principle. It is important to
recognize when to apply each principle. This skill comes from practice and
careful thinking about each of the problems.

Example 8.1c

How many eight bit strings begin either 101 or 111?

Solution: An eight bit string that begins 101 can be constructed in five successive
steps:
(i) select the fourth bit.
(ii) select the fifth bit.
TOPIC 8 COUNTING W101

(iii) select the sixth bit.


(iv) select the seventh bit.
(v) select the eighth bit.

Since each of the five bits can be selected in two ways, by Multiplication
Principle, there are

2 . 2 . 2 . 2 . 2 = 25 = 32

eight bit strings that begin 101. The same argument can be used to show that
there are 32 eight bit strings that begin 111. Since there are 32 eight bit strings that
begin 111, there are 32 + 32 = 64 eight bit strings that begin either 101 or 111.

Example 8.1d

A six person committee composed of Aisyah, Rizal, Azman, Azam, Ainee, and
Aiman is to select a chairperson, secretary, and treasurer. In how many ways
can this be carried out?

Solution: We use the Multiplication Principle. The officers can be selected in


three successive steps:
(i) select the chairperson
(ii) select the secretary
(iii) select the treasurer

The chairperson can be selected in six ways. Once the chairperson has been
selected, the secretary can be selected in five ways. After selecting the chairperson
and secretary, the treasurer can be selected in four ways. Therefore, the total
number of possibilities is

6 . 5 . 4 = 120.

Example 8.1e

In the example 8.1d, in how many ways can this be done if either Aisyah or Rizal
must be the chairperson?
102 X TOPIC 8 COUNTING

Solution: Arguing as in Example 8.1d, if Aisyah is the chairperson, we have 5 . 4 = 20


ways to select the remaining officers. Similarly, if Rizal is the chairperson, there are
20 ways to select the remaining officers. Since these cases are disjoint, by the
Addition Principle, there are

20 + 20 = 40

possibilities.

Example 8.1f

Refer to Example 8.1d. In how many ways can this be done if Ainee must hold
one of the offices?

First solution: If Ainee is the chairperson, we have 20 ways to select the


remaining officers. Similarly, if Ainee is the secretary, there are 20 possibilities,
and if Ainee is the treasurer, there are 20 possibilities. Since these three cases are
pair wise and disjoint, by the Addition Principle, there are

20 + 20 + 20 = 60

possibilities.

Second solution: Let us consider the activity of assigning Ainee and two
others to offices to be made up of three successive steps:
(i) Assign Ainee an office
(ii) Fill the highest remaining office
(iii) Fill the last office

There are three ways to assign Ainee an office. Once Ainee has been assigned and
the highest remaining office filled, there are four ways to fill the last office.
By the Multiplication Principle, there are

3 . 5 . 4 = 60 possibilities.
TOPIC 8 COUNTING W103

ACTIVITY 8.2

KLCCÊs Restaurant Menu


APPETIZERS
Fruit Platter RM5.00
Salad RM9.00
MAIN COURSES
Nasi Lemak with Rendang RM10.00
Special Cheese Burger RM8.00
Double Fish Fillet RM7.00
BEVERAGES
Milk RM6.00
Tea RM6.00
Fruit Juice RM8.00
Mineral Water RM5.00

1. Find the number of dinners at KLCCÊs Restaurant satisfying the


condition below
(a) One appetizer and one beverage
(b) One appetizer, one main course and an optional beverage
(c) An optional appetizer, one main course, and an optional
beverage

2. A man has eight shirts, four pairs of pants, and five pairs of
shoes.
How many different outfits are possible?

3. The options available on a particular model of a car are


(i) five interior colors
(ii) six exterior colors
(iii) two types of seats
(iv) three types of engines
(v) three types of radios
How many different possibilities are available to the customer?
104 X TOPIC 8 COUNTING

4. A six person committee composed of Aisyah, Rizal, Azman, Azam,


Ainee, and Aiman is to select a chairperson, secretary, and treasurer.
(a) How many selections exclude Azman?
(b) How many selections are there in which neither Rizal nor
Aiman is an officer?
(c) How many selections are there in which both Rizal and
Aiman are officers?
(d) How many selections are there in which Azam is an officer
and Aiman is not an officer?
(e) How many selections are there in which either Azam is
chairperson or he is not an officer?
(f) How many selections are there in which Azman is either
chairperson or treasurer?

8.2 PERMUTATION

Definition 8.2a: A permutation of n distinct elements X1, .xn is an order of the


n elements x1, .xn.

Example 8.2a

There are six permutations of three elements. If the elements are denoted A, B, C,
the six permutations are

ABC, ACB, BAC, BCA, CAB, CBA.

Theorem 8.2a:
The number of permutations of n elements is n !.
TOPIC 8 COUNTING W105

Example 8.2b
There are 24 permutations of four objects, since 4! = 4.3.2.1 = 24.

In some cases we need to find the number of permutations of n elements taken r


at a time.

Theorem 8.2b:
If 1 d r d n, then the number of permutations of n elements taken r at a time is
n(n  1)(n  2).(n  r + 1).

The number of permutations of n elements taken r at a time is sometimes denoted


as P(n,r) or nPr.

Example 8.2c
How many two letter words can be formed from letters in the set {a,b,c,d} if
repeated letters are allowed?

Solution: The two letter words are:

ab,ac,ad,ba,bc,bd,ca,cd,cd,da,db,dc
P (4, 2) = 43 = 12

Re-write: the above solution as Factorial:

n! 4! 4! 4<3< 2<1
P(n, r) = = = = = 12
(n - r)! (4 - 2)! 2! 2<1

ACTIVITY 8.3
1. A bank password consists of two letters of the English alphabet
followed by two digits. How many different passwords are there?
2. In a psychological experiment, a person must arrange a square, a
cube, a circle, a triangle, and a pentagon in a row. How many
different arrangements are possible?
3. A coin is tossed four times and the result of each toss is recorded.
How many different sequences of heads and tails are possible?
4. A fair six-sided die is tossed four times and the numbers shown are
recorded in a sequence. How many different sequences are there?
106 X TOPIC 8 COUNTING

8.3 COMBINATION

Definition 8.3a: A combination of n elements x1, .xn taken r at a time


is the selection of r elements where order does not count.

Example 8.3a

There are four combinations of four elements taken three at a time. If the
elements are denoted A, B, C and D, the four combinations are

ABC, ABD, ACD, BCD

Theorem 8.3a:

n!
The number of combination of n elements taken r at a time is
r!(n - r)!

Example 8.3c

How many committees of three can be formed from seven people?

Solution: Each committee is a combination of seven people taken three at a


time. Thus, the number of committees that can be formed is

7! 7 <6<5< 4<3<2<1
= = 35
3!(7 - 3)! 3<2<1< 4<3< 2<1

The combination of n elements taken r at a time is sometimes denoted as


C(n,r) or nCr.

Example 8.3d

In how many ways can we select a committee of two women and three
men from a group of five distinct women and six distinct men?
TOPIC 8 COUNTING W107

Solution: The combinations of two women can be selected from five women is

C(5, 2) = 10

and the combinations of three men can be selected from six men is

C(6, 3) = 20

The committee can be constructed in two successive steps:


(i) select the women
(ii) select the men

By the Multiplication Principle, the total number of committee is

10 . 20 = 200

ACTIVITY 8.4

1. In how many ways can a 6-card hand be dealt from a deck of 52 cards?
2. In how many ways can a committee of three faculty members and
two students be selected from seven faculty members and eight
students?
3. How many different 8-card hands with 5 red cards and 3 black
cards can be dealt from a deck of 52 cards?

8.4 PIGEONHOLE PRINCIPLE


The Pigeonhole Principle is normally being used in answering the following
question:

„Is there an item having a given property?‰

When the Pigeonhole Principle is successfully applied, the principle only tells us
that the object exists; the principle will not tell us how to find the object or how
many are there.
108 X TOPIC 8 COUNTING

8.4.1 First Form

Pigeonhole Principle  First Form:


If n pigeons fly into k pigeonholes and k < n, some pigeonhole contains a
least two pigeons.

Example 8.4a

Ten persons have first name Aisyah, Badrul, and Azman and last names Razak,
Farouq, and Adri. Show that at least two persons have the same first and last
names.

Solution: There are nine possible names for the 10 persons. If we think of the
persons as pigeons and the names as pigeonholes, we can consider the
assignment of names to people to be that of assigning pigeonholes to the
pigeons. By the Pigeonhole Principle, some name (pigeonhole) is assigned
to the least two persons (pigeons).

8.4.2 Second Form

Pigeonhole Principle  Second Form:


If f is a function from a finite set X to a finite set Y such that |X| >
|Y|, then f(x1) = f(x2) for some distinct x1, x2  X.

The second form of the Pigeonhole Principle can be reduced to the first form by
letting X be the set of pigeons and Y be the set of pigeonholes. We assign pigeon x
to pigeonhole f(x). By the first form of the Pigeonhole Principle, at least two
pigeons, x1 , x2 X, are assigned to the same pigeonhole; that is f(x1) = f(x2)
for some distinct x1, x2  X.
TOPIC 8 COUNTING W109

Example 8.4b

Show that if we select 151 distinct computer science courses numbered


between 1 and 300 inclusive, at least two are consecutively numbered.

Solution: Let the selected course numbers be

c1, c2, . c151

the 302 numbers consisting of (c1, c2, . c151) together with

c1 + 1, c2 + 1, . c151 + 1

range in value between 1 and 301. By the second form of the Pigeonhole Principle, at
least two of these values coincide. The numbers (c1, c2, . c151) are all distinct and
hence the number (c1 + 1, c2 + 1, . c151 + 1) are also distinct. It must be that one of (c1,
c2, . c151) and one of (c1 + 1, c2 + 1, . c151 + 1) are equal. Thus we have

ci = cj + 1

and course ci follows course cj.

ACTIVITY 8.5

1. Thirteen persons have first names Adri, Aisyah, and Firdaus and last
names Mohamed, Rashdan, Zairul, and Amir. Show that at least two
persons have the same first and last names.
2. It is possible to interconnect five processors so that exactly two
processors are directly connected to an identical number of
processors? Explain how this can be done.
3. An inventory consists of a list of 115 items, each marked „available‰
or „unavailable‰. There are 60 available items. Show that there are at
least two available items in the list exactly four items apart.
4. An inventory consists of a list of 100 items, each marked „available‰
or „unavailable‰. There are 50 available items. Show that there are at
least two unavailable items in the list either three or six items apart.
5. Eighteen persons have first names Nurul, Elyana, Badrul and
Ikhwan and last names Hafiz and Farid. Show that at least three
persons have the same first and last names.
110 X TOPIC 8 COUNTING

[1] This is an interesting site that makes you think a little bit more.
URL:
http://weasel.cnrs.humboldt.edu/~prompt/107/math107yz/semester1/Activiti
es/Discrete.html

[2] You can watch video, download notes and view some exam questions
with answers. Make sure you are on a high bandwidth connection to view the
video.
URL: http://www.aduni.org/courses/discrete/index.php?view=cw

[3] If you have extra time, read them. It is an interesting site to read about Math
and puzzles
URL: http://www.cut-the-knot.org/manifesto/MathAndPuzzles .shtml

You might also like