Discrete Mathematics
Discrete Mathematics
PART I: COMBINATORICS
CHAPTER 1
ELEMENTARY COUNTING PRINCIPLES
If a first task E can be per formed in n(E)= r ways, while a second task F can be
per formed in n(F)= t ways, and the two tasks (E and F) can not be accomplished
simultaneously, then either task E or F can be performed in:
n(EVF) = n(E)+n (F)= r + t ways.
Examples
1. Suppose there are 4 male and 3 female instructors teaching multivariable calculus in
our college. In how many ways can a student choose a calculus instructor in order to
take the course?
Solution: - The student is faced with two tasks. The task of either
(i) choosing a female calculus instructor or
(ii) Choosing a male calculus instructor.
1
Since the tasks E and F cannot be per formed simultaneously, then n(EVF) – the number
of ways of accomplishing either task E or F, by addition principle (AP), is :
n(EVF) = n (E) + n (F)
= 3+4
= 7.
Therefore, the student can choose one instructor teaching multivariable calculus in
7 ways ///
2. If C is the task of choosing a positive composite number less than 10 and O is the task
of choosing a positive odd number less than 10, then C can be performed in
n(C) = 4 ways since C= {4,6,8,9}. The task O can be performed in n(O)= 5 ways,
Since O = {1, 3, 5, 7, 9}. However, C or O cannot be accomplished in
n(C) + n(O) = 4+5 =9 ways
This is because 9 is both a composite and an odd number less than 10. Hence there is a
possibility of performing the two tasks C and O simultaneously, which show that the
addition Principle is not applicable.
In fact, C or O can be performed in only
4 + 5 – 1 = 8 ways ///
Generalization of AP
Suppose a first task E1 can be performed in n(E1) = r1 ways, a second task E2 can be
performed in n(E2) = r2 ways, a third task E3 can be performed in n(E3) = r3 ways, etc,
and an nth task En can be performed in n(En) = rn ways. If no two of the tasks can be
performed at the same time, then the number of ways in which any one of tasks E1 or E2 or
E3 or ---, or En can be performed is:
If an operation consists of two separate steps E and F, and if the first step E can
be performed in n (E) = r ways and corresponding to each of these r ways , there
are n (F) = t ways of performing the second step F, then the entire operation can
be performed in:
2
Examples
1. A room in a building has four doors that may be designated as Door A, B, C and D. If
a person is interested in entering the room and leaving it by a different door, then in
how many possible ways can be fulfill his interest?
Solution: - To handle problems of this nature, it helps to have a TREE DIAGRAM of the
following form.
Entrance Exit
B
A C
D
A
B C
D
A
C B
D
D A
B
C
Figure 1.1.
Note that the tree diagram takes order to account. Thus, AB and BA count as two
different possibilities or arrangements. The first one refers to the possibility that one
enters the room through door A and leaves through door B, while the second describes
the process of entering through door B and leaving through door A. Order is the essence
of such arrangements, and any change in order yields a completely different arrangement.
The diagram shows that there are four branches corresponding to the entrances in
to the room through the four doors A, B, C and D; and that subsequent to (or following)
one’s entry into the room through one of the doors, there are only three doors left and one
can use any of the three doors for exit. For instance, if one enters through door A, then
one is free to leave the room through one of the remaining doors B, C, or D. Thus, we
find that there are in all 12 different paths along the branches of the tree corresponding to
the 12 different ways in which one can enter the room by one door and leave by another.
On the other hand, the data in the problem implies that there are
4 Possible entrances into the room.
Corresponding to each of these entrances, there are
3 possible exits from the room.
Thus, using the following rule called multiplication principle, we find that there are:
4 x 3 = 12 ways of entering the room by a door and leaving by another.
3
2. Suppose a bus line offers 8 routes between New York and Los Angeles. If a visitor
from New York goes to Los Angeles and then return by a different route, how many
possible routes can the visitor assume for the round trip?
Solution: - The round trip between New York and Los Angles is the task (or the
operation); and it is done in two steps
suppose;
E1 = choosing a route from New York to Los Angles
E2 = Choosing a route from Los Angles back to New York
Then;
n (E1)= 8 and n (E2) = 7
Generalization of MP
3. Suppose a restaurant menu offers a choice of three soups, five meat dishes, four
desserts, and a choice of coffee, tea or milk. In how many ways can one order a meal
consisting of a soup, a meat dish, desert and a beverage?
Solution
Here our operation is ORDERING A MEAL. This operation consists of 4 separate steps.
Suppose
The first step E1 = choosing a soup
The second step E2 = choosing a meat dish
The third step E3 = Choosing a desert; and
The fourth step E4 = choosing a beverage
Then;
n(E1) = 3, n(E2) = 5, n(E3) = 4 and n(E4) = 3 and by EMP, one can order a meal
consisting of a soup, a meat dish, a dessert and a beverage in.
n (E1) . n (E2). n(E3). n(E4) = 3 x 5 x 4 x 3 = 180 possible ways ///
In order to establish these ideas clearly and profoundly it will be helpful to under
take a few more illustrative examples.
4
4. How many numerals, each with two digits, can be formed from the five digits, 1,2,3,4
and 5 so that no digits are repeated?
Solution
To form numeral of two digits, we have to fill two places, the ten’s and the unit’s.
Apparently, there are five ways of filling the ten’s place because any one of the digits
1,2,3,4, or 5 can be placed in this position. Since no digit can be repeated, the unit’s place
can be filled with any one of the remaining four digits. From the multiplication rule, it
follows that the two places can be filled in 5 x 4 = 20 ways, as shown beneath.
12 13 14 15
21 23 24 25
31 32 34 35
41 42 43 45
51 52 53 54
5. In how many ways can five books on different subjects be placed on a shelf?
Solution
The problem requires the filling of five places. Any one of the five books may be placed
first on the shelf; four books are left and there are four ways of placing the second book
on the shelf; no matter which of the five books was used to fill the first place. The first
two places can, there fore, be filled in 5x4 =20 ways. Now, there are three books yet to be
arranged and any one of them can occupy the next (or third) place on the shelf. Thus, the
first three books can be placed in 5 x 4 x 3 = 60 different ways. Following this reasoning
and the extension of MP, we see that all the five books can be arranged in:
5x4x3x2x1 = 120 different ways on the shelf ///
Solution
Assuming that the computer makes no distinction between the upper case letters (A, B, C
---, Z) and the lower case letters (a, b, c, ---, z), it follows that there are:
26 variable names consisting of a single letter. For the variable names with a
single letter followed by a single digit, we have to fill two places; the first by a letter and
the second by a digit. There are 26 letters for the first place and 10 digits (0,1,2, ---,9) for
the second place. Thus, from MP, we can form:
5
EXERCISES 1.1
1. A salesman has eight shirts, 4 suits and 10 ties. How many different combinations
of a suit with a shirt and a tie can he wear?
2. There are four different routes connecting city A to city B. In how many ways can
a round trip be made from A to B and back?
3. A businessman is planning to go from New York to Chicago with one stop-over at
Pittsburgh. He has a choice of a plane, a train, or a bus from New York and a
choice of train or bus from Pittsburgh. Draw a tree diagram indicating the
different choices for making a complete trip to Chicago?
4. From the digits 2,3,4,5,6 and 7, a two-digit numeral is formed so that no digit is
repeated. How many such numerals are possible? Of these, how many are even
numbers?
5. The nominations for officers of the mathematics association of Ethiopia consist of
five candidates and three are to be elected. In how many ways can a president,
Secretary, and treasurer be elected?
6. In how many ways can five students be seated in a classroom with 20 disks?
7. How many three-digit numerals can be formed from the digits 4,5,6,7 and 8 if no
digit is repeated?
8. Given five flags of different colors, how many different signals can be made by
hoisting them on a vertical staff if
(a) three flags are used for each signal?
(b) at least two flags must be used for each signal ?
9. How many numerals can be formed by using all the digits 2,4,5,7 and 9 with no
digit being repeated? How many of these numbers are multiples of 5? How many
of these are even? How many of these are greater than 70,000? How many of
these are less than 50,000?
10. In how many ways can a 10 True/False examination question be answered?
11. A state report on crime consists of eight volumes numbered 1 to 8. In how many
ways can these volumes be placed on a shelf?
Definition 1: if n pigeonholes are occupied by n+1 pigeons then at least one pigeonhole
is occupied by more than one pigeon.
Examples:
6
Examples:
1. Find the minimum number of students in a class to be sure that three of them are
born in the same month.
Solution:
2. Suppose a laundry bag consists of many red, white, and blue socks. Find the
minimum number of socks that one need to grip in order to get two pairs (four
socks) of the same color.
Solution:
Exercises 1.2:
7
1.3 PERMUTATIONS
In this section, we will show that the multiplication rule (multiplication principle)
provides a general method for finding the number of permutations of n different things
taken r at a time. Many types of problems of permutations can be shortened by means of
convenient symbols and formulas we now introduce.
Definition 1:- The product of the first n consecutive positive integers is called n-factorial
denoted by n! and defined as:
n!= 1x2x3x4x --- x(n-1)x n = nx(n-1)x ---x3x2x1
Note that:
(i) 6! = 6x5! (ii) 7! = 7x6! (iii) 200! = 200x199!
In general;
n! = n(n-1)!
Proof: - The proof follows directly from the multiplication principle. Apparently, objects
are to be chosen from a collection of n objects one at a time. The first objects is selected
at random from a set of n distinct objects, the second from a set of (n-1) remaining
objects, the third from a set of (n-2) remaining objects, and so on, until finally, the rth
object is chosen from the set of [n- (r-1)] = (n-r+1) remaining objects. From the
multiplication principle, it follows that r objects are selected in:
n(n-1) (n-2) --- (n-r+1) ways
But this product is, by definition, the number of permutation of n objects taken r at a
time.
Thus;
n
pr = n(n-1) (n-2) … (n-r+1)
(n r )(n r 1) ... 3 x 2 x1
= n(n-1) (n-2) --- (n-r+1).
(n r )(n r 1) ... 3 x 2 x1
n(n 1)(n 2) ... (n r 1)(n r )(n r 1) ... x 2 x1
=
(n r )(n r 1) ... 3 x 2 x1
Clearly, the numerator is the product of the integers from n down to 1, while the
denominator is the product of the first (n-r) integers, so that
n n!
pr
(n r)!
n
pr n(n 1)(n 2) (n r 1) or
n n!
pr
(n r)!
Examples
9
2. Solve for n in each of the following
(a) np2 = 56 (b) np3 = 20 n(Exercice)
n!
Solution : (a) np2 56 56... by definition
(n 2)!
n(n - 1) (n - 2)!
56
(n 2)!
n 2 n 56
n 2 n 56 0
(n 7)(n 8) 0
n 7 v n 8
n = -7 is rejected since n N u {0}. Thus, the value of n= 8 ///
3. How many “words” of three letters can be formed from the letters a,b,c,d, and e, using
each letter only once?
Solution:- Since the letters a,b,c,d,e in different orders constitute different “words”, the
result is the number of permutations of five objects taken three at a time. Thus, by
principle of permutation without repetition, there are:
5 5 5!
p3 5 x 4 x3 60 words ///
(5 3)! 2!
4. What is the number of ways in which six students be seated in a classroom with 25
desks?
Solution: - There are six students that are going to occupy six desks at a time. Thus, there
are six seats to fill and 25 desks to choose from. The result is the number of permeations
of 25 different objects taken six at a time, i.e., n= 25 r=6 and
25 25! 25!
p6 25 x 24 x 23x 22 x 21x120
(25 6)! 19!
127,512,000 ways ///
5. In how many ways can six pupils stand in a line or linearly arranged to pay their
college fees at the finance office counter?
10
Remark:- In general, the number of permutations of n objects taken all at time (or taken
altogether) is:
n
pn n!
6. In how many ways can n married couples stand on a line alternating man-woman-
man- … -woman? If no same sex stands neighborly, find the number of arrangements.
EXERCISE 1.3.1
1. Evaluate each of the following
12 !
(a) 8! (b) 5p5 (c) 9p2 (d) np2 (e)
5!
2. Solve for n in each of the following.
(a) np2 = 56 (b) np3=20n (c) np4=88x n-1 p2
3. Show that:
(a) npr= n x n-1 pr-1
(b) npr =(n-r+1)x npr-1
(c) npr = n-1 pr+ r ( n-1pr-1)
4. How many “words” can be formed from the letters of the words:
(a) Seat? (b) Globe? C) Payment?
5. How many “words” can be formed from the letters of the word SPECTRUM
taken:
(a) three at a time? (b) five at a time? (c) altogether?
6. How many license plates bearing two letters of the alphabet followed by four
digits can be formed if:
(a) repetition of letters and digits are not permitted?
(b) repetition of letters and digits are permitted?
7. (a) In how many ways can the letters of the word SOCIAL be arranged?
(b) How many of the arrangements in (a) begin with S?
(c) How many permutations in (a) begin with S and end in L?
(d) How many of the arrangements in (a) have O and C together?
8. In the Holiday Inn, six rooms in a row are to be assigned at random to six guests,
two of who are from Dire Dawa. What is the number of possible arrangements so
that the guests from Dire Dawa are assigned rooms side by side?
9. There are eight invited guests to be seated in eight seats arranged in a row. How
different linear seating arrangements are possible if:
(a) the invitation is accepted by six guests?
(b) The invitation is accepted by all the eight guests and two particular guests
insist on sitting side by side?
(c) The invitation is accepted by all the guests but two particular guests wish
not to be seated next to each other?
11
10. How many five-digit integers can be formed from the digits 0, 1, 2, 3, 4, and 5, no
digit being repeated?
11. Seven students are to take an examination, two in Mathematics and five in other
subjects. In how many ways can these seven students be seated in one row so that
the two students taking the mathematics exam do not sit together?
12. Four married couples have eight seats in a row for a certain show. In how many
different ways can they be seated? What is the number of seating arrangements if
all the men are to sit together and all the women are to sit together?
13. An inspector visits six different machines during the day. In order to prevent the
operators from knowing when he will inspect, he varies the order of his visits. In
how many ways can this be accomplished?
Examples
1. A multiple-choice test has 100 questions with four possible answers for each question.
How many different sets of 100 answers are possible?
2. In how many ways can five prizes be given away to four boys
(a) When each boy is eligible for all the prizes?
(b) When any boy may win all but one of the prizes?
Solution: - (a) There are 4 ways of giving away the first prize (to either boy1, boy2,
boy3, or boy 4). There are again four ways of disposing the second prize since it can be
given to any one of the four students; and so on. Finally, the 5th prize can be disposed in 4
ways. Thus, the required number of permutations is 45= 1024 ///
(b) Since there are only four possibilities in which a student may have all the
prizes, the number of permutations in this case is four less than that for case (a), that is:
45- 4 = 1024 – 4 = 1020 ///
3. How many positive numerals less than 1000 can be formed from the digits 0, 1, 2, 3,
and 4 when digits may be repeated?
Solution: - There are three places to be filled and there are five choices for filling each
place. In other words, n=5 r=3, and the number of possibilities is 53. Excluding the
number 0, we have 53-1=124 numerals less than 1000.
4. A combination lock consists of four rings each marked with the five digits 1,2,3,4 and
5. What is the largest possible number of unsuccessful attempts in opening the lock if
one tries to guess the combination?
Solution: - Each of the four rings can be set in a position in five ways. Here, n=5 and
r=4, so that the number of all positions in which rings can be set is:
12
54=625 ways.
Since one of these is the correct combination, then the largest possible number of
unsuccessful attempts in opening the lock is; then:
54-1=625-1=624 ways ///
EXERCISE 1.3.2
1. For the five objects denoted by a, b, c, d, and f, list all permutations of these
objects taken two at a time without repetition.
2. There are three plumbers listed in a town telephone directory. On a certain
Saturday evening, six residents of the town need a plumber. If each resident is
free to call any plumber and all of the plumbers are available, what is the
maximum number of possible telephone calls that can be made by these six
residents?
3. Grades A, B, C, D, and F are assigned to a class of five students in Mathematics.
In how many ways can these students be graded if no two students receive the
same grade? How many ways are there to grade the students if only A or B is
assigned to each?
4. Consider an Urn containing four balls, numbered 1 to 4. What is the possible
number of ways of drawing three balls at random:
(a) without replacement?
(b) with replacement?
5. How many four-letter words can be made from a set of 10 different letters if:
(a) any letter may be repeated any number of times?
(b) a letter may not be repeated?
6. How many three-digit numbers can be formed from the digits 2, 3, 4, 5, and 6 if
(a) a digit may be repeated any number of times?
(b) a digit may not be repeated?
7. How many five-digit numerals can be formed from the digit 0, 1, 2, 3, and 4 when
a digit may be repeated any number of times and 0 is not allowed as a first digit?
8. A multiple- choice test has 20 questions with three possible answers for each
question.
(a) How many different sets of 20 answers are possible?
(b) In how many ways will all the answers be correct?
(c) In how many ways will all the answers be wrong?
(d) In how many ways will at least one answer be correct?
9. How many subsets (including the empty set and the set itself) can be formed from
a set of:
(a) eight different objects?
(b) 12 different objects?
(c) n different objects?
The number of permutation of n objects taken all together and where p of the n
objects are alike and of one kind; q others are alike and of another kind, and so on, up to t
others alike and of still another kind such that p+q+---+t = n, is given by:
13
n!
p(n; p, q,..., t )
p!q!...t!
Proof: - Suppose that m is the total number of the required permutations. In any of these
arrangements, replace the p like objects by unlike letters, say a1 a2, … , ap different from
any of the remaining objects. These p new letters can be arranged among themselves in p!
new permutations, and if the corresponding changes are made in each of the q like objects
and replaced by unlike letters b1, b2, … bq, then these letters can be permuted in q! ways.
Thus, the total number of permutations would be:
m x p! x q!
Proceeding along these lines (with all like objects in the collection), the total number of
arrangements would be given by:
m x p!x q! x … x t!
But the letters now are all different and n in number, and thus they may be arranged in n!
permutations. Hence,
m x p! x q! …x t! = n!
The required number of permutations X is thus given by
n!
m ///
p!q!...t!
n!
Therefore, p (n; p, q, …, t) =
p!q!...t!
Examples
1. In how many ways can 10 cars be placed in a stock car race if three of them are
Chevrolet, four are Fords, two are Plymouths, and one is a Buick?
Solution:- Here, n = 10, p = 3, q=4, r = 2, and t =1. The number of distinct arrangements
or permutations is given by:
10 !
P (10 ;3 , 4 , 2 , 1) 1260 ///
3 ! 4! 2!1!
2. How many signals can be given using 10 flags of which two are red, five are blue, and
three are yellow?
Solution: - Clearly, n=10, p =2, q= 5 and r=3. Hence, the number of signals is:
10!
P (10;2,5,3) 2520 ///
2! 5! 3!
EXERCISE 1.3.3
1. Twelve students are traveling to Boston in three cars such that three students are
in car1, four in car 2, and five in car 3. How many possible ways are there to do
this?
14
2. In how many ways can 15 accounts be assigned to three accountants so that four
accounts go to one accountant, five to the second accountant and six to the third
accountant?
3. How many arrangements (or permutations) can be formed from the letters of the
words:
(a) Massachusetts? (b) Mississippi? (c) Boston? (d) Conference?
4. (a) How many arrangements can be formed form the letters of the word
MUHAMMADAN?
(b) How many of these permutations have all A’s together?
(c) How many of the permutations of 4 (a) have none of the M’s together?
CIRCULAR PERMUTATIONS
From linear arrangements discussed so far, we know that five persons invited for dinner
may set themselves in a row in any of 5!= 120 different ways. The answer would be
different if the guests were to be seated around a circular table. Denoting the guests by
the letters A, B, C,D, and E, we assume that one of the possible ways in which the guests
can be seated around the circular table is as shown in fig. 1.2 below- which is the
arrangement ABCDE.
A
B
B E C A
C D E
D
Figure 1.2
Figure 1.3
Starting with the letter B and reading in a counterclockwise direction, we get the
arrangement BCDEA, shown in fig 1.3. But the arrangement in fig 1.3. can be obtained
by a simple clockwise rotation from the arrangement in fig.1.2. These two arrangements
are identical when regarded as a circular permutation, although, they are different linear
arrangements, In similar manner starting with the different letters and reading them in a
counter clockwise direction, the various possible seating arrangements so obtained may
be expressed as:
ABCDE BCDEA CDEAB DEABC and EABCD
Although these are different linear permutations, note that they are the same when
regarded as a circular arrangement. Thus, a single circular permutation of the five letters
results from five different linear permutations. If the required number of circular
permutations of the 5 letters is C, then the total number of linear arrangements of these
persons, represented by the five letters, is 5C. We have established earlier that five
persons can be seated in a linear arrangement, taken altogether, in 5p5 =5! different ways.
Hence,
5 C=5!
15
5! 5 x 4!
C
5 5
C 4!
Thus, the number of ways in which five persons can be seated around a circular table is
4!. Similarly, the number of circular arrangements (or permutations) of n persons is given
by:
C= (n-1)!
This seems natural, for the seats are not numbered, there is no first or last seat at a round
table, and the only essential feature to be considered is the neighbors, i.e., the position of
one person relative to the others sitting at the same table.
If one person, among the n, is fixed at random it follows that the remaining
(n-1) – persons can be arranged among the selves in (n-1)! different ways. This approach
also gives:
C= (n-1)!
as the number of circular permutations of n-persons . Thus the following proposition.
The number of permutations of n objects around a circle, taken altogether, is given by:
C= (n-1)!
Examples
1. In how many ways can eight gents (gentlemen) and eight ladies be seated for a round-
table conference so that no two ladies sit together?
Solution: - The number of ways in which the eight gents can be seated at a round table
occupying alternate seats is given by:
C= (n-1)! = (8-1)!= 7! Ways
Then the ladies have a choice of eight remaining seats and this arrangement can be
completed in 8! different ways. Now, using the fundamental principle of multiplication,
we conclude that the required number is:
7!x 8! = 5040 x 40320
= 203,212,800 ways .
2. In how many ways can eight gents and seven ladies be seated for a dinner around a
circular table so that no two ladies sit together?
Solution: - As it was in example 1.22, the number of ways in which the eight gents can
be seated around the circular table is 7! Ways. Now, the ladies have a choice of eight
places so that no two ladies are together. Thus the sitting- arrangement of the seven ladies
on eight seats is, apparently, the permutations of 8 objects taken 7 at a time. The
arrangement of the ladies can, there fore, be completed in 8p7 = 8! Ways. From the
fundamental principle of multiplication, we conclude that the required number of circular
permutation is
C= 7! x 8p7 = 203,212,800, ways .
16
3. (i) In how many ways can 10 children sit in a merry-go-round relative to
one another?
(ii) In how many of this arrangement shall some children have different children in
front of them? (Hint: - The merry-go-round can revolve in either direction)
Solution: - (i) We have 10 children and hence n= 10. Thus the number of ways that these
children sit in a merry-go-round is the number of circular permutations given by:
C= (n-1)!
C= (10-1)! = 9! =362,880 ways.
(ii) Some children will have different children in front of them in half the
above arrangements. That is, the required number of circular permutations
for this case is:
EXERCISE 1.3.4
1. In how many different ways can six ladies be seated at a round table?
2. In how many ways can four persons be seated at a round table so that all persons
do not have the same neighbors in any two arrangements?
3. In how many ways can six keys be placed on a key ring?
4. In how many ways can 12 persons form a “ring” if three of them must be
adjacent?
5. In how many ways can eight beads of different colors be arranged (a) in a
necklace? (b) in a row?
6. In how many ways can eight children at a birthday party be seated at a round table
if two of the children ask to be seated next to each other?
7. (i) In how many ways can nine different television sets be arranged in a row so
that no two particular sets are together?
(ii) If there are five black-and-white and four color sets, in how many ways can
they be arranged in a circle so that no two color sets are together?
8. In how many ways can 12 children at a birthday party be seated:
a) Around a circular table?
b) Around a circular table such that some children have different neighbors?
c) On the same side of a rectangular table?
9. There are five gentlemen and five ladies to dine at a round table. In how many
ways can they be seated so that no two ladies are together?
10. In how many ways can five gents and four ladies be arranged for a round-table
conference if no two ladies are in adjacent seats?
17
1.4. COMBINATIONS
In previous sections, we obtained formulas which enabled us to count the number of
ways in which r objects can be arranged in a row or a circle from a set of n different
objects. There are many problems that require us to make a selection of r objects from the
set of n objects without any regard to the “order”.
In a permutation, order is taken into consideration, while in combination
problems; the order is of no significance.
Definition: - Any subset of r objects selected with complete disregard to their order from
a collection of n different objects is called an r-combination of the n objects or a
combination of n objects taken r at a time.
The number of r- combination of n objects is frequently denoted by either
n n n
r or cr. The symbols, C(n,r), Cn,r and Cr also appear in various texts.
Examples
1. Find the number of combinations of the four objects a, b, c, & d taken three at a time.
. 3! p(4,3)
4
3
p(4,3)
4
3
3!
4! 4!
But p (4,3) 4x3x2 24 and 3! 1x2x3 6
(4 - 3)! 1!
There fore,
p(4, 3) 24
(43 ) 4 as noted in table 1.1 beneath.
3! 6
Combination 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
Table 1.1
18
Proposition 1 (number of r-combinations)
Proof: - Note that nr represents the number of combinations of n objects taken r at a
time. Each such combination of r objects can be arranged in r! different ways. There fore,
r!( nr ) yields the total number of permutations of n objects taken r a time, or
r ! ( nr ) n p r
By proposition 1.1 and dividing throughout by r!, we obtain:
n
pr n!
n
r
r!
r!(n r )!
2. In how many ways can a committee of five be chosen from a group of 10 members of
an association?
Solution: - (a) The number of combinations of 13 players, taken 11 at a time, is given by:
1311 13! 13x12 78 ways ///
11! 2! 2 x1
(b) If one particular player is always to be included, we need to select 10 more out
of the remaining 12. This can be accomplished in:
1210 12! 12 x11 66 ways ///
10! 2! 2 x1
(c) If one player should be excluded from the team, we need a selection of 11
players from the remaining group of 12. Thus, the required number of such
combinations is:
1211 12! 12 12 ways ///
11! 1! 1
4. There are 16 points in a plane, no three collinear. Determine the number of straight
lines that can be formed by joining them.
19
Solution: - Any two distinct points determine one straight line, uniquely. Hence, the
required number of straight lines is given by:
162 16! 16 x15 120 ///
2! 14! 2 x1
Solution: - The Republicans can be chosen in 72 ways, while Democrats can be
selected in any of the 92 ways. An application of the multiplication rule yields:
7! 9! 7 x6 9 x8
7 9
2 2 x x
2! 5! 2! 7! 2 x1 2 x1
21x36 756 ///
6. In how many ways can p + q objects be divided into two groups containing p and q
objects, respectively?
Solution: - Each selection of p objects for the first group leaves the remaining q objects
to be placed in the second group. Hence, the required number of combinations is given
by:
p q ! q! p q ! ///
p q q x
p q p! q! q! 0! p! q!
Solution: - Evidently, there are m n ways of selecting m friends for the first table.
m
These m people can be seated at the first round table in (m-1)! ways. These leave n
persons for the second table, where there are nn ways of selecting n friends and (n-1)!
ways of arranging them around the 2nd circular table. Thus, the seating arrangements at
the first and second circular table can, respectively, be completed in:
m n (m 1)! ways and nn (n 1)! (n 1)! ways ///
m
Thus, the number of ways in which the invited m+ n friends can be arranged around two
tables such that m friends are placed at one circular table and the remaining n at another
is given by:
20
8. How many binary strings of length 5 have at least 2 1’s?
Complementary Combinations
n n
Two combinations and are said to be complementary combinations if n r s .
r s
Remarks
n
A finite set with n-elements has subsets each with r-elements.
r
Exercise 1.4
1. Evaluate:
(a) 83 (b)
12
10 (c)
100
99
2. Solve for n:
(a) n2 15 (b) 3n 35
3. Show that:
(a) nr nn r (b) nr nr1 nr 1
4. How many committees of five representatives can be formed from a group of 10
persons?
5. An electric circuit may possibly fail at 10 stages. If it is found that it has now failed at
exactly four stages, in how many ways could this happen?
6. Nine people are to travel in two cars, five in one and four in the other. How many ways
are there to do this?
7. A salesman’s wife plans to accompany her husband on a sales trip to Cleveland. She
has four coats and six dresses in her cardboard, find the number of ways in which she
can choose three coats and three dresses for the trip.
8. A college freshman finds that he must take 12 hours of mathematics. If there are 12
21
three-hour courses offered, then in how many ways can the student satisfy the college’s
requirements?
9. In how many ways can four persons be selected from five married couples if
(a) the selection must consist of two women and two men?
(b) A husband and wife cannot both be selected?
10. In how many ways can a 10 question True/False examination be answered if you
make the same number of answers true as you do false?
11. A poker hand is a set of five cards selected from a standard deck of 52 cards. What is
the number of possible poker hands that contain:
(a) exactly one ace?
(b) a pair of kings?
(c) three cards of the same denomination?
(d) three cards of the same denomination and a pair of kings?
12. In how many ways can a committee of three be chosen from four Republicans and
four Democrats if
(a) all are equally eligible?
(b) the committee must consist of two democrats and one Republican?
(c) there must be at least one member from each party?
13. A bag contains five white and seven black marbles. If five marbles are drawn
together, how many different drawings are possible if
(a) the marbles may be of any color?
(b) there must be exactly three white marbles?
(c) the marbles must be of the same color?
14. Ten persons are going on a field trip for a history course in three cars that will hold
2, 3, and 5 persons, respectively. In how many ways could they go on the trip?
16. In how many ways can four red balls be drawn from an urn if
(a) the urn contains six red balls?
(b) the urn contains only four red balls?
(c) the urn contains four red, three white and two black balls?
17. There are three offices available for a staff of 12. The first office can accommodate
three persons, and the second and third offices can take four and five persons,
respectively. How many different assignments of the staff are possible?
18. In how many ways can a bridge deck be dealt to four players A, B, C, and D, giving
13 cards each? How is your answer affected if instead of distributing the cards to the
players, you arrange them in four heaps of 13 cards each and the players can
choose the set of 13 cards in any order they like?
19. In how many ways can nine accounts be assigned to three different salesmen so that
each one gets three accounts? What is the number of possibilities if the same
salesman can not be assigned to one particular pair of accounts?
20. In how many ways can 15 parcels be placed in three bags, each bag containing five
parcels? What is the number of possibilities if there are two heavy parcels that can
not be placed in the same bag?
21. In how many ways can one partition a set of size n into r ordered subsets so that the
first subset has size k1, the second subset has k2, and so on, and the rth subset has
size kr, given that k1+ k2+… + kr = n? How is the partition affected if k1 = k2= …=kr ?
22. A businessman has invited 21 of his customers for dinner on a Friday evening. He has
decided to place six guests at one round table, eight at another round table, and the
remaining seven are to be seated at a third circular table. In how many ways can he
22
complete the seating arrangement?
The quantities nr are called binomial coefficients because of the fundamental role these
quantities play in the formulation of the binomial theorem. Expansions of positive
integral powers of (a+b)n, where n=0,1,2, …, are of frequent occurrence in algebra and
are beginning to appear in all phases of mathematics. Moreover, expansions of this nature
are important because of their close relationship with the binomial distribution studied in
statistics and related fields. We shall, therefore, under take a systematic development of
the formula that produces such expansions.
Of course, the following identities, for example, could be established by direct
multiplication:
(a+ b)0 =1
(a+ b)1 = a+b
(a+ b)2 = a2 + 2ab + b2
(a+ b)3 = a3+3a2 b+ 3ab2+ b3.
(a+ b)4 = a4 + 4a3 b + 6a2 b2 + 4ab3 + b4
(a+ b)5 = a5 + 5a4 b+ 10a3 b2 +10a2b3+ 5ab4+ b5
(a+ b)6 = a6+6a5 b+ 15a4 b2 + 20a3 b3 + 15a2 b4+ 6ab5+ b5.
Note that as we continue expanding larger and larger powers of (a+b), several
patterns emerge, leading to a part of the solution. The following patterns may be evident
from the above process of multiplication:
(a) The coefficients of the first and last terms are both 1.
(b) There are n+1 terms in the expansion of (a+b)n.
(c) The exponent of a starts with n and then decrease by 1 until the exponent of a
has decreased to 0 in the last term, and exponent of b is 0 in the first term and
then continues to increase by 1 with the exponent of b is n in the last term.
(d) The sum of the exponents of a and b in a given term is n.
Remark: - The binomial theorem gives the coefficient of terms in the expansion of
powers of binomial expressions. Binomial expression is an expression which contains
two terms.
Proposition (The Binomial Theorem)
If n, r are non-negative integers, where 0 r n, then
(a b) n n0 a n 1n a n 1b n2 a n - 2b 2 ... nr a n - rb r ... b
n
n
4
n
(nr ) a n - rb r
r 0
Note that the (n+1) terms in the expansion of (a+b)n, without their coefficients, are
an ; an-1b, an-2 b2 ; … an-r br, …, a2 bn-2 ; abn-1 ; bn
In other words, each term in the expansion is of the form:
an-r br, where r= 0,1,2,…, n.
23
The coefficient of this general term is nr , since this corresponds to the number of ways in
which r b’s and (n-r) a’s can be selected, and thus the complete general term is;
n
r a
n-r r
b
A summation of this general term for r= 0, 1,2, …, n yields the above assertion.
(1 b) n b b b
n
0
n
1
n
2
2 n
3
3
... b
n
r
r
... b .
n
n
n
2n (1 1) n ... .
n
0
n
1
n
2
n
3
n
n
... (1) .
0 [1 (1)]n no 1n n2 3n n
4
n
5
n n
n
For even values of n, corollary 3 yields:
... ... 2
n
0
n
2
n
4
n
n
n
1
n
3
n
5
n
n 1
n 1
.
24
Examples
1. Expand (x+2y) 7.
Solution:-
x 2 y 7 x x (2 y ) x (2 y) x (2 y)
7
0
7 7
1
6 7
2
5 2 7
3
4 3
x 2 y x (2 y ) x(2 y ) (2 y )
7 3 4 7 2 5 7 6 7 7
4 5 6 7
; ; ; .
7
0
7
7
7
1
7
6
7
2
7
5
7
3
7
4
2. Expand (1+2x) 6.
3. Expand (1-3x) 4.
3. Expand (2x+3y) 5
25
4. Using the proposition, find the numerical value of (1.04)10.
10
1 10 (0.04) 45(0.04) 45(0.04) 2 120(0.04)3 ... 0.04
1 0.4 0.072 0.00768 ...
1.47968 ///
Remark:
Tr 1 a
n
r
n r
br .
Solution: - With n= 9, there are 10 terms in this expansion. The two middle terms are
then the 5th and 6th, given by T5 and T6.
26
4
1 a 8 63 13
T5
9
4 (2a) a 2 126 (32a 5 )
5
a ///
4 256 4
5
1 - a10 63
T6 9
5 (2a) - a 2 126 (16a 4 )
4
a14 ///
4 1024 32
8. Find the term independent of x (i.e., the constant term) in the expansion of
12
2 1
2x .
x
Solution: - Let the (r+1)st term be the term independent of x. Thus, we have
r
2 12 r 1
12
Tr 1 r (2x ) -
x
(2) x
12
r
12 - r 24 2 r
1r x r
(-1) .2
12
r
r 12 r
x 24 3r
EXERCISE 1.5
(c) ... .
n
0
n
1
n
2
n
3
n
4
n
5
n
6
n
7
n
n
3. Using the binomial Theorem (or formula), find approximations for the following.
7. Mr. Smith plans to deposit $ 1000 in a saving account that pays 6 percent interest
compounded annually. How much will he have in his account five years hence?
8. A commercial bank A pays 6 percent interest for savings and compounds it quarterly,
while another commercial bank B pays 7 percent interest on savings but compounds
it annually. If a customer wants a maximum return on his savings, in which bank
should he deposit $ 10,000 he has recently inherited?
9. Three successive coefficients in the expansion of (1+x)n are 462,330, and 165.
Determine the value of n.
10. Find the term independent of x (i.e., the constant term) in the expansion of
12
3 1
x .
x
1. n(A B) = n(A)+n(B)-n(A B)
2. n(A B C ) =n(A)+n(B)+n(C)-n(A B)-n(A C)-
n(B C)+n(A B C)
Proposition 2: Let A,B and C be any finite sets and U a universal set. If n(U) = N, then:
1. n A B N [n( A) n( B )] n( AB ) = N - n(A B)
2. n A B C N [n( A) n( B ) n(C )] [n( AB ) n( AC ) n( BC )] n( ABC )
= N – n(A B C)
C C
Note: A B A B and AB A B where A or Ac denotes the complement of set
A
28
Examples
2. Determine the number of integers n such that 1 n 100 that are neither divisible
by 3 nor by 5.
29
N (C 1 C 2 ) 100 [33 20] 6.
100 53 6
53 /// ... There are 53 integers that are not
divisble by 3 or 5 in U {1,2,3, ..., 100}.
Definition: For r R, the greatest integer function in r (or simply the greatest
integer in r) is denoted by r and defined as:
r if r z
r=
the largest integer smaller than r, if r is not an integer.
3. Determine the number of positive integers n where 1 n 100 and n is NOT divisible
by 2, 3, or 5.
Solution: Our universal set U= {1,2,3…,100} and n (U)= N = 100. For n U, let
C1 be the set of integers n divisible 2.
C2 be the set of integers n divisible by 3
C3 be the set of integers n divisible 5.
Here, we want to find N (C1 C 2 C3 ) the number of integers nU which are not divisible
by 2, 3, or 5.
100
N (C1 ) 100 = 50 N(C1C2) = = 16
2 6
100 1 100
N (C2 ) = 33 =33 N(C1C3)= = 10
3 3 10
100
N (C3 ) 100 = 20 = 20 N (C2C3) = = =6
5 15
100
and N (C1 C2 C3) = = 3.
30
Then by proposition 2:
N (C1 C 2 C 3 ) N [ N (C1 ) N (C2 ) N (C3 )] [ N (C1C2 ) N (C1C3 ) N (C2C3 )] N (C1C2C3 )
we have;
N (C1 C 2 C3 ) 100 [50 33 20] [16 10 6] 3 26 ///
(These 26 integers are 1,7,11,13,17,19,23,29,31,37,41,43,47,49,53,59,61,67,71,73,77,79,
83,89,91,97.)
30
Given a finite set U with n (U)= |U|=N, and conditions Ci , 1 i n, satisfied by
some of the elements of U. The number of elements of U that satisfy NONE of the
conditions Ci , 1 i n, is denoted as N N (C1 C 2 C3 ...Cn ) and is given by:
or in summation notation:
n
N N N (Ci) N (C iC
1 i n 1 i j n
j) N (Ci Cj Ck) ... (1)
1 i j k n
N (C1C2C3...Cn )....[2]
Examples
(a) Here, there is only one position to fill and one object to arrange. Hence there is no
position other than this where 1 can be moved. In other words, the number of
arrangements in which 1 is not in the first place is 0. The number of derangements
of the number 1 is then;
D (1) = 0
(b) The derangement of 12 is 21. Thus the number of derangements of the numbers
1,2 taken two at a time is given by:
D (2) =1
31
(c) D (3) = 2. Refer to Example 1.49 (b).
(d) The distinct arrangements of the numbers 1,2,3, 4 so that 1 is not in the first place,
2 is not in the second place, 3 is not in the third place and 4 is not in the fourth
place are:
2143 3142 4123
2341 3412 4312
2413 3421 4321
The number of derangements of the numbers 1,2,3,4 taken altogether is then:
D (4) = 9 ///
At this point of our discussion, given any positive integer n let us look for a
relation (or formula) that can be used to find the number of derangements, D(n), of these
n objects take altogether.
2. In how many ways can we arrange the numbers 1,2,3, …, 7 so that none of the
numbers are in their natural positions?
Solution:
Clearly, n = 7 and the number of permutations of the numbers 1,2,3,4,5,6 and 7
taken all at a time is 7p7= 7!
Let Ci, where i = 1,2,3,,4,5 6 or 7, be the condition that the number i is in its natural
position. For instance, C1 is the condition that 1 is in the first place in a permutation; C2 is
the condition that 2 is in the 2 nd place in a permutation. The permutation 7261534
satisfies the conditions C2 and C5.
By definition, a derangement of 1,2,3, …, 7 is a permutation that satisfies none of
the conditions Ci, 1 i 7. Thus, the number of derangements of these seven numbers is
evidentially;
D (7) N (C1 C 2 ... C7 )
N - [N(C1 ) N (C2 ) ... N (C7 )]
[ N (C1C2 ) N (C1C3 ) ... N (C6C7 )]
[ N (C1C2C3 ) N (C1C2C4 ) ... N (C5C6C7 )]
....
(1)7 N (C1C2 ...C7 ) .... By PIE.
32
N (C1C2) = 5!
Proceeding along these lines, the number of permutation satisfying the specified
condition would be given by:
N (C1C3) = N (C1C4)= … = N (C1 C7)+ …= N (C6C7)= 5!
N (C1C2C3)= N (C1C2C4)= … = N (C1C2C7)= … = N(C5C6C7)=4!
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Finally;
N (C1C2C3 … C7) =0! =1
Thus, by the principle of inclusion and exclusion, the number of derangements of the
numbers 1, 2, 3, …, 7 taken altogether is given by:
7! 7 ! 7 ! 7 ! 7 ! 7 ! 7 !
7!- .
1! 2 ! 3 ! 4 ! 5 ! 6 ! 7 !
1 1 1 1 1 1
7 ! 1 - 1
2 ! 3! 4 ! 5 ! 6 ! 7 !
Observe that;
6 ! 17! 6! ! 6 ! 71!!, 5 ! 27!5!! 5 ! 72 !!
7
1
7
2 and so on.
From elementary calculus we find that the Maclaurin series for the exponential
function is given by:
x 2 x3
x2
ex 1 x ... .
2 ! 3! n 0 n !
Thus
1
(-1)n 1 1 1 1
e 1 1 ...
n 0 n ! 2 ! 3! 4 ! 5 !
-1
To five places, e = 0.36788 and
1 1 1 1
1 1 .... 0.36786,
2 ! 3! 4 ! 7!
+ -1 (1) n k
Consequently, for k z , k 7, e is a very good approximation to .
n0 n !
We can, therefore, use this value in example 2 and write:
1 1 1 1 1 1
D (7) 7 ! 1 - 1
2 ! 3! 4 ! 5 ! 6 ! 7 !
(7 !) (e-1 ) ///
Proposition:
1 1 1 1 1
D (n) n ! ... (-1)n
2 ! 3! 4 ! 5 ! n !
If n 7, then the number of derangements of the n objects, can be approximated by:
D (n) = (n !) e-1 … From Maclaurin series for e-1
Examples
1. While at a racetrack, Ralph bets on each of the ten horses in a race to come in
according to how they are favored. In how many ways can they reach the finish line
so that he loses all of his bets?
Solution:
Removing the words “horses” and racetrack” from the problem, we really want to
know in how many ways we can arrange the numbers 1,2,3 …, 10 so that 1 is not in the
first place (its natural position), 2 is not in the second place (its natural position), …, and
10 is not in the tenth place (its natural position). We already know that this is the
derangements of the numbers 1,2,3 …, 10. That is:
9 ! 8 ! - 7 ! ... 0 !
D (10) N (C1 C2 C3 ...C10 ) 10 ! 10
1
10
2
10
3
10
10
9 ! 8 ! 7 !
10
1
10
2
10
3 0 ! 10
10
10 ! 1
...
10 ! 10 ! 10 ! 10 !
1 1 1
10! 1 - 1 ...
2! 3! 10 !
(10!) e-1. ///
2. At the C-H company Peggy has seven books to be reviewed, so she hires seven people
to review them. She wants two reviews per book, so the first week she gives each
person one book to read and then redistributes the books at the start of the second
week. In how many ways can she make these two distributions so that she gets two
reviews (by different people) of each book?
34
Solution:
She can distribute the books in 7! ways the first weak. Numbering both the books and the
reviewers (for the first weak) as 1,2,3, …, 7 for the second distribution she must arrange
these numbers so that none of them is in its natural position. She can do this in
D (7) ways. By the rule of product, i.e., the principle of multiplication, she can make the
two distributions in:
7 6!
(7 ! ) D(7) 7 ! x7 ! 1 - 1
7
2
5! 73 4 !
7
0 !
... 7
7! 7! 7! 7!
1 1 1 1
(7 !) 2 1 - 1 ...
2 ! 3! 4 ! 7 !
2 1
(7 !) (e ) ways ////
EXERCIS 1.6
1. There are 50 members in a club. Of these 50 members, if 10 play tennis, 15 play chess,
12 play badminton, 5 play both tennis and chess, 4 play both tennis and badminton, 3
play chess and badminton, and 2 play all the three sports-badminton, chess and tennis.
Then
(a) How many members of the club play none of the sports?
(b) How many play at least one of the three sports?
2. Determine the number of positive integers n, where 1 n 2000, that are:
(a) not divisible by 2,3,or 5.
(b) not divisible by 2,3,5,or 7; and
(c) not divisible by 2,3, or 5, but are divisible by 7.
3. Find all real numbers x such that
(a) 7 x = 7x (b) 7x = 7 (c) x+7 = x+7 (d) x+7 = x +7.
4. Find the number of arrangements of a, b, c, …, x,y,z, in which none of the patterns
spin, game, path, or net occurs.
5. Determine the number of positive integers n, where 1 n 1000, that are:
(a) not divisible by 7 or 11.
(b) divisible by at least one of the integers 7 or 11.
6. In how many ways can we devise a secret code by assigning to each letter of the
alphabet a different letter to represent it?
7. When n balls, numbered 1,2,3 …, n, are taken in succession from a container, a
rencontre occurs if the mth ball withdrawn is numbered m, 1 m n. Find the
number of ways of getting no rencontres of these n balls.
8. In how ways can the integers 0,1,2,3, …, 9 be arranged in a line so that no even integer
is in its natural position?
35
CHAPTER 2
RECURRENCE RELATIONS
2.1. Introduction
Recursion involves recursive definition of an algorithm, a set or a sequence in terms of
itself. When a recursive definition is used as a tool for solving combinatorial problems,
an equation called recurrence relation is applied to represent present and future values on
the basis of earlier or prior terms. It is clear that in counting problems we analyze a given
situation and then express the result in terms of the results for certain smaller non-
negative integers. Once the recurrence relation is determined, one can solve the equation
at any nW- non negative integer n. With access to a computer, such relation is highly
valuable, especially if it cannot be solved explicitly.
Recurrence relations are the discrete counterparts to the continuous ideas of the ordinary
differential equations. Recurrence relations are also called difference equations or
recurrence equations.
Thus, this chapter is devoted to the study of recursively defined discrete functions and the
solutions of recurrence relations associated to these recursively defined functions.
Counting, enumeration and discrete problems are some typical areas where sequences are
exploited most. In realty, they are ranges of special kinds of functions. The distinguishing
feature of sequences is their domain. In most cases, they assume the set of natural
numbers as a domain. Under our study of recursive definitions and specifically
recurrences relations, the set of whole numbers will be regarded as the domain of
sequences.
Definition: If f is a function that maps the set of whole numbers W or any non-empty
finite subset of W in to a certain number set, then the range of f is called a
sequence. By convention, the elements of the range of the function f, i.e. the
elements of the sequence are known as terms.
Note: A sequence is often called a discrete function or a numeric function
Notations:
(1) Subscripted symbols of the form an, bn, fn, etc are used to denote the image of a
whole number n under the sequence f. If we select, say a n to denote the image of
nW under f, then an = f(n), n= 0,1,2, …
36
(2) We use the notation {fn} n 0 or simply {fn} to denote a sequence f.
In other words,
{an} n 0 = {f0, f1, f2, ---} = the range of f (which is the sequence f).
If nW begins at some non negative integer k 1, then the notation {an} n k is applied for
the sequence.
Note: (1) If the domain of a sequence {an} is the set of all non negative integers W, then
{an} is called an infinite sequence and if the domain is any finite non-empty
subset of w, it is called a finite sequence.
(2) If the sequence {an} = {a0, a1, a2, …} is:
a. the set of integers, then {an} is called a sequence of integers.
b. the set of real numbers, then {an) is termed as a real sequence.
c. the set of complex numbers, then {an) is known as a complex sequence.
There are several methods of representing a sequence and the most commonly
used techniques are the following.
a. Enumerating the first few terms of the sequence. Note that we list terms of
the sequence till a rule for telling the present and future values is observed.
b. Supplying a rule that defines a sequence f as an explicit function a(n),
preferably written as an = f(n), n 0. It should be noted that an= f(n) depends
upon n and only n.
c. A technique called recursive definition stated in terms of recurrence relations
and initial conditions may be used to describe the terms of a sequence.
Examples
1. The numbers: 0,1,1,2,3,5,8,13, … form a sequence that begins with the two terms
0 and 1. Each new term, there after, is a sum of the previous two terms. As we
shall see later, the numbers in this sequence are called the Fibonacci number.
This description is called enumeration method.
2. The sequence {an} n 0 where an= 5(3n) or simply {5(3n)} n 0 represents the
geometric sequence 5,15,45,135,…
This description is called explicit method.
The recursive definition for the Fibonacci sequence is composed of two parts, namely,
the equation: fn = fn-1 + fn-2, n 0 and the values f0=0 and f1=1. These properties are
enjoyed by all other recursively defined sequences.
37
2.3 RECURSIVE DEFINITION AND RECURRENCE RELATIONS
Note that a recursive definition is well defined if and only if it satisfies conditions (i) and
(ii) above. If any one of these two properties is lacking, the recursive definition may not
describe the required phenomenon in a unique manner.
Example:
Let us use a geometric sequence to illustrate that both the rule and the starting values are
really essential in recursive definitions.
Recall that a geometric sequence is an infinite array of numbers, such as
5,15,45,135, …, where the division of any term ,other than the first, by its immediate
predecessor is a constant, called the common ratio r. For our sequence this common ratio
15 45 135
r is 3 since 3. If ao,a1,a2, ---,are in a geometric sequence, then
5 15 45
a1 a2 a3 a
... n 1 =…= r, the common ratio. In this particular geometric sequence
a0 a1 a2 an
an+1= 3an, n 0 is the rule for finding present and future values from earlier or prior
terms.
The equation an+1= 3an, n 0, does not, however, define a unique geometric
sequence. The sequence 7, 21, 63, 189, … also satisfies the relation. To pinpoint the
particular sequence described by an+1= 3an, we need to know one of the terms of that
sequence as a starting value. Hence,
an+1= 3an, n 0 and a0=5
uniquely defines the sequence 5,15,45,135,…, whereas
an+1 = 3an n 0 and a1=21 identifies 7,21,63,189, … as the geometric sequence
under study.
The expressions for permutations and combinations are one of the most
fundamental tools for counting the elements of finite sets. They often prove to be
inadequate and many problems of computer science require a different approach. Hence,
recurrence relation emerges in this section as another tool for solving combinatorial
problems.
Recurrence relations are often called difference equations or recurrence equations.
The salient characteristic of a recurrence relation is the specification of the term fn
as a function of the prior terms f0, f1 , f2 , … , fn-1. However, a recurrence relation by itself
is not sufficient to define a unique sequence; we must also specify the values of some
38
initial terms. This is why in our definition of the Fibonacci sequence, we set f0= 0 and
f1 =1 as initial conditions.
Recall that a recursive definition of a discrete function specifies one or more
initial values and a rule for determining subsequent terms from those that precede them.
When recursive definitions are applied to solve combinatorial problems, the equation
involved in these definitions, which is employed for finding present terms from the
preceding once is called a recurrence relation.
Recurrence relation:
A recurrence relation for a sequence {a n} and a non negative integer no, is a formula that
expresses an in terms of one or more of the previous values a0, a1, … , an-1 of the sequence
for all integers n n0.
Initial conditions: Initial conditions, which are also called boundary conditions of the
recurrence relation, are the values of one or more starting terms of the sequence specified
in the form
ao= k , a1= r, etc.
for some constants k, r R. Note that the computation of terms of a sequence from the
recurrence relation is initiated by the boundary conditions.
Explicit sequence: A function an = f(n) that defines the term an of a sequence {an} on the
basis of a non-negative integer n alone is called an explicit sequence of n.
Examples
1 The expression.
n! = n (n-1) !, for n 1 and
O! = 1 [i.e., if n=0, then n! = 1]
refers to itself when it uses (n-1) ! to describe n!. Moreover it contains:
(i) an initial condition (or base value) specified as: 0! =1 or if n=0, then n! =1.
(ii) a recurrence relation stated as: n!=n(n-1)!. Note that this is a recurrence
relation because the present value n! is defined in terms of (n-1)!.Thus the above
expression is the recursive definition of the factorial function
f(n) = n! , n 0.
.
2. Find a recursive definition of the binomial coefficients.
Solution: Denote the n-k binomial coefficient by nk . Then from the Pascal’s formula, we
have the recurrence relation:
nk nk 11 nk 1 , for n >k>0.
If the initial conditions specified as: 0n 1 and nn =1 are included to the recurrence
relation, we get the recursive definition for the binomial coefficients ///
n
k
39
3. Define the number of permutations without repetition of n objects taken altogether
recursively.
Solution of a Relation:
If each term of an explicit sequence a n = f(n), n w satisfies a given recurrence
relation, then the explicit sequence (i.e., the explicitly defined sequence) {an} is called the
solution of the difference equation. The procedure followed to find the explicit sequence
{an} that solves a recurrence relation is called solving.
Examples
1. Show that the explicit sequence {an} where an= 2n+1-1 for n 1 is a solution of the
recurrence relation:
an= 3an-1 – 2an-2 , n 3.
Solution:
To show that an= 2n+1-1 n N is a solution of the recurrence relation:
an= 3an-1 – 2an-2,
first observe that the terms of the explicit sequence {an} at n, n-1, and n-2,
respectively, are:
an= 2n+1 – 1 … [ i ]
an—1 = 2n-1+1 –1 = 2n-1 … [ ii ]
an-2 = 2n-2+1- 1 = 2n-1 - 1 --- [ iii ]
Substituting these formulas into the right-hand side of the recurrence relation, we get:
3an-1 – 2an-2 = 3 [2n -1] –2 [2n-1-1] … by [ii] and [iii]
= 3 (2n) –3 - 2 (2n-1) +2
= 3 (2n) –2n-1
= 2 (2n) –1.
= 2n+1 –1
= an …… by [ i ].
Thus, we conclude that: an= 3an-2 – 2an-2 whenever an= 2n+1-1. Consequently the explicit
sequence {an} n 1 where an= 2n+1-1 n 1 is a solution of the given recurrence relation.
40
2. Show that the sequence {f n} defined explicitly by f n= 2(-4)n +3 is a solution of the
recurrence relation fn = -3 fn-1+4 fn-2.
Solution: Given the explicitly defined sequence fn =2(-4)n +3, to show that it is a solution
of the relation: : fn = -3fn-1+4 fn-2 , we begin with RHS.
-3 fn-1+ 4fn-2 = -3 [2(-4)n-1+3] +4 [2(-4)n-2+3]
= -6 (-4)n-1-9 +8 (-4)n-2+ 12
= -6 (-4)n-1 + (-2) (-4) (-4) n-2+3
= -6 (-4)n-1 –2 (-4)n-1 +3
= -8 (-4)n-1 +3
= 2 (-4) (-4)n-1+ 3
= 2 (-4)n + 3.
= fn
Therefore, the sequence {fn} where fn= 2(-4)n+3 is a solution of the recurrence relation.
0, if a < b
Q (a, b) =
Q (a-b,b) +1, if b a.
EXERCISE 2.1
(1) Given a number sequence {an} n 1 = {2,4,8,16,32, …}, find a recursive definition
for {an} n 1 .
(2) Define the number sequence {5n} n 1 = {3,6,9,12,15, … ) recursively.
(3) For a non negative integer n and a non zero real number r, give a recursive
definition of f(n) = rn .
(4) Give a recursive definition of the sequence {fn} n 1 , if
(a) fn =5n (b) fn = 2n+1
(c ) fn+1 = 10n (d) fn = 5.
(5) Let g be the function such that g(n) is the sum of the first n positive integers. Give
a recursive definition for g (n).
(6) Find f1 , f2, f3 and f4 if fn is defined recursively by f0 = 1 and for n N ,
(a) fn+1 = fn+ 2. (b) fn+1= 3fn.
r
(c ) fn+1 = 2 , where r = fn . (d) fn+1 = fn2 + fn + 1.
(7) Show that the explicit sequence {an} n 0 where an= 3(5n) is a solution of the
recurrence relation: fn-5fn-1= 0, n 1.
(8) Given a recurrence relation: yn =yn-1 + 6yn-2 for n >1, then verify that the explicit
sequence {yn} n 0 such that yn= A (3)n + B(-2)n for any non zero constants A and
B solves the recurrence relation.
(9) Show that the explicit sequence {gn} n 0 such that gn = (A+Bn) (4n) for all non
zero constants A and B solves the recurrence relation: gn+2 – 8gn+1-16gn= 0, n 0.
(10) (a) Find F2 , F3 , F4 , F5 , and F6 if Fn is defined recursively by F0= 0 ,
F1= 1 and for n o:
Fn+2 – Fn+1 – Fn= 0.
n n
1 1 5 1 1 5
(b) If : Fn = is the explicit value of the sequence
5 2 5 2
{Fn} n 0 , then find F0, F1, F2 and F3.
(c) Identify a relation, if there is any, that can exist between the recursively
defined sequence of part (b).
Examples
1. The Fibonacci sequence defined by the recurrence relation: Fn= Fn-1+ Fn-2 , n 2 with
the initial conditions F0= 0 and F1= 1 is linear second-order.
2. yn-4yn-1= 0, n > 1 with the boundary condition y1= 3 is a first-order linear
recurrence relation with constant coefficients (LRRWCC of order-one).
3. aK+1 –5ak + 4ak-1- 6ak-2 = Ak+10 defined for k 3, together with the initial conditions
7
a0 = and a1= a2=5 is a third-order linear recurrence relation with constant
3
coefficients (LRRWCC of order-three).
HOMOGENEOUS RELATION
The recurrence relation [1] is called a k th – order linear homogeneous recurrence relation
with constant coefficients if and only if f(n)= 0 for all n W.
NONHOMOGENEOUS RELATION
The recurrence relation [1] is called a kth – order linear nonhomogeneous recurrence
relation with constant coefficients if and only if f(n) 0 for some n W. That is, the
relation:
cofn + c1 fn-1+ c2 fn-2+ … ck fn-k= f(n) 0 for some n W is termed as nonhomogeneous
recurrence relation with constant coefficients (LNRRWCC).
Note: Non homogeneous recurrence relation is also called Inhomogeneous RR.
Examples
1. The relation: ak = 5ak-1, - 8ak-2 ,k 2 with a0 =5 and a1= 2 is a 2nd –order LHRRWCC,
7
while ak= 5ak-1 –ak-2 +6ak-3+ 4k+10, k 3 with a0 = and a1= a2 =5 is a 3rd –order
3
LNHRRWCC.
2. Classify the following recurrence relations
(a) fn =nfn-1 (b) an = an-1+ an-3
(c) bn = bn-1+2 (d) Sn = Sn-2 + Sn-4.
Solution:
(a) fn = nfn-1 is a first-order linear homogeneous recurrence relation with variable
coefficients.
(b) an = an-1 + an-3 is a third-order linear homogeneous recurrence relation with constant
coefficients.
(c) bn = bn-1+ 2 is a first-order linear non homogeneous recurrence relation with constant
coefficients.
(d) Sn = Sn-2 + Sn-4 is a fourth-order linear homogeneous recurrence relation
with constant coefficients.
43
2.5 SOLVING LINER HOMOGENEOUS RECURRENCE RELATIONS
PROPERTIES OF SOLUTIONS
The solutions of a linear recurrence relation have two important properties which may be
stated as follows.
(1) Multiplication Property: Multiplying any solution of a linear recurrence relation
by a non-zero constant gives another solution
(2) Addition Property: Adding two or more solutions of a linear recurrence relation
gives another solution.
In the following, we shall study a method of solving 1st -order linear homogeneous
recurrence relations with constant coefficients and then use their solutions as springboard
towards the solutions of higher order linear homogenous relations.
45
2. Let n be the number of memory locations referenced by a certain computer
program. Suppose that the algorithm implemented by the program requires f n bytes
of memory, where fn depends on n. If fn is defined recursively by:
fn = 4fn-1, n 2 and f1 =3.
Then find the amount of bytes of memory required to implement the algorithm by
the program for all n 2.
Solution: The problem is indeed a problem of solving the given recurrence relation
and its initial condition.
Method 1 (Recursion Method)
Starting from the given RR, we proceed by recursion or a repetitive procedure as
follows.
fn = 4fn-1
=4 (4fn-2) … Since fn-1 = 4fn-2
= 42 fn-2
= 42 (4fn-3) …. Since fn-2 = 4fn-3
= 43 fn-3
= …..
= 4n-k fn-k (for each k W and k n)
= ……
= 4n-1 fn-(n-1) (where k =n-1)
= 4n-1 f1
= 4n-1(3) ….. Since f1=3 is the given initial condition.
= 3(4)n-1
Thus, the unique solution to the recurrence relation is:
fn= 3(4)n-1, n 1.
Method 2
The general solution obtained in example1 may be applied in solving the recurrence
relation at hand. In other words, suppose that the difference equation has a general
solution of the form:
fn= crn , n1.
Substituting this formula in: fn= 4fn-1, we have
Crn= 4crn-1
cr n 4cr n 1
cr n 1 cr n 1
r=4
46
fn = c(4)n.
Using the initial condition: f1= 3, where n=1, yields
C(4)1 = f1=3
4c =3
3
c= .
4
3 n
fn= (4) = 3(4)n-1
4
Therefore, the unique solution is:
fn =3(4)n-1 n 1 ///
This agrees with the above solution obtained by recursion.
3. A bank pays 6% annual interest on savings, compounding the interest monthly. If Ato
Gallo deposits $ 1000 on the first day of May, how much will this deposit worth a year
later?
Solution:
6%
Since the annual interest rate is 6%, the monthly rate is 0.5% , which means that
12
0. 5
the monthly interest is 0.005.
100
For 0 n, 12, let pn denote the amount of Gallo’s deposit at the end of n months. Then,
clearly we have the relation: 0.005 pn-1= The interest earned on the amount pn-1 during the
month, Thus;
Pn = pn-1+ 0.005 pn-1 for a 1 n 12 and p0 = $ 1000 …. (*)
represents the problem recursively. What remains is, therefore, to solve this recurrence
relation with its initial condition.
Hence, the relation in (*):
Pn = pn-1 + 0.005pn-1
Pn = (1+0.005)pn-1
Pn = (1.005) pn-1 , p0= $ 1000
has the general solution: pn = (1.005)n p0 ; which gives rise to the unique solution:
Pn = 1000 (1.005)n. …. (why ?)
Consequently, from the unique solution, it is evident that Gallo’s deposite will worth:
P12 = 1000 (1.005)12
= 1061.68 ///
a year or 12 months later.
EXERCISE 2.2
47
1. Find a recurrence relation which will be is satisfied by the sequence {an) n 0
formed from each of the following functions.
n!
(a) an = (b) an = n2-6n+8.
15 !
2. Which of the following recurrence relations are homogenous and which are non-
homogeneous? Which are linear and non linear? Tell the order and describe the
coefficients (as constant or variable) in each case.
(i) fn = nfn-1 (ii) an= an-1+ an-3 (iii) bn =bn-1+ 2
(iv) sn = sn-2 + sn-4 (v) yn yn 1 6 yn 2 0 (vi) an = an-2
(vii) 5nan + 2nan-1 = 2an-2 (viii) an = an-1 + 2n-7.
3 3
(ix) a n = 7a n-1 (x) an =an-1 + an-2 + (n-1)2.
3. For each of the following, determine the number of initial conditions that must be
assigned so that a unique sequence is generated.
(a) an = 2an-1 – an-2 (b) an-an-2 + an-3 = 0
(c ) an = an-1 + 2n (d) 5nan + 2nan-1 = 2an-1
4. Give an example of:
(a) a linear homogeneous recurrence relation with constant coefficients.
(b) a linear homogeneous recurrence relation with variable coefficients.
(c) a linear inhomogeneous recurrence relation with constant coefficients.
(d) a non-linear homogeneous recurrence relation with constant coefficients.
5. Find the general solution of the recurrence relations:
(a) 2 an+1- 3 an = 0, n 0 (b) 4an – 5an-1 = 0, 0 1.
(c) an+1 – 4an = 0, n 0 (d) an- 1.5 an-1= 0, n 1.
6. Solve each of the following recurrence relations.
(a) an = 3an-1, n 1 and a0 =5.
1
(b) an 1 = an-2, n 2 and a2=98.
7
(c) 3an+1- 4an = 0, n 0 and a1= 5.
(d) 2an – 3an-1= 0, n 1 and a4 = 81.
7. If the explicitly defined sequence {an} n 0 is a solution of the recurrence:
153 1377
an+1- can = 0, with a3 = and a5 = , then what is the value of the constant
49 2401
c?
8. Suppose that bn > 0, for all nW, and solve the relation:
(i) b2n+1 = 5b2n , n 0 and b0 = 2
(ii) find b12.
48
9. The number of bacteria in a culture is 1000 and this number increase 250% every
2 hours. Use a recurrence relation to determine the number of bacteria present
after one day (24 hours).
10. If Addie chaltu invests $ 100 at 6% interest compounded quarterly, how many
months must she wait for her money to double?
11. Find a10 if a3 n = 7a3n-1, n 1 and a0=3.
Recall, from section 2.5, that a first order linear homogeneous relation with
constant coefficients had a general solution: an = crn, where c and r are non-zero
constants.
Based on this work (regarding the first order case), we shall seek a solution for the
second-order homogeneous recurrence relation with constant coefficients, that assumes
the same form: an = crn. Note that we are using inductive procedure to suggest a solution.
Now, consider the second-order LHRRWCC:
A0an +A1an-1+ A2 an-2 = 0, n 2 …. (*)
Assume that this relation has a solution of the form:
an= crn with c 0 and r 0.
Then, observe that the two subsequent terms are expressed as:
an-1 = crn-1 and an-2 = crn-2
substituting these formulas into the equation (*), we get:
A0 crn + A1crn-1+ A2crn-2 = 0
crn-2 [A0r2+ A1r + A2] = 0.
Dividing throughout this last equation by crn-2 0, we get a second-degree (or quadratic)
equation in r, which will be given by:
A0r2 + A1r + A2 = 0.
Consequently, the discrete function {an} with an = crn is a solution of the 2nd – order
recurrence relation:
A0an + A1an-1 + A2an-2 = 0
if and only if the number r is a solution of the 2nd-degree equation:
A0 r2+ A1r + A2 = 0.
Example: find the characteristic equation of each of the following recurrence relations
1. fn = 3fn-1 -2fn-2, n > 2 with initial conditions: f 1=3 and f2 = 7
2. yn= 6yn-1- 9yn-2, n>1, y0= 5 and y1= 3
.Solutions:
1. Given the difference equation: fn= 3fn-1- 2fn-2, n>2, suppose that the solution is of the
form: fn = rn. Now, substituting the assumed solution into the given recurrence relation
gives the equation:
rn = 3rn-1- 2rn-2
This equation, upon division by rn-1 0 throughout, yields the characteristic equation:
r2 = 3r-2
r2-3r + 2= 0
(r-1) (r-2) = 0
r1= 1 and r2= 2, which are the characteristic roots.
Recall that the characteristic equation of the homogeneous kth order linear relation:
fn+ a1 fn-1+ a2 fn-2 + a3fn-3+ … + akfn-k = 0, n k
50
is the kth degree polynomial equation:
rk+ a1rk-1+ a2rk-2a3rk-3 + … + ak-1r + ak = 0.
The solutions of this equation are called the characteristic roots of the recurrence relation.
Example: Find the characteristic equation for each of the following recurrence
relations.
(1) 4un+1 – 7un = 0.
(2) 4 un+1 – 7un + un-1= 0.
(3) 4un+1 + 6un-1= 0.
(4) yk + 2yk-1- 3yk-2- 6yk-4 =0
(5) sn = sn-1 + 4 sn-4.
Solution: Table 2.1 beneath gives the corresponding characteristic equation of each of
the difference equation above.
No. Recurrence Relation Characteristic equation
1 4un+1 - 7un = 0 4r – 7 = 0
2 4un+1 – 7un+ 6un-1 = 0 4r2 –7r + 6 = 0
3 4un+1 + 6un-1 = 0 4r2 + 6 = 0
4 yk +2yk-1 – 3yk-2 – 6yk-4 = 0 r + 2r3-3r2-6 =0
4
5 sn = sn-1 + 4 sn-4 r4 = r3 + 4
At this point of our discussion, we need to realize that the idea of characteristic equations
and roots can be used to solve linear homogenous relations with any given order. To this
end, one may follow the algorithm below as a guide.
Examples
1. Solve the recurrence relation
un+1 = 4un, n > 0 with the initial condition u0 = 5.
Solution:
The characteristic equation of the recurrence relation is:
r =4 … since the auxiliary equation of a first order recurrence relation is a
linear (1st degree) equation.
The characteristic root is then r = 4.
The general solution, for some constant A, is: un = A(r )n = A(4)n.
To determine the arbitrary constant A, use the initial condition u0 =5. That is, for
n =0, write: u0 = A(4)0 =5 A=5
Replacing the specific number 5 for the arbitrary constant A, the unique solution
of the given recurrence relation will be:
Un = 5(4)n, n 0 ///
Step4: Use the initial conditions to determine constants in the general solution.
Now, substituting the initial conditions a0= 0 and a1= a2= 1 in the general solution result
in the system of equations:
c1 + c2+ c3 = 0
52
c1 – c2 + 2c3 = 1
c1 + c2 + 4c3 = 1.
Step4: Use the initial conditions to determine constants in the general solution.
Now, using the initial conditions, we get
y0 = c(3)0+ d(0) (3)0 = 5
y1 = c(3)1+ d(1) (3)1 = 3
c=5 c=5
3c +3d = 3 d= -4.
Exercise 2.3
(1)Write the characteristic equations and find the characteristic roots for each of the
53
following recurrence relations.
(a) an = an-1 (b) an+1 - 2an = 0 (c) fn+2 + 3fn+1+ 2fn= 0
(d) yn+2 + 4yn+1+ 4yn =0 (e) fn+2 –7fn+ 12fn-2 = 0
(f) gn+2 – 8gn+1 + 16gn = 0.
(2) Solve the following recurrence relations.
(a) an =5an-1 +6an-2, n 2 with a0 =1, a1= 3.
(b) 2an+2 –11an+1+ 5an = 0, n 0 with a0= 2, a1= -8.
(c) 3an+1= 2an+ an-1, n 1, a0 =7, a1 = 3
(d) an – 6an-1+ 9an-2 = 0, n 2, a0 =5, a1 =12.
(e) an = 7an-1- 10an-2, n 2, a0 =3, a1= 15.
(f) 9an+2 + 12an+1+ 4an = 0, n 0, a0 =1, a1 = 4
(g) an = 3an-2+ 2an-3, n 3, a0= 1, a1= 3, a2=7.
(3) If a0 = 0, a1= 1, a2= 4 and a3 = 37 satisfy the recurrence relation: an+2+ ban+1 + can = 0,
n 0 , where b and c are constants, then
(a) find the constants b and c.
(b) solve the recurrence relation.
(4) Solve the recurrence relation: a2n+2 – 5a2n+1 + 4a2n = 0, n 0, a0 = 4, a1= 13.
(5) If an = c1+ c2(7)n for n 0 is the general solution of the recurrence relation:
an+2 + ban+1+ can = 0, n 0, then determine the constants b and c.
(6) Find a recurrence relation whose solution is:
(a) yn = A (3)n + B (-2)n for some constants A and B.
(b) fn = 3(5)n
(c) an = (A+Bn) (4)n for some constants A and B.
(7) If the recurrence relation: an+ c1an-1+ c2an-2 = 0 is satisfied by a0= 0, a1=1, a2= 4 and
a3= 12, then solve for an.
(8) (a) Find a quadratic polynomial equation in r whose characteristic roots are -1and 5.
(b) Find a linear homogenous recurrence relation with constant coefficients whose
characteristic polynomial is the equation obtained in part (a).
(9) Find the general solution of the following recurrence relations.
(a) fn- 3fn-1- 10fn-2 =0 (b) fn+2 + 6fn+1 + 9fn = 0.
(c) 2fn + 2fn-1 – fn-2 = 0. (d) fn+2 –3fn-1 - 4fn-2 = 0.
(10) For n 0, let an count the number of ways a sequence of 1’S and 2’S will sum to n.
For example, a3= 3 since
(a) 1+1+1 (b) 1+2 (c) 2+1 sum to 3.
(1) Find a recurrence relation for an.
(2) Solve this recurrence relation.
(11) Solve the following recurrence relations.
(a) an + an-1 = 0, n 1, a0 = 4
(b) an = 3an-1 , n 1, a0 = 1.
(c) 2an+3 = an+2 + 2an+1 – an, n 0, a0 = 0, a1= 1 and a2= 2.
(d) an+ 6an-1+ 12an-2+ 8an-3 = 0, n 3, a0 =0, a1 =1and a2 =2.
(e) an+3 = an+2 + 8an+1- 12an, n 0, a0 = 3, a1= -3 and a2= 26.
(f) fn =fn-2 –6fn-3, n 4 , f0 = 1, f1 = -2 and f2 =4 and f3 =-8.
(g) an =3an-1- 3an-2 + an-3, n 3 a0 = a1 =1 and a2 =2.
(h) an = 6an-1 + an-2 – 30an-3, n 3 with initial conditions (a0, a1, a2) = (-1,0,1).
(12) (a) Find a cubic polynomial equation whose roots are 5, -1 and 3.
(b) find a linear homogeneous recurrence relation with constant coefficients whose
54
characteristic equation is the cubic equation found in part(a).
(c) Find the initial conditions that can accompany the recurrence relation
of part (b) if its solution is:
(a) an = 5n (b) an = 5n + (-1)n (c) an = 5n+ 2 (-1)n –3n.
(13) If each of the discrete functions fn, gn and hn are solutions of rth-order linear
homogenous recurrence relation with constant coefficients:
an = k1an-1 + k2 an-2 + k3an-3+ … + kran-r
then prove that the function:
sn = cfn + dgn + ehn
for any constants c, d, and e is also a solution of this recurrence relation.
(14) (a) Which of the following equations have multiple roots?
In case there is a multiple root, find its multiplicity.
(i) x2-1 = 0 (ii) x2 + 2x + 1 = 0 (iii) x2 +x- 12 = 0
(iv) x2 –6x+9 =0 (v) x4 – 2x2+ 1 = 0 (vi) x4+2x3–3x2-4x+4 = 0
3 2 3 2
(vii) x = x + 8x-12. (viii) x + 6x +12x+8= 0
(b) Write a linear homogeneous recurrence relation with constant coefficients whose
corresponding characteristic equation is each equation in part (a).
Examples
1. Use the substitution method to formulate the solution of the general recurrence
relation:
an = an-1 + f(n)
Where f(n) is a non-zero function of n.
Solution
55
Successively substitute the base value in the given recurrence relation. In most cases the
substitution begins at a1. Thus:
an = an-1+ f(n)
a1 = a0 + f(1)
a2 = a1 + f(2) = a0 + f(1) +f(2)
a3 = a2 + f(3) = a0 + f(1) + f(2) + f(3).
a4= a3 + f(4) = a0 + f(1)+f(2) +f(3) + f(4)
--------------------------------------------------------
--------------------------------------------------------
an-1= an-2+ f(n-1) = a0 +f(1) + f(2) + f(3) +f(4)+ … + f(n-2)
an = an-1 + f(n) = a0 + f(1) + f(2) + f(3) + f(4) + … + f(n-1) + f(n).
In Summation Notation:
n
an = a0 f(i).
i 1
This result may be stated as follows.
Theorem (1)
The solution of a nonhomogeneous recurrence relation of the form:
an = an-1+ f(n) , with f(n) 0 for some n W.
is given by:
n
an = a0 f (i).
i 1
2. Solve the recurrence relation:
an- an-1 = 3n2, for n 1 with an initial condition a0 = 7.
Solution
Repeated substitution may solve the relation at hand as follows.
an – an-1= 3n2 an = an-1+ 3n2, from which we get:
a1 = a0 + 3 (1)2
a2 = a1+3(2)2 = a0 + 3 (1)2 + 3 (2)2
a3 = a2 + 3 (3)2 = a0 + 3(1)2 + 3 (2)2+ 3(3)2.
------------------------------------------------------------------
------------------------------------------------------------------
an = an-1 + 3(n)2 = a0 +3(1)2 + 3 (2)2 + 3 (3)2 + … + 3 (n)2
= a0 + 3 (12+ 22+ 32+ … + n2)
n
2
= a0 + 3 i .
i 1
Thus, from some of our earlier work, if we can find a summation formula for the sum:
n
2
i
i 1
, then the relation is solved. But from the study of sums of terms of sequences; the
56
n
2
an = a0+ 3 i
i 1
n(n 1)(2n 1)
an = 7+3 … since a0 = 7
6
n(n 1)(2n 1)
an = 7 + .
2
Consequently, the unique solution of the given linear nonhomogeneous recurrence
relation is:
1
an = 7 + (n)(n 1)(2n 1), n 0 ///.
2
Note: We could have applied Theorem (1) to arrive at the same result.
Theorem 2
The solution of a nonhomogeneous recurrence relation of the form:
an = Ban-1 + c,
where B and c are constants is given by either of the formula:
n c ( B n 1)
a0B + if B 1.
B 1
an =
a0 + nc if B =1.
Proof: - One can follow a procedure similar to the proof outlined regarding Theorem (1)
above.
57
as a unique solution.
Note: We can apply THEOREM (2) directly to get the solution of the given recurrence
relation. That is;
an – an-1 = 4 an = an-1 + 4, from which we see that c= 4 and B = 1. Thus, the
solution of the RR takes the form:
an = a0 + nc
Since a0 = 1, by what we have done above, then the unique solution is:
an = 1+4n = 4n+1, n 0 ///
58
Exercise 2.4
1. Solve each of the following recurrence relations.
(a) an – an-1 = 2n+3, n 1 and a0 = 1
(b) an+1 – an = 3n2 – n, n 0 and a0 = 3
(c) an – 2an-1 = 5, n 1, and a0 = 1
(d) an+1 – 2an = 2n, n 0, and a0 = 1.
(e) an = an-1 + 2n, n 1, and a0 = 2.
2. On the first day of a European new year Ato Abdo deposits $ 1000 in an account
that pays 6% annual interest compounded monthly. At the beginning of each month he
adds $ 200 to his account. If he continues to do this for the next four years (so that he
makes 47 additional deposits of $ 200), then:
(a) define the amount in his account at the beginning of each month n, recursively.
(b) Solve the recurrence relation and the initial conditions obtained in part (a).
(c) How much will his account worth exactly four years after he opened it?
for the relation: an = an-1 + f(n), n 1. This method will be successful if, from our past
experiences, we can find a summation formula for:
n
f (i).
i 1
When a formula for the summation is not known, a technique called the Method
of Undetermined Coefficients will handle the problem of solving linear
nonhomogeneous relations.
The method of undetermined coefficients is a method that relies upon the
associated homogeneous relation obtained when f(n) is replaced by 0. This method,
therefore, considers a general or a total solution to the nonhomogeneous relation to be the
sum of two parts; which we shall call the homogeneous solution and the particular
solution.
To have a better insight to this method, consider the kth- order nonhomogeneous relation:
c0an+ c1an-1+ c2an-2+ … + ckan-k = f(n)
which is equivalent to:
c0an+ c1an-1+ … + ck an-k= 0 + f(n).
Thus, the relation can be separated into two parts, namely;
Homogeneous Part: c0an + c1an-1+ c2an-2 + … + ckan-k =0 and
Nonhomogeneous Part: c0an + c1an-1+ c2 an-2 + … + ck an-k = f(n).
The method of undetermined coefficients, then, solves the homogeneous and the
nonhomogeneous parts separately. If the homogeneous solution (the solution of
homogeneous part) and the particular solution (the solution of the nonhomogeneous part)
59
are denoted by an(h) and an(p) , respectively, then the general or total solution a n is the sum
of these two solutions:
an = an(h) + an(p).
Definitions
(1) A homogeneous solution denoted by an(h) is the solution that satisfies the linear
nonhomogeneous recurrence relation when the function f(n) is replaced by 0.
(2) The solution denoted by an(p) that solves the recurrence relation containing the
function f(n), i.e. , the nonhomogeneous part is called a particular solution.
(3) The solution: an = an(h) + an(p) , which is the sum of the homogeneous solution and the
particular solution, is called the general solution or the total solution of the linear
nonhomogeneous recurrence relation with constant coefficients.
It is self evident that we need to find a homogeneous solution an(h) and a particular
solution an(p) to arrive at a total or a complete solution of any nonhomogeneous relation.
To this effect, note that
(1) The homogeneous solution an(h) is obtained by the application of the standard
methods of solving linear homogeneous recurrence relations with constant
coefficients discussed in the preceding units of this chapter.
(2) As said earlier, there is no general technique for determining the particular
solution an(p) that fits a given difference equation. However, when the function
f(n) has a certain form, we can inductively suggest its form (i.e., the form
of an(p) ), in line with the nature of f(n).
Table 2.2. beneath may be used as a guide-table in choosing a suitable particular
solution an(p).
GUIDE-TABLE
No. Nature of the function f (n) Choice of the particular solution: an(p)
60
4 f(n) = nkrn or rn(A0+A1 n+ … Ak nk), if r is not
f(n) = (b0+ b1 n+b2 n2+ … + bknk) rn a characteristic root of the HRR.
is a product of any polynomial and an(p) =
exponential functions. nmrn (A0+ A1 n+ … + Ak nk) , if r is
a characteristic root of the HRR
with multiplicity m 1
Table 2.2
Remark:
The letters A, A0, A1, … , Ak-1, Ak denote constants called undetermined
coefficients. They will determined by substituting the particular solution a n(p) into the
given LNHRRWCC, Furthermore, note that r, k and m are also constants.
We shall now illustrate the method of undetermined coefficients using the
examples below.
Examples
61
(2) Particular solution
Since f(n) = 1 is a constant function, the particular solution is of the same form (see guide
table 2.2).
an(p) = A, a constant to be determined (undetermined coefficient).
Substituting this suggested solution in the given nonhomogeneous relation:
an- 7an-1+ 12an-2 = 1,
We get:
A - 7A + 12A = 1
6A = 1
1
A=
6
( p) 1
So, the particular solution is: an
6
(3) Total solution
Since the total solution is the sum of the homogeneous and the particular solutions:
an = an(h) + an(p),
then the required general (total) solution will be:
1
an = c1(3)n + c2(4)n + .
6
62
2. (The Towers of Hanoi)
Consider n circular disks with holes in their centers. These disks can be stacked on any of
the pegs (1,2, and 3) shown in Fig 2.1. To start with, the disks are stacked on peg 1 with
no disk resting upon a smaller one.
1 2 3
Figure 2.1
The objective is to transfer all the disks from peg 1 so that we end up with the original
stack on peg 3. To this end, we follow the rules beneath strictly.
(1) Move one disk at a time
(2) Never place a disk upon a smaller disk
(3) Never place a disk outside a peg.
(4) Peg 2 (and possibly peg 3) may be used as a temporary location for any disk
while transferring disks.
Now, find the minimum number of moves needed to transfer n disks from peg 1 to peg 3
so that we end up with a stack (on this peg) identical to the original one.
Solution:
For n 0, let an be the minimum number of moves needed to transfer n disks
from peg 1 to peg 3 in the manner described. To transfer these n disks on peg 1, we do
the following:
(a) Transfer the top (n-1) disks from peg 1 to peg 2, using peg 3 as a temporary
location. This takes an-1 steps or moves.
(b) Transfer the largest disk from peg 1 to peg 3. This takes one move.
(c) Finally, using peg 1 as a temporary location, transfer the (n-1) disks on peg 2
onto the largest disk now on peg 3. This requires another an-1 moves.
The minimum number of moves required to perform these three steps (a), (b) and (c) are
manifested for n= 1,2,3,4 disks in TABLE 2.3 beneath.
63
Peg 1
Minimum Number of Moves Required
Number From Peg 1 Largest disk From peg 2 Total Number
to from to of moves
of disks Peg 2 Peg 1 to peg 3 Peg 3 an
n
1 - 1 - 1
2 1 1 1 3
3 3 1 3 7
4 7 1 7 15
TABLE 2.3
From table 2.3 and the three steps (a), (b) and (c) describing the procedures followed
in transferring the n disks, we clearly see that there are:
an-1 + 1+ an –1 = 2an-1+ 1 moves. Consequently:
an = 2an-1 + 1, n 1; with a1 = 1 ….[1]
as an initial condition.
To find the minimum number of moves required to transfer n disks from peg 1 to
peg 3 in line with the four rules, i.e., to answer the problem on the Towers of Hanoi, we
need to solve the nonhomogeneous relation [1]. To this end:
(1) Homogeneous solution
The associated homogeneous relation is: an = 2an-1 with a characteristic equation:
r = 2. Based on this characteristic root r = 2, we write the general form of the
homogeneous solution as:
an(h) = c (2)n
64
an = c(2)n –1
We determine the arbitrary constant c by using the initial condition
a1 = 1 in the total solution. So,
a1 = c(2)1- 1 = 1 2 c-1 = 1 c =1.
Thus the required unique solution is:
an = 2n –1, n 1. ///
Exercise: Find the minimum number of moves required to transfer n disks (in the manner
described in the problem of the Towers of Hanoi) where n is;
(a)3 (b) 4 (c) 6 (d)10.
Solution:
an(h) =c (3)n
-2A1 = 1
3A1 – 2A0 = 0
1 3
A1 = - and A0 = - .
2 4
Therefore, the particular solution is an(p) = - 1 n - 3
2 4
65
(3) Total Solution
Since the total solution an is the sum of the homogeneous and particular solutions, it
follows that
an = c(3)n - 1 n - 3 .
2 4
To evaluate the arbitrary constant c, we substitute the initial condition a0 = 1 in the total
solution. Thus
a0 = c(3)0 - 1 (0) - 3 = 1
2 4
3
c- =1
4
7
c= .
4
Finally, the solution unique to the nonhomogeneous relation is:
7
an = (3)n - 1 n - 3 , n 0 ///.
4 2 4
1
12A2 = 3 A2
4
17
12 A1 – 34A2 = 0 so that A1 =
24
115
29 A2 – 17A1 + 12 A0 = 0 A0 = .
288
an(h) = c(4)n.
66
homogeneous solution is :
Solution:
The associated homogenous relation is: an –6an-1+ 8an-2 = 0 and its characteristic equation
is: r2 – 6r +8 = 0. The characteristic roots, upon solving the auxiliary equation, are r1 = 2
and r2 = 4.
Thus, the general form of the homogeneous solution is:
an(h) = c1 (2)n + c2 (4)n.
Since 4 is a characteristic root for the homogeneous case, then by item (4) of Guide-Table
67
2.2, we try: an(p) = n(4)n (A1 n +A0) as the general form of the particular solution.
c1+ c2 =8 c1 = 5
So that
2c1 + 4c2 = 22 C2 = 3.
Consequently, the explicit sequence of n that solves the give recurrence relation and its
initial conditions is:
an = 5(2)n +3(4)n + (n2 –n) (4)n, n 0
an = 5(2)n + (n2-n+3) (4)n, n 0 ///
Solution:
Note: When f(n) comprises a sum of constant multiples of different types of functions of
n, with each summand form a nonhomogeneous relation. To each of these formed
relations, find a corresponding particular solution separately. Then add these particular
solutions to obtain a solution that stands for the given function f(n) as a whole. We follow
this note to solve for a particular solution that corresponds to f(n) = -4n+3(2)n
f(n) = -4n+3 (2)n is a sum of a polynomial and an exponential functions. So, we
form the relation.
68
an = 3an-1 – 4n
an = 3an-1 + 3(2)n
and treat them separately. Thus
(1) The general form of the particular solution of the relation:
an = 3an-1 – 4n ….(1)
( p)
an 2n+3 1
( p)
an2 6 (2)n
( p) ( p)
an(p) = an1 an2 = 2n+3- 6(2)n.
69
Consequently, the required unique (complete) solution of the given nonhomogeneous
recurrence relation is;
an = 5(3)n + 2n+ 3-6(2)n
an = 5(3)n – 6 (2)n + 2n + 3, n 1 ///
Exercise 2.5
1. Find a recurrence relation which will be solved explicitly by each of the following
discrete functions (sequences); where A and B are constants.
(a) an = A(3)n+ B(4)n (b) an= (A+Bn) (-2)n (c) an = 2(3)n
n n n
(d) an = A(3) + B(5) (e) an = A(4) . (f) an = (A+Bn) (6)n
2. Solve the following sets of recurrence relations and initial conditions.
(a) fn – 2fn-1 = 6n, n 1; f1 =2.
(b) fn = 3fn-1 –2fn-2 + 2; n 2 with (a0, a1) = (1, 1).
1
(c) fn+2 + 2fn+1 – 15 fn = 6n +10, n 0 ; f0= 1 and f1 = - .
2
(d) fn = 3fn-1+ n2-3, n 1; f0 =1.
(e) fn+1+ 2fn = 3+4n , n 0 ; f0 = 2.
(f) fn – 3fn-1 + 2fn-2 = n2, n 2; f0= 0 and f1 =0.
(g) fn – 4fn-1 + 4fn-2 = 3n+2n, n 2 ; (f0, f1) = (1,1).
(h) fn+2 + 3fn+1 +2fn =3n, n 0; (f0, f1) = (0,1).
(i) fn+2 + 4fn+1 + 4fn = 7, n 0; (f0, f1) = (1,2).
(j) fn –5fn-1 = 5n, n 1; f0 =3.
(k) fn+2 + 4fn+1+ 4fn = n2, n 0 ; (f0, f1) = (0,2).
3. The solution of the recurrence relation:
c0an+ c1an-1 + c2an-2 =6
is: an = 3n+ 4n+2; for n 0. Determine the constants c0 , c1 and c2 in the relation.
4. Solve the recurrence relation: an+2 – 6an+1 + 9an = 3(2)n + 7 (3)n, n 0
with a0 = 1 and a1 =4.
5. Find the total solution of the recurrence relation
an+3 – 3an+2 + 3an+1 – an = 3+5n, n 0.
6. Yana borrows $ 2500, at 12% annual interest compounded monthly, to buy a
computer. If the loan is to be paid back over two years, what is his monthly payment?
7. The total solution of the recurrence relation:
an+2 + b1an+1+ b2 an = b3 n + b4 , n 0.
Where b1, b2, b3 and b4 are constants is: an= c1(2)n+ c2(3)n + n-7.
Find bi, 1 i 4.
8. (Problem on Analysis of Algorithms)
For n 1, let S be a set containing 2n real numbers. How many comparisons must be
made between pairs of numbers in S in order to determine the maximum and
minimum elements of S?
9. Environmental records show that for a certain lake the population of a specific species
of snail increases at a rate three times that of the prior year. Starting with 3000 such
snails, and finding 3500 of them in the following year, we remove 200 of them from
70
this lake to increase their numbers in other lakes. Continuing to remove 200 of the
snails at the end of each year, if an represents the snail population in the original lake
after n years, find and solve a recurrence relation for an, n 0.
10. Solve the following recurrence relations.
(a) a2n+2 – 5a2n+1 + 6a2n = 7n ; n 0 and a0 = a1 = 1.
(b) an 2 – 2an-1 = 0, n 1, and a0 =2 (Hint let bn = log 2 an for n 0.)
71
PART II: Graph Theory
Chapter 3
3.0 Introduction
Graph theory is a branch of mathematics that deals with arrangements of certain objects
and relation ships between these objects. Graph theory is broadly classified into two:
nondirected graphs and directed graphs (digraphs). The next chapter, chapter 4,
exhaustively deals with digraphs. In chapter 3 and 4, we will discuss a number of
important cases of nondirected and directed graphs, as well as a few important properties
that may be possessed by graphs, such as planarity and colorability.
Definition: Two or more edges joining the same pair of vertices are called multiple
(parallel) edges. An edge joining a vertex to itself is called a Loop.
Depending on loops (self loops) and parallel edges we state the following types of
graphs.
72
Simple graph: A graph with no loops and parallel edges is called simple graph.
Multigraph: A graph which consists of parallel (multiple edges) is called a multigraph.
Pseudo graph: A graph which consists of loops and parallel edges is called pseudo
graph.
Examples
1. Electrical network
Transistors: - vertices
Wire: - edges.
2. Telephone communication
Telephones and switching center:-vertices
Telephone lines: -edges
4. Organization chart
People:-vertices
Link between the people:- edge
Note: For a graph with loops, each loop contributes 2 to the degree of the corresponding
vertex.
73
Example1: Determine the degree of each vertex of the graph given below.
v1 v2 Solution:
deg (v1)= 2
deg (v2)= 3
v3 v4 deg (v3)= 2
deg (v4)= 3
Definition: - i) A vertex is said to be even if its degree is even number and odd if its
degree is odd number.
ii) A vertex of degree zero is called isolated vertex.
iii) A vertex of degree one is called pendant vertex.
V1
V2
G:
V3 .V4
G = (V, E), where i) V= v1, v 2, v3 , v 4
ii) E = v1, v 2 , v 2, v 3
deg (v1) = 1 = deg (v3), deg (v2)=2, deg (v4) = 0
V2 and V4 are even vertices
V1 and V3 are odd vertices
Moreover,
- V3 and V4 are not adjacent
- V2 and V3 are adjacent
Let G be a graph. The minimum and maximum degrees of G are denoted by (G) and
(G ) respectively and given by:
(G)= min deg(v ); v V (G )& (G ) = max deg v; v V (G )
Example: Find the minimum and maximum degree of G given below.
v1 v2
G:
v3 v4
Solution: (G) =2, i.e., deg(v1)
(G ) = 4, i.e., deg(v2)
3.2 The hand shaking lemma
74
In any graph:
Each edge has two ends and thus contributes 2 to the sum of
vertices degrees.
In a group of people shaking hands in a party, exactly two hands
are involved in each hand shakes
Theorem: In any graph, the sum of all the vertex degrees is equal to twice the number of
n
edges. That is, deg(v ) 2 E
i 1
i where E is an edge list.
n
Then, if E represents the number of edges in G, 2 E accounts for the sum deg(vi).
i 1
n
Therefore, deg(v ) 2 E
i 1
i
Example 1: If a graph G has 10 edges with 2 vertices of degree 4 each and all others are
of degree 3 each, and then find the number of vertices V (G ) .
Solution: E =10 and 2 vertices have degree 4. Let the other vertices which are of degree
3 each be k in number.
n
deg(vi) 2 E , n = 2 + k
i 1
2(4)+k(3)=2(10)
8+3k=20 3k=12 k = 4
Therefore, n = 2+k = 2+4 = 6
Corollary 2: If t = (G ) is the maximum degree of all the vertices degrees of a non
directed graph G, then 2 E t. V .
Adjacency Matrix
Definition: Suppose G is a graph with m vertices and suppose the vertices have been
ordered, say v1,v2,- - - ,vm. Then the adjacency matrix A= [aii] of the graph G is the
m n matrix defined by:
aij = n, if there are n edges joining vi and vj
0, other wise.
Examples
1. Draw the adjacency matrix for:
V2 V3
V1
G:
V4 V5
Solution: Let the vertex set be ordered and labeled as V = {v1, v2, v3, v4, v5}
Then the adjacency matrix A is:
76
v1 v2 v3 v4 v5
v1 0 1 0 1 0
v2 1 0 1 0 1
A=
v3 0 1 0 0 0
v4 1 0 0 0 1
v5 0 1 0 1 0
e1
v1 v2
e2
e3
v3 v4
e4
Solution: Let the vertex set be ordered and labeled as V = {v1,v2, v3, v4}
Then the adjacency matrix A is:
v1 v 2 v3 v 4
v1 0 2 0 0
A= v 2 2 0 1 0
v3 0 1 0 1
v4 0 0 1 0
v2
v4.
v3
Solution: Let the vertex set be ordered and labeled as V = {v1,v2, v3, v4}
Then the adjacency matrix A is:
77
v1 v2 v3 v4
v1 0 1 1 0
A= v2 1 0 1 0
v3 1 1 1 0
v4 0 0 0 0
Note:-
a. If the entries in a vertex are all zero, then the vertex is isolated.
b. If G is a simple graph, then the adjacency matrix A(G) :
i. Has leading diagonal entries all zero, aii=0 for all i.
ii. Is a Boolean matrix or a (0,1) matrix.
c. In the adjacency matrix of any graph G, the degree of each vertex vi is:
i. The sum of all the entries in the ith row (or jth column) if there is
no loop at vi.
ii. Row (or column) sum plus number of loop(s) if there is (are)
loop(s) at vi.
v1 v2 v3 v4
v1 1 2 0 1
A= v 2 2 0 0 1
v3 0 0 0 0
v4 1 1 0 0
Then:
a) Find the degree of each vertex.
b) Find the cardinal number of the edge list.
c) Draw the graph.
78
v2
V1
.v3
v4
Incidence Matrix
Definition: Suppose G is a graph with vertices v1,v2,…,vm. The incidence matrix I= [bij]
of the graph G is given by:
bij = 1,if ej is incident on vi
0, otherwise
Note: 1. The incident matrix of a graph is not necessarily a square matrix.
2. An incident matrix I has a row for each vertex and a column for each edge.
Example: Find the incidence matrix I for the graph shown below.
v1 e1 v2
v5 . e5 e6 e2
e7
e3
v4 e4 v3
e1 e2 e3 e4 e5 e6 e7
v1 1 0 0 0 1 0 0
v2 1 1 0 0 0 1 1
I=
v3 0 1 1 1 0 0 0
v4 0 0 0 1 1 1 1
v5 0 0 0 0 0 0 0
Note: 1. 1 appears in a column only once the edge dominating the column is a loop.
2. All the entries in a row are zero the vertex is isolated.
3. 1 appears twice in a column the edge dominating the column has two end
points.
4. Sum of all the entries in every row is the degree of the vertex leading the row if
there is no loop and the sum plus n if there are n loops at this vertex.
Adjacency table
79
Used to represent a graph in terms of a table depending on the adjacency
relationship of vertices.
Example1: consider the above example. The adjacency table is:
1 2 3 4 5
2 1 2 1
4 3 3 2
4 4 3
Note that (1,2,3,4,5) = (v1,v2, v3, v4)
1 dominates 2 and 4 v1 is adjacent with v2 and v4.
2 dominates 1 and 3 v2 is adjacent with v1 and v3.
etc.
Example2: Draw the adjacency table for G.
v1 v2
G:
v3
v4
v5
Solution: Adjacency table
1 2 3 4 5
2 1 1 3 3
3 3 2
4
5
Drawbacks of adjacency structure (adjacency table)
Impossible to determine parallel edges.
Impossible to determine degree of a vertex and hence hard to determine total
number of edges for non simple graphs.
T W E H1 W T H2 E
T H2
H1 H2 H3 H3 E H1 W H3
G1 G2 G3
G1 and G2 are the same but they look different.
G1 and G3 are different but they look the same.
80
Definition: Graphs G(V,E) and G*(V*,E*) are said to be isomorphic if there exists a one-
to – one correspondence f : V V * such that {u,v} is an edge of G iff f (u ), f (v ) is
an edge of G*.
v6 H: f
G: v5
a b e
V3 v4
3.4.1 Subgraph
A graph H is called a subgraph of G if every vertex of H is also a vertex of G and
every edge of H is also an edge of G.
Symbolically H is a subgraph of G if V(H) V (G ) and E ( H ) E (G ).
Example: for the graph G, construct some of its subgraphs.
v1 v3
81
G:
v2 v4 v5
H2:
H1:
v5 v2 v4
- V ( H 1 ) V (G ) and E ( H 1 ) E (G )
- V ( H 2 ) V (G ) and E ( H 2 ) E (G )
H 1 and H 2 are subgraphs of G
Note:
1. A null graph is a graph with V {} and E = {} .
2. A graph and its null graph are trivial subgraphs.
3. A subgraph H of G is called a spanning subgraph of G iff V(H) = V(G).
4. A subgraph H of G is called a proper subgraph if H G.
v1 v2 v1 v2
G: G:
v4 v3 v4 v3
c
Note: If two graphs G1 and G2 are isomorphic graphs, then G1 and G2 c are isomorphic.
82
3.5 paths and connectivity
Paths:
Let G be a graph and e be an edge in G with end points u and v. Then the ordered triple
(u,e,v) is a step (walk) in G.
G:
P4
p5 P6
Take the following sequences of vertices.
( P4 , P1 , P2 , P5 , P1 , P2 , P3 , P6 )
( p 4 , p1 , p5 , p 2 , p 6 )
( p 4 , p1 , p5 , p 2 , p 3 , p 5 , p 6 )
( P4 , P1 , P5 , P3 , P6 )
p ( P4 , P1 , P2 , P3 , P5 , P4 )
is an open path form p4 to p6 but it is not a cycle and not a trial as well .
83
is not a path since there is no edge {p2,p6}in G.
is a trial (no edge is used twice) but not a cycle.
The sequence is a simple path as well as a trial between p4 and p6 but not the shortest
path between p4 and p6.
The shortest path between p4 and p6 is (p4,p5,p6) which has length 2.
The sequence p is a circuit of length 5.
v6 v5
v2
v6
H: v1 v3 v5
V4
v7
Solution:
G is a connected graph because every pair of vertices in G forms a path.
H is a disconnected graph because no path can be constructed from vi, i = 1,2,3,4 to
vj, j = 5, 6, 7.
Remark: 1. A disconnected graph is made up of two or more disjoint connected
subgraphs.
2. A graph is connected iff it has only one component.
3. The component of a graph is denoted by C(G).
Theorem: - A connected graph with n-vertices must have at least n-1 edges. (i.e,
E n 1).
Example 2: a) A connected graph with 2 vertices must have at least (2-1) = 1 edge.
A B
v2
v1 v3
c). suppose that G is a graph with 6 vertices and 4 edges. Can G be connected? Why?
84
Solution: - A connected graph with 6 vertices must have at least: E = (6-1) = 5.But the
number of edges in G is 4.
Hence G cannot be a connected graph.
.
. . .
. .
(a) (b) (c) (d)
K4: k5 :
Remark:
1. It G is a graph with n-vertices and is regular of degree r, then E = ½ nr
2. The complement Gc of a simple graph G with n-vertices is the subgraph of the
complete graph kn.
Bipartite graphs: A graph G is said to be bipartite if its vertices V can be partitioned into
two subsets M and N such that each edge of G connect a vertex of M to a vertex of N.
(i.e. none of the edges in G connect vertices with in the same set M or N).
By a complete Bipartite graph we mean that each vertex of M is connected to each
vertex of N; this graph is denoted by Km,n where m is the number of vertices in M and n
is the number of vertices in N (m n) .
Example 1: Complete bipartite graphs K1,5, K2,4, K3,3 are shown below in a, b and c
respectively.
a. b. c.
Example 2: Is the graph given below bipartite? Or complete bipartite?
v2 v3
v1 v4
v6 v5
Solution: Yes it is bipartite since we can partition the vertex set into
M={v1,v3,v5} and N= {v2,v4,v6} such that none of the edges in G connect vertices with in
the same set M or N.
But it is not complete bipartite graph. (why?)
86
Theorem: In a complete bipartite graph Km,n; the number of edges is given by E =mn.
Corollary: A complete bipartite graph Km,n is not a complete graph except K1,1.
Eulerian Path:
Definition: An Eulerian path in a graph G(V,E) is a path which uses each edge in E
exactly once.
An Euler path that begins and ends at the same vertex is called Eulerian trial.
A graph that contains an Eulerian (closed) trial is called an Eulerian graph.
Theorem: A connected graph is Eulerian iff all of its vertices have even degree.
Examples
1. Consider the graph G and answer the following questions
a. Show that G has an Euler closed trial.
b. Find an Euler trial starting and ending at U.
U
V Z
G:
W Y
X
Solution a) G is a connected graph and degree of each vertex is even (i.e.
deg(u)=deg(x)=2;deg (z)=deg(y)=deg(u) = deg(u)= deg(v)=4).
b) One Euler trial beginning and ending at U is UZWVZYXWYVU.
2. Explain why the two graphs, G1 and G2, given below are not Eulerian (exercise).
a) b)
Graph G1 Graph G2
87
Theorem: A graph G with 3 or more vertices contains an Euler path if and only if:
1. G is connected
2. G has exactly two vertices with odd degrees
3. The Eulerian path in G begins at one odd vertex and ends at an other odd
vertex.
E B
D C
Solution: - G is a connected graph.
E G has exactly two odd vertices D and C.
G: By the theorem, G has an Eulerian path that begins at C(or D) and ends at D(or C).
G is a semi Eulerian.
One possible Euler path is: CBAEBDCED
D
3.7.2 Hamilton Graph
Hamilton Paths:
- a path that visits every vertex in a graph G exactly once is called a Hamilton
path.
- A closed Hamilton path is called a Hamilton cycle.
- G is called a Hamiltonian graph if it admits a Hamiltonian cycle.
Remark: An Eulerian trial traverses every edge exactly once, but may repeat vertices
while a Hamiltonian cycle (circuit) visits each vertex exactly once but may repeat edges.
Exercise: Draw a Hamilton graph having Hamilton cycle that traverse an edge more than
once.
Example: Consider the following graphs G1 and G2
A B
v1 v2 v3 F
G1:
G2:
E
D C
v6 v5 v4
G1 is Hamiltonian but not Eulerian. G2 is Eulerian but not Hamiltonian
88
Properties of Hamiltonian graph
G satisfies the condition deg(vi)+deg(vj) 7 for all Paris of non-adjacent vertices vi and
vj.i = j = 1, …, 7.
G is Hamiltonian.
n
Corollary: If G is a simple graph with number of vertices n 3 and if deg(v) for
2
all vertices v in G, then G is Hamiltonian.
v1 v2 D C
Consider first G:
n
- G satisfies the condition of the corollary. i.e. G is simple and deg vi for all
2
i = 1, 2, 3,4,5,6.
- G is a Hamiltonian graph
- One possible Hamiltonian cycle is v5 v1 v6v2 v4 v3v5
Now consider H:
- H has a Hamiltonian cycle, say ABCDEA
- H is a Hamiltonian graph
But deg(u)=2 for all vertices u {A, B, C, D, E}.
i.e. deg(u)=2 < n/2 = 5/2 = 2.5.
The converse of the corollary does not hold.
89
3.8 Trees and Forests
Definitions:
A graph T is called a tree if T is connected and T has no cycle.
A forest G is a graph with no cycles; hence the connected components of a forest
G are trees.
A graph without a cycle is said to be cycle-free (acyclic) graph.
The tree consisting of a single variable with no edges is called the degenerate tree.
Since a loop is a cycle of length one, then a tree is a loop free graph.
i) ii) iii) v)
G1
an isolated
vertex G2
A graph on G3
A graph on G4
two vertices a graph on 8 vertices.
three vertices.
G1 is a degenerate tree.
Since these graphs G1, G2, and G3 are connected acyclic graphs, i.e., connected graphs
with no cycles, then they are trees.
G4 is a forest not a tree as it is not connected.
Example 2:- Which of the following graphs is a tree. If the graph is not a tree, justify
why it is not.
v1
a t
i) ii) iii)
v2
c v4 u v
d v6
v5
b v3 w x y z
h v8
v7 r
e f g
v9 v14 p q
v10 v13
G1 v11 G3
v12
G2
Solution:-i) The graph G1 is a tree since it is connected and acyclic.
ii) The graph G2 is not a tree. Even though it is connected, it contains the cycle
V1V2V3V4V1. Hence the acyclic property of a tree is violated.
iii) The graph G3 is not a tree. Though G3 is acyclic, it is not connected. Hence the
connectedness property of a tree is violated.
Notation: - If a graph G is a tree, then it is denoted by T
Note: Consider a tree T. Clearly there is only one simple path between any two vertices
of T.
- T is connected, but would be disconnected if any one edge is removed.
90
- T is acyclic, but would contain a cycle if any edge is added.
Example 3: Sketch all the trees T with exactly 6 vertices.
Solution: - There are 6 non isomorphic trees on 6 vertices which are shown in the
following diagrams.
1) 3) 4)
2) 5) 6)
Note 1) In each of the trees with 6 vertices, there are exactly 5 edges.
2) In each tree T, there are some vertices of degree 1. These vertices (of degree1)
are called leaves.
3) Every tree T with at least one edge has at least two leaves.
4) The edges of a tree T are called branches.
Theorem: Let G be a graph with n>1 vertices. Then the following are equivalent.
i) G is a tree
ii) G is cycle-free and has n-1 edges
iii) G is connected and has n-1 edges.
Example 4: A tree has 4 vertices of degree 3 and 3 vertices of degree 2. The remaining
vertices have degree1. Find the total no of vertices in the tree.
Solution: Let n be the number of vertices of the tree.
No of vertex 4 3 n-7 n
Z Y X
Z X
G Y
ii) iii)
V W
V W
Z Y X
Z Y X
Note: - For any connected graph G, we can find a spanning tree of G by any of the
following methods.
a) Cutting - down method: We start by choosing any cycle in G and remove one
of its edges - (destroying a cycle containing this edge). We repeat this procedure
until no cycle is left in the resulting graph.
b) Building - up method: We select edges of G one at a time in such a way that the
selection on edges does not create a cycle. Repeat this procedure until all the vertices
of G are included in the resulting graph.
Example: - Consider the graph G in the above example once more again. Choose the
edges: VZ, ZY, YX and XW one at a time. Then this choice of edges:
Includes all the vertices of G
Does not create a cycle.
Hence, the 2nd spanning tree of G is obtained by this selection of edges.
92
Consider the complete graph on 4 vertices i.e., K4. It has two common visual
representations as shown in fig. 1 and fig. 2
A B W
D C Y X
figure 1 figure 2
In the representation of K4 shown in fig. 1, the two edges AC and BD appear to cross at a
point where there is no vertex. But in the second depiction, i.e., K4 as represented in fig.
2, this crossing of edges doesn't happen (except at a common vertex).
This brings us to the topic of planarity. The graph in figure 2, the second
depiction of K4 is called a plane representation of K4. Not every graph has a plane
representation. A graph which has a plane representation is called a planner graph.
Example 1: K4 is a planar graph. The graph K4 given in fig. 1 has planar depictions (or
plane drawings) shown in fig. 2. a , b and c.
a) b) c)
Figure 1
Figure 2
Example 2: A complete graph k5 and a complete bipartite graph k3,3 are non planar.
Faces and planar Graphs
Suppose we draw a planar graph on the plane of a paper. If we cut the graph along its
edges, then the plane of the paper splits in to a number of regions. These regions are
called the faces of the graph. In other words, a plane representation of a planar graph
divides the plane in to regions called faces.
93
Definition: If G is a planar graph, then the plane representation of G splits the plane into
regions called faces of G. The unbounded region outside the graph is called the infinite
face. If f is any face of a graph, then the degree of f , denoted by deg(f), is the number of
edges encountered in a walk(or path)that begins and ends at the same vertex around the
boundaries of the face f. If all faces have the same degree r, then G is a face-regular graph
of degree r.
Example: Let G be a labeled graph with faces f1,f2 , f3 and f4 shown in the figure below.
G has four faces f1,f2, f3 and f4 . f4 is an infinite face of G since it is unbounded region
outside the graph. The degrees of the faces are:
V1 V2 f4 V3
V10
f2
f1 V4
V8 V9
f3 V5
V7 V6
G
Euler's formula
A planar graph may have different plane representations. The number of faces resulting
from each depiction (or embedding) is always the same. If G is a planar graph, then the
number of vertices, number of edges and number of faces in G are interconnected. This
interconnection of vertices, edges and faces of a planar graph is given by Euler's formula.
94
For any connected planar graph G,
/V/ - /E/ + /F/ = 2
Where /V/ denotes the number of vertices, /E/ the number of edges and /F/ the number of
faces in G.
Example 1: Verify Euler's formula for the planar graph K4.
Solution: One possible plane representation of K4 is given in the figure below.
V1
e3
e2
e1 f1 f2 f4
V3
e5 e4
f3
V4 e6 V2
K4
Example 2: How many faces are there in a cubic planar graph on 10 vertices?
Solution: A cubic graph is a 3 – regular graph, i.e., the degree of each vertex is 3.
Hence the sum of the degrees of all the vertices is:
10(3) = 2/E/ /E/ = 30/2 =15. Since /V/ =10, then by Euler's formula:
/V/ -/E/ + /F/ =2 /F/ =2 - /V/ +/E/ = 2 –10 + 15 = 7
Therefore, there are 7 faces in the graph.
The following corollaries are usually used to prove the nonplanarity of a graph.
Proof: It is easy to see that Kn planar for n = 1,2,3,4. Thus, we have only to show that Kn
is nonplanar if n 5 , and for this it suffices to show that K5 nonplanar. We prove this by
indirect argument.
First find the contra positive of the statement:
"If K5 is a planar graph, then /E/ 3 v 6 " for a complete graph K5
Contra positive: If, in a graph K5, /E/>3/V/-6, then G is non planar
But/V/=5 and /E/=10 in K5 and 3/V/=3(5) =15
3 / V / 6 15 6 9
10 9 / E / 3 / v / 6
Therefore K5 is non planar and hence Kn nonplanar for n 5 .
A traditional application of the theory of planar graphs is in the study of map colouring.
The problem is to take a map with various countries, some bordering each other, and to
find how many colors are required to color the countries in such a way that no two
bordering countries have the same color.
If we let the countries be represented by vertices and the borders by edges, then the
coloring problem becomes a problem in the theory of planar graphs.
Examples:
1. Given the map of a country with its seven states indicated by the letters
A, B, .................., G, find a planner graph that represents the map and the number of
colors needed to color the map so that no two bordering states have the same colour.
E Map of a country.
A
D F
C
B
G
Solution: Let the states A, B, C, D, E, F, and G in the map be represented by vertices and
an edge be drawn between two vertices iff the states corresponding to these vertices are
bordering states on the map. Then one possible planar graph representation of the map is
the following.
A E
D
F
C 96
G
B
Besides the plane graph representation of the map, we need to know the number of
different colors required to paint the vertices such that adjacent vertices have different
colors. Since the vertices A, B, C and D are mutually adjacent, each need a different
color. By being consistent with the conditions of the problem, the vertices E, F, and G
can be painted by the color of vertices A, B and C. Thus with four colors we can properly
color the seven vertices of the graph. Consequently, we need four different colors to paint
the map under the stated Situation.
4-colouring
D
C
B
Example 2: In each of the graphs below, determine the number of colors needed to color
the vertices of the graph in such a way that no pair of adjacent vertices have the same
color.
a) b) c)
A B C
A B C
D F
E
V1 V2
G H I
G1
G2 G3
Solution:
a) The graph G1 is 2- colorable. The set of non-adjacent vertices X= {A, B, C} can
be painted by one color and the other set of non- adjacent vertices y = (V1, V2} by
another.
97
G2 is 3- colorable as shown by the numbers at the vertices 1 2 1
of the graph.
This is because G2 contains a cycle of odd length.
b) Left as an exercise
2 2
3
Remark:
A bipartite graph is 2 colorable.
A graph G is bipartite iff every cycle (circuit) in G has
even length. 1 1
A graph with a cycle consisting of an odd number of vertices 2
(i.e., a cycle with an odd length) can not be painted with only
two colors (not 2- colorable).
Chromatic Number
Definitions:
1) For a positive integer K, a graph G is said to be K- colorable or K- colored if there
exists a coloring of G which uses K colors.
2) The chromatic number of graph G, denoted by X(G), is the minimum number of
colors needed to paint (or color) G so that no two adjacent vertices receive the
same color.
Examples
1. Find the chromatic numbers of the graphs G and H below.
a) A B C A D
b)
D E F B C E F
G H
Solution:
a) X (G) = 2; since G is a rectangular grid.
b) X (H) = 3; since H contains a cycle ABCA with 3 vertices A , B, C - which is odd
cycle.
2. What is the chromatic number of a cycle?
Solution:
The chromatic number of a cycle is either 2 or 3. It all depends on the type of the cycle. If
the cycle has an even number of vertices (i.e.; it is an even cycle), then it is 2- colorable.
Otherwise, the cycle is three colorable.
A A B
A B
A
F C
E B
E D
C D
B C D C 2- Colorable
Rules on chromatic numbers
3- Colorable 2- Colorable 3 - Colorable
98
Rule 1. If G is a simple graph whose maximum vertex degree is d,
then X(G) ≤ d+1
Rule 2. X(G) V , where V is the number of vertices of G.
Rule 3. X(Kn) = n, where X(Kn) is a complete graph with n vertices.
Rule 4. If some subgraphs of G requires k colors then X(G) k .
Welch-Powel algorithm
Step 2: Assign the first color c1, to the first vertex in the sequence and then in sequential
order, assign c1, to each vertex w/c is not adjacent to a previous vertices.
Step 3: Repeat step2 with a second color c2 and the subsequence of non colored vertices.
A1 A2 A3
A4 A5 A6
A7 A8
Solution
Ordering the vertices in decreasing order of degrees we get:
{A5,A7,A3,A4,A2,A1,A6,A8}.
Now assign the first color c1 for A5 and A1.
Then we obtain the subsequence {A7,A3,A4,A2,A6,A8}to assign the second color c2.
That is assign c2 for A7,A6 and A2
Finally assign the third color c3 for A3, A4 and A8
G is 3 colorable
X (G ) 3
99
Exercises
1) Give an example of a graph G with n vertices for which X (G) = n
2) Let Cn be a cycle graph with n-vertices find X (Cn) for all n.
3) Find a 4 - coloring of the graphs G and H in the figure if possible. For each graph,
determine whether its chromatic number is 4 or not.
a)
A B C b) A B C
D E F D E F
Graph G Graph H
4) (The scheduling problem)
Suppose you want to schedule a final examination program such that a student
will not have more than one exam a day. If we call the courses 1,2,3,4,5,6 and 7, then a
star in the ij entry, in the table, means that the courses i and j have at least one student in
common. So you can not have them on the same day. What is the least number of days
you need to schedule all the exams?
1 2 3 4 5 6 7
1 * * * * *
2 * * *
3 * * *
4 * * * *
5 * *
6 * * * *
7 * * *
F B C D E
E F B F
B
E C
I H G
D C
D
G3
G1 G2
100
7. What is the minimum number of colors needed to color the diagram so that adjacent
regions are different in color?
C
A B
D
E
H
F
G
101
Chapter 4
Directed Graphs
4.1 Introduction to Digraphs
Directed graphs are graphs in which the edges are one way. Such graphs are frequently
more useful in various dynamical systems such as:
Digital computer
Flow system
Communication system
Transportation system
Definition: a digraph D is a graph consisting of two things:
i) A set V whose elements are called vertices, Points or node of D
ii) A set E whose elements are order pairs (u,v) of distinct vertices called arcs or
directed edges of D.
Suppose e = (u,v) is a directed edge in a digraph D. Then the following terminologies are
used.
e begins at u and ends at v.
u is the origin or initial point of e where as v is destination or terminal point of e.
v is the successor of u and u is the predecessor of v.
u is adjacent to v where as v is adjacent from u
If u = v then e is a loop.
The set of all successor of a vertex u is : suss (u ) {v V : (u , v) E}
Example 1: Let D be the directed graph shown in the following figure.
A e1 D
e4
e3 e6 e7
e2
e5
B
C
e8
e4 = (D,B) (B,D)
e8 is a loop.
Succ(A) = {D}. That is D is adjacent from A.
e2 and e3 are parallel arcs.
Definition: If D is a digraph, then the graph obtained by ignoring the direction of the arcs
in D is called the underlined graph of D.
Example 2: Consider the ff. diagraph
v2 Whose underlying graph is
v3 v6
V1 v2
v3 v6
v1
v4 102
v4
Sub diagraph: Let G(V,E) be a diagraph and let V be a subset of vertex set V of G.
Suppose E is a subset of E such that the end points of the edges in E belongs to V .
Then H V , E is a sub diagraph of G.
A e1 D e4 C
e4 e6 e7
G: e2 e3 e6 e7 B
e8 e5 D
e8 e5 C
B
Fig. A Fig. B
Outdeg(A) = 1 indeg(A)= 2
Outdeg(B) = 4, indeg(B) = 2
Outdeg(C) = 1, indeg(C) = 2
Outdeg (D) = 2, indeg(D )= 2
Theorem: The sum of the out degrees of the vertices of the diagraph G equals the sum of
the in degrees of the vertices, which equals the number of edges in G.
Note: A vertex u in a diagraph with zero in degree is called a source and a vertex u with
zero outdegree is called a sink.
A
A and D are sources since indeg(A) = indeg(D) =0
C B and C are sinks since outdeg (B) = outdeg(C)= 0
B
103
4.2. Matrix Representation of a diagraph
v1 v2
D1:
v3
v5 v6
Solution: Let the vertex set V of D1 is labeled and ordered as V= {v1,v2,v3v4 v5}. Thus,
the adjacency matrix for D1is:
V1 V2 V3 V4 V5
V1 0 1 0 1 1
A(D1) = V2 0 0 0 1 0
V3 0 0 0 0 0
V4 0 0 0 0 0
V5 0 1 1 0 0
Note: - The sum of entries in the jth column is the same as indeg(vj)
- The sum of entries in the ith row is the same as outdeg(vi)
- Sum of entries in A(D) is equal to the total number of arcs.
0 1 0 0 1
1 0 0 1 0
Example 2: If A(D2) = 0 0 0 0 0
1 0 0 0 0
0 1 0 2 0
Solution: a) Let V = {v1,v2,v3,v4 v5} be a vertex set for D2 and let vi leads the ith row for
all i and the same sequence is used for the columns.
Then: outdeg(v1) = 2 indeg (v1) = 2
outdeg (v2) = 2 indeg (v2) = 2
104
outdeg (v3) = 0 indeg (v3) = 0
outdeg (v4) = 1 indeg (v4) = 3
outdeg (v5) = 3 indeg (v5) = 1
b) The total number of arcs in D2 is 6(1)+2=8
c) The graph represented by A(D2) is:
v1 v2
D2: . v3
v5 v4
Note: An incidence matrix has a row for each vertex and a column for each arc.
Example: Find the incidence matrix I (D) of the diagraph in the figure.
e1
v1 v2 Solution: The incidence matrix for D is given as:
D3: e4 e5 e1 e2 e3 e4 e5 e6
e6 v1 1 0 0 1 0 0
e3 I(D3) = v2 -1 -1 0 0 1 1
v4 v3 v3 0 1 -1 0 0 0
v4 0 0 1 -1 -1 -1
105
Example 1: consider the above diagraph D3
i) D3 is not strongly connected (why?)
ii) D3 is unilaterally connected and it is weak as well.
Spanning Path: is a path that visits all the vertices of a graph G, where G is directed or
non-directed.
Theorem: Let D be a diagraph. Then:
(i) D is strong D has a closed spanning path.
(ii) D is unilateral D has a spanning path.
(iii) D is weak D has a spanning semi-path.
Note: A semi-path is the same as a path (but not a path) except that the arc ei may begin
at either vi-1 or vi and end at the other vertex. That means there is at least one arc
opposing the direction of the path.
Example 2: Let D4 be the diagraph shown in the figure. Then describe the connectivity
of D4. A D
D4:
B C
Solution:
i) D4 is weakly connected since the under lining graph is connected or D has a spanning
semi-path, like ABCD.
ii) D4 is unilaterally connected since it has a spanning path, like ADBC or BADC.
iii) D4 is not strongly connected since C is a sink (i.e. every vertex is not reachable from
C) or since D has not a closed spanning path.
d j
b j q
a
e
c h
f
Directed tree rooted at a
Definitions:
i) The length of the path from the root r to any vertex u is called the level of u.
ii) The maximum vertex level is called the depth of the tree.
iii) Those vertices with zero outdegree are called leaves of the tree.
iv) The directed path from a vertex to a leaf is called a branch.
Example:- Consider the rooted tree T.
a
c
b
h
d e g
f
k Tree T
The root of the tree is vertex a.
The vertices d, k, j, f, g, and h with out degree zero are called leaves of the tree.
Vertex a is at level 0.
Vertex b and c are at level 1.
Vertices d, e, f, g and h are at level 2.
Depth of t is 3 which is level of k.
Definition: If there is a directed edge from a vertex U to V, we say that U is the parent
of V and that V is the child of U.
Note: - We say that a is a parent of d and d is a child of a since there is a direct edge
from a to d.
- Vertices of the same parent are called siblings e.g. d&e, a, b&c, i&j are siblings.
- Vertices which have children are called internal vertices e.g. a, b, c, f, e, r
are internal vertices.
4.4.2 Binary tree
M-ary tree: A rooted tree is called an m-ary tree if every internal vertex has not more
than m-children. The tree is called a full-m-ary if every internal vertex has exactly m
children.
107
Definition: An m-ary tree with m=2 is called a Binary tree.
Note: A tree T is a full binary tree if there is only one vertex with degree 2(sum of indeg
& outdegree) and the remaining vertices are of degree 1 or 3.
a b c
T1: T2: a b i
c d e f q h
d e f j e
g k
-T1 is a binary tree
-T2 is not a binary tree rather it is a full 3-ary tree.
Theorem: T is a full m-ary rooted tree consisting of n-vertices, i-internal vertices and l
leaves, then
1) n = mi+1 2) l = n-i
Example 1: If 56 people sign up for a tennis tournament, how many matches will be
played in the tournament in order to identify the champion?
. . . Solution
l 1 56 1
i= 55 .
m 1 2 1
Hence there are 55 matches played to know the champion.
108
presidents. Each vice-president calls four other executives, who in turn call four others
and so on.
a) How many calls are made in reaching all the 125 executives?
b) How many executives, aside from the president, are required to make calls?
c) How many executives are not authorized to make calls?
Solution:
c) Exercise
Balanced tree: A rooted k-ary tree of depth h is balanced if all the leaves are at level
h or h-1.
b d
T2:a f T2 is not balanced binary tree since leaf c is neither
e at level 2 (h-1) nor at 3(h).
c g
109
Application of a tree
2). Binary search Tree: is a binary tree in which each child is either a left or right child,
no vertex has more than one left child and one right child, and the data associated with
vertices must be unique.
Example: Build a binary search tree for the words Banana, Peach, Apple Pear,
Coconut, Mango and Papaya using alphabetical order.
Solution: One possible binary search tree of the given words is:
Banana
Apple Mango
Coconut Peach
Papaya Pear
110
Exercise:- 1) Draw a tree or explain why it can not be drawn in each of the following.
a) A tree that has 7 vertices and 12 edges.
b) A tree that has a degree sequence
d= ( 2, 2, 3, 3, 3, 4)
c) A connected graph, but not a tree, with 3 edges and 4 vertices.
d) A tree with 3 vertices and 1 edge
e) A disconnected acyclic graph with 5 vertices and 4 edges.
111