0% found this document useful (0 votes)
6 views

Module IT2012PD (1)(3)

The document is a module on Discrete Mathematics and Combinatorics, authored by Temesgen Molla and edited by Thomas Birhanu, aimed at providing distance learners with fundamental concepts in combinatorics and graph theory. It covers topics such as elementary counting principles, recurrence relations, graph theory, and networks and flows, with objectives for students to understand and apply these concepts. The module includes detailed chapters with examples and exercises to reinforce learning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Module IT2012PD (1)(3)

The document is a module on Discrete Mathematics and Combinatorics, authored by Temesgen Molla and edited by Thomas Birhanu, aimed at providing distance learners with fundamental concepts in combinatorics and graph theory. It covers topics such as elementary counting principles, recurrence relations, graph theory, and networks and flows, with objectives for students to understand and apply these concepts. The module includes detailed chapters with examples and exercises to reinforce learning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 128

DEPARTMENT OF MATHEMATICS

Module On

Discrete Mathematics and Combinatorics (Math 2031)

Writer: Temesgen Molla (MSc. in Combinatorics)

Editor: Thomas Birhanu (MSc. in Combinatorics)

December, 2012 E.C

i
Table of Contents --------------------------------------------------------------------- i
Contents Pages
Aim ------------------------------------------------------------------------------------------------------------------1
Description ---------------------------------------------------------------------------------------------------------1
Objectives ----------------------------------------------------------------------------------------------------------1
Chapter 1: Elementary counting principles --------------------------------------------------------------- 2
1.1 Basic counting principle ------------------------------------------------------------------------------2
1.2 Permutations and combinations --------------------------------------------------------------------- 8
1.3 The Binomial Theorem -------------------------------------------------------------------------------14
1.4 The Inclusion-Exclusion principles ---------------------------------------------------------------- 19
1.5 The Pigeonhole principle ---------------------------------------------------------------------------- 20
Chapter 2: Recurrence relations ---------------------------------------------------------------------------- 26
2.1 Definition and examples of recurrence relations -------------------------------------------------- 26
2.2 Solving linear recurrence relations (homogeneous and non-homogeneous) ------------------- 32
2.3 Generating functions ----------------------------------------------------------------------------------- 41
Chapter 3: Elements of graph theory ---------------------------------------------------------------------- 55
3.1 Definitions of terms of graphs and types of graphs ------------------------------------------------ 55
3.2 Isomorphism of graphs and matrix representation of a graphs ---------------------------------- 64
3.3 Path and connectivity of a graph ----------------------------------------------------------------------70
3.4 Eulerian and Hamiltonian graphs ---------------------------------------------------------------------78
3.5 Planar graphs -------------------------------------------------------------------------------------------- 80
3.6 Trees and forests ---------------------------------------------------------------------------------------- 82
3.7 Graph Coloring ------------------------------------------------------------------------------------------ 90
3.8 Directed graphs ------------------------------------------------------------------------------------------ 93
Chapter 4: Weighted graphs and Their applications ---------------------------------------------------- 104
4.1 Definition and examples of Weighted Graphs ----------------------------------------------------- 104
4.2 Minimal Spanning trees ------------------------------------------------------------------------------- 105
4.3 Shortest path problem -----------------------------------------------------------------------------------110
Chapter 5: Networks and Flows ------------------------------------------------------------------------------ 119
5.1 Definition and Examples of Network and flow ------------------------------------------------------ 119
5.2 The max-flow and min-cut ------------------------------------------------------------------------------ 121
Reference -----------------------------------------------------------------------------------------------------------126

i
Discrete Mathematics & Combinatorics

Aim of the module


The aim of this module is to create understanding of on basic concepts of Combinatorics
and graph theory for distance learner on counting principles, advanced counting, elements
of graph theory.
Module description:
Combinatorics is a branch of Mathematics that deals with the existence, enumeration, analysis, and
optimization of discrete structures and states. Combinatorics has become an important branch of
Mathematics since the middle of the twentieth century because of the major impact that computers
have had and continue to have, in our society. Large scale problems that were previously difficult
to solve are being solved with the advent of computers.
But computers do not function independently; they need to be programmed to carry out these
functions. The basis for these computer programs often are combinatorial algorithms for the
solutions of problems. Analysis of these algorithms for efficiency and effectiveness with regard to
running time and storage requirements requires clever combinatorial thinking and enumeration. In
this course, students will be introduced fundamental principles of counting, recurrence relations,
networks and flows, and graph theory and its applications and.
Module Objectives:
On completion of this module, successful students will be able to:
 know basic concepts of discrete mathematics,
 understand the principles of counting, recurrence relations and generating functions,
 understand the basic concepts of graph and their types
 know the basic algorithms on graphs
 use the methods and principles of Combinatorics
 apply Combinatorics in counting problems
 solve simple counting problems
 construct graphs with given degree patterns
 apply graph theory to solve network oriented problems.

3
Discrete Mathematics & Combinatorics

Chapter One
Elementary Counting Principle
Introduction
Suppose that a password on a computer system consists of six, seven, or eight characters. Each of
these characters must be a digit or a letter of the alphabet. Each password must contain at least one
digit. How many such passwords are there? The techniques needed to answer this question and a
wide variety of other counting problems will be introduced in this section. Counting problems arise
throughout mathematics and computer science. For example, we must count the successful
outcomes of experiments and all the possible outcomes of these experiments to determine
probabilities of discrete events. We need to count the number of operations used by an algorithm
to study its time complexity.
We will introduce the basic techniques of counting in this section. These methods serve as the
foundation for almost all counting techniques.
Chapter Objectives
On completion of this chapter, students will be able to:
 Understand the basic counting principles.
 Understand permutations and combinations.
 Apply basic counting principles to solve counting problems.
 Apply counting techniques to solve problems related with permutations and combinations.
 Understand the inclusion – exclusion principle.
 Understand the pigeonhole principle.

1.1Basic Counting Principles


Objectives: After completing this sub topic, students will be able to:
 State addition and multiplication principles.
 Solve counting problems using addition and multiplication principles.
The two basic counting principles.
I. Addition Principle
II. Multiplication Principle

4
Discrete Mathematics & Combinatorics

I. Addition Principle:
If E1, E2 , … , En are mutually exclusive events and E1 can happen e1 ways , E2 can happen e2 ways ,
… , En can happen en ways , then E1 or E2 ,or … , or En can happen e1+ e2 + ….+ en ways.

In terms of set addition principle is stated as: Suppose that a set S is partitioned into pairwise
disjoint parts S1,S2 , ... ,Sm . The number of objects in S can be determined by finding the number
of objects in each of the parts, and adding the numbers so obtained:

If the sets S1, S2 ,… , Sm are allowed to overlap, then a more profound principle, the inclusion-
exclusion principle in the next section, can be used to count the number of objects in S.
Example 1: A student wishes to take either a mathematics course or a biology course, but not both.
If there are four mathematics courses and three biology courses for which the student has the
necessary prerequisites, then the student can choose a course to take in 4 + 3 = 7 ways.
Example 2: In how many ways can we get a sum of 4 or of 8 when two distinguishable dice are
rolled?
Solution: Let denote the possible outcomes obtained from rolling the dice by order pair (a , b)
where a and b are numbers from 1 to 6 on both dice with a+b = 4 or a +b = 8. Then the possible
outcomes to get sum of 4 are (1, 3) , (2 ,2) and (3, 1), implies that there are e1= 3 ways to obtain
the sum 4 (E1).
And also we obtain the sum 8 (E2) from the outcomes (2, 6) , (3,5) , (4, 4) , (5, 3) and (6, 2).
Here e2 =5 ways. Therefore there are 3+5 = 8 ways to get the sum of 4 or 8.
Example 3: A student can choose a computer project from one of three lists. The three lists contain
23, 15 and 19 possible projects, respectively. No project is on more than one list. How many
possible projects are there to choose from?

Solution: The student can choose a project by selecting a project from the first list, the second list,
or the third list. Because no project is on more than one list, by the addition principle there are 23
+ 15 + 19 = 57 ways to choose a project.

Example 4: In how many ways can we draw a heart or a spade from an ordinary deck of playing
cards? A heart or an ace? An ace or a king? A card numbered 2 through 10? A numbered card or
a king?
5
Discrete Mathematics & Combinatorics

Solution. Since there are 13 hearts and 13 spades we may draw a heart or a spade in
13 + 13 = 26 ways.
We may draw a heart or an ace in 13 + 3 = 16 ways, since there are only 3 aces that are not hearts.
We may draw an ace or a king in 4 + 4 = 8 ways.
These are 9 cards numbered 2 through 10 in each of 4 suits, clubs, diamonds, hearts, or spades.
So we may choose a numbered card in 36 ways.
Thus, we may choose a numbered card or a king in 36 + 4 = 40 ways.

Example 5: How many ways can we get a sum of 8 when two indistinguishable dice are rolled?
An even sum?
Solution: Had the dice been distinguishable, we should obtain a sum of 8 by the outcomes (2,
6), (3, 5), (4, 4), (5, 3) and (6, 2), but since the dice are similar, the outcomes (2, 6) and (6, 2) and,
as well, (3, 5) and (5, 3) cannot be differentiated and thus we obtain the sum of 8 with the roll of
two similar dice in only 3 ways. Likewise, we can get an even sum in 1 + 2 + 3 + 3 + 2 + 1 = 12
ways.
Example 6: If there are 14 boys and 12 girls in a class, find the number of ways of selecting one
student as class representative.
Solution: Using sum rule, there are 14 + 12 = 26 ways of selecting one student (either a boy or a
girl) as class representative.

II. Multiplication Principle


If events E1, E2 , … , En can happen e1 , e2 ,…, en ways respectively , then the sequence of events E1
first , followed by E2 , … , followed by En can happen e1 . e2 … en ways.

NB. The Multiplication Principle applies when a procedure is made up of separate tasks.
Example 1: How many two letter words start with one of the 5 vowels?
Solution: There are 26 two letter words starting with A, another 26 starting with E, and so on.
We will have 5 groups of 26. So we add 26 to itself 5 times. Of course it would be easier to just
multiply 5 · 26.
Example 2: If 2 distinguishable dice are rolled, in how many ways can they fall? If 5
distinguishable dice are rolled, how many possible outcomes are there?

6
Discrete Mathematics & Combinatorics

Solution: The first die can fall (event E1) in 6 ways and the second can fall (event E2) in 6 ways.
There are 6.6 = 62 = 36 outcomes are rolled dice when 2 dice are rolled. And there are 6.6.6.6.6.6
= 65 possible outcome when 5 dice are rolled.
Example 3: There are 32 microcomputers in a computer center. Each microcomputer has 24 ports.
How many different ports to a microcomputer in the center are there?
Solution: The procedure of choosing a port consists of two tasks, first picking a microcomputer
and then picking a port on this microcomputer. Because there are 32 ways to choose the
microcomputer and 24 ways to choose the port no matter which microcomputer has been selected,
the product rule shows that there are 32 · 24 = 768 ports.
Example 4: How many different license plates can be made if each plate contains a sequence of
three uppercase English letters followed by three digits (and no sequences of letters are prohibited,
even if they are obscene)?
Solution: There are 26 choices for each of the three uppercase English letters and ten choices for
each of the three digits. Hence, by the product rule there are a total of 26 · 26 · 26 · 10 · 10 · 10 =
17,576,000 possible license plates.
Example 5: The number of ways a man, woman, boy, and girl can be selected from five men, six
women, two boys, and four girls is 5 x 6 x 2 x 4 = 240.
Example 6: How many two-digit numbers have distinct and nonzero digits? A two-digit number
ab can be regarded as an ordered pair (a, b), where a is the tens digit and b is the units digit. Neither
of these digits is allowed to be 0 in the problem, and the two digits are to be different. There are
nine choices for a, namely 1,2, ... ,9. Once a is chosen, there are eight choices for b. If a = 1, these
eight choices are 2,3, ... ,9, if a = 2, the eight choices are 1,3, ... ,9, and so on. What is important
for application of the multiplication principle is that the number of choices is always 8. The answer
to the questions is, by the multiplication principle, 9 x 8 = 72. We can arrive at the answer 72 in
another way. There are 90 two-digit numbers, 10,11,12, ... ,99. Of these numbers, nine have a 0,
(namely, 10,20, ... , 90) and nine have identical digits (namely, 11,22, ... ,99). Thus the number of
two-digit numbers with distinct and nonzero digits equals 90 - 9 - 9 = 72.
Example 7: Each user on a computer system has a password, which is six to eight characters long,
where each character is an upper case letter or a digit. Each password must contain at least one
digit. How many possible passwords are there?

7
Discrete Mathematics & Combinatorics

Solution: Let P be the total number of possible passwords, and let P6, P7 and P8 denote the number
of possible passwords of length 6, 7, and 8 respectively.
By the sum rule, P = P6 + P7 + P8
We will now find P6, P7, and P8. Finding P6 directly is difficult.
To find P6 it is easier to find the number of strings of upper case letters and digits that are six
characters long, including those with no digits, and subtract from this the number of strings with
no digits.
By the product rule, the number of strings of six characters is 366 and the number of strings with
no digits is 266.
Hence, P6 = 366 – 266 = 2, 176, 782, 336 – 308, 915, 776
= 1, 867, 866, 560.
Similarly, it can be shown that
P7 = 367 – 267 = 78, 364, 164, 096 – 8, 031, 810, 176
= 70, 332, 353, 920.
and P8 = 368 – 268 = 2, 821, 109, 907, 456 – 208, 827, 064, 576
= 2, 612, 282, 842, 880.
Consequently,
P = P6 + P7 + P8
= 2, 684, 483, 063, 360.
Example 8:
a) How many 2 digit or 3-digit numbers can be formed using the digits 1, 3, 4, 5, 6, 8 and 9 if
no repetition is allowed ?
b) How many numbers can be formed using the digits 1, 3, 4, 5, 6, 8 and 9 if no repetition are
allowed?
Solution:
a) There are 7.6.5, three-digit numbers possible. Likewise, we can apply the product rule to see
that these are 7.6 possible 2-digit numbers.
Hence, these are 7.6 + 7.6.5 possible two-digit or three-digit numbers.
b) The number of digits are not specified in this problem so we can form one-digit numbers, two-
digit numbers, or three digit numbers, etc.

8
Discrete Mathematics & Combinatorics

But since no repetitions are allowed and we have only the 7 integers to work with, the maximum
number of digits would have to be 7.
Applying the product rule, we see that we may form 7 one-digit numbers, 7.6 = 42 two digit
numbers 7.6.5 three digit numbers, 7.6.5.4 four digit numbers, 7.6.5.4.3 five digit numbers,
7.6.5.4.3.2 six-digit numbers, and 7.6.5.4.3.2.1 seven-digit numbers.
The events of forming one-digit numbers, two digit numbers, three digit numbers, etc., are
mutually exclusive events so,
We apply the sum rule to see that there are
7 + 7.6 + 7.6.5 + 7.6.5.4 + 7.6.5.4.3 + 7.6.5.4.3.2 + 7.6 + 7.6.5.4.3.2.1 = 13, 741
different numbers we can form under the restrictions of this problem.

Check list
To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. State addition principle.
2. State multiplication principle.
3. Solve problems given this subtopics related to addition and
multiplication principles.
Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.
Exercise 1.1
1.

Ways to travel from C to D, how many ways are there to travel from A to D?
2. Suppose repetitions are not permitted.
a) Find the number of three-digit numbers that can be formed from the six digits 2,
3, 5, 6, 7, and 9.
b) How many of them are less than 400?
c) How many of them are even?
9
Discrete Mathematics & Combinatorics

3. A Mathematics class contains 8 male students and 6 female students. Find the number n of
ways that the class can elect:
a) 1 class representative
b) 2 class representatives, 1 male and 1 female
c) 1 president and 1 vice president.
4. How many license plates consisting of 2 nonrepeating letters (A to Z) followed by 3 even
digits (0 to 8) are possible?
5. How many 6-digit numbers have odd digits in the odd places and even digits in the even
places?
6. A certain Internet provider requires that its e-mail addresses consist of 6 characters (letters
A to Z or digits 0 to 9). Further, the first character must be a letter, and the last character
must be a digit. How many different e-mail accounts are possible from this provider?
7. How many 5-digit numbers neither start with zero nor end in zero?
8. How many 6-digit numbers (leading zeros are allowed) have the last two digits the same as
the first two digits (in the same order)?

1.2 Permutations and Combinations


Many counting problems can be solved by finding the number of ways to arrange a specified
number of distinct elements of a set of a particular size, where the order of these elements matters.
Many other counting problems can be solved by finding the number of ways to select a particular
number of elements from a set of a particular size, where the order of the elements selected does
not matter. For example, in how many ways can we select three students from a group of five
students to stand in line for a picture? How many different committees of three students can be
formed from a group of four students? In this section we will develop methods to answer questions
such as these.
Objectives: After completing this sub topic, students will be able to:
 Define permutation and combination.
 Evaluate the given number of permutations and combinations without repetition and with
repetitions allowed.
 Solve problems related to number of permutations and combinations.

10
Discrete Mathematics & Combinatorics

Many counting problems can be thought of as a selection of some objects from a fixed set of
objects. In some cases, the order in which the objects are selected is important, and in others it is
not. As we shall see, permutations handle the former case, and combinations handle the latter.
Definition: A permutation of r objects from a set of size n is an ordered list of r of the n objects.
An r-permutation is an ordered arrangement of r elements of a set.
Example 1: Consider the set of letters A, B, C, D. Then:
i) BDCA, DCBA, and ACDB are permutations of the four letters (taken all at a time).
ii) BAD, ACB, DBC are permutations of the four letters taken three at a time.
iii) AD, BC, CA are permutations of the four letters taken two at a time.
Example 2: If S = {A, B, C, D, E} is the set of n = 5 objects under consideration and r = 3,
then all of the possible permutations of 3 elements from S are listed below.
ABC ABD ABE ACD ACE ADE BCD BCE BDE CDE
ACB ADB AEB ADC AEC AED BDC BEC BED CED
BAC BAD BAE CAD CAE DAE CBD CBE DBE DCE
BCA BDA BEA CDA CEA DEA CDB CEB DEB DEC
CAB DAB EAB DAC EAC EAD DBC EBC EBD ECD
CBA DBA EBA DCA ECA EDA DCB ECB EDB EDC
They are 60 in number.
Example 3: In how many ways can we arrange three students from a group of five students to
stand in line for a picture? In how many ways can we arrange all five of these students in a line for
a picture?
Solution: There are five ways to take the first student to stand at the start of the line. Once this
student has been taken, there are four ways to take the second student in the line. After the first
and second students have been taken, there are three ways to take the third student in the line.
There are 5.4.3 = 60 ways to arrange three students from a group of five students to stand in line
for a picture.
To arrange all five students in a line for a picture, we take the first student in five ways, the second
in four ways, the third in three ways, the fourth in two ways, and the fifth in one way.
Consequently, there are 5 · 4 · 3 · 2 · 1 = 120 ways to arrange all five students in a line for a
picture.

11
Discrete Mathematics & Combinatorics

Example 4: Let S = {a, b, c}. The 2-permutations of S are the ordered arrangements ab, ac, ba,
bc, ca, cb. Consequently, there are 6 2-permutations of this set with three elements.
Theorem 1. If n is a positive integer and r is an integer with 1 ≤ r ≤ n, then there are
P (n, r) = n(n − 1)(n − 2) · · · (n − r + 1)
r-permutations of a set with n distinct elements.
Corollary 1. If n and r are integers with 0 ≤ r ≤ n, then
𝑛!
𝑃(𝑛, 𝑟) = (𝑛−𝑟)!

Example 5: How many ways are there to select a first-prize winner, a second-prize winner, and a
third-prize winner from 100 different people who have entered a contest?
Solution: Because it matters which person wins which prize, the number of ways to pick the three
prize winners is the number of ordered selections of three elements from a set of 100 elements,
that is, the number of 3 permutations of a set of 100 elements. Consequently, the answer is
P(100, 3) = 100 · 99 · 98 = 970,200.
Example 6: Suppose that there are eight runners in a race. The winner receives a gold medal, the
second place finisher receives a silver medal, and the third-place finisher receives a bronze medal.
How many different ways are there to award these medals, if all possible outcomes of the race can
occur and there are no ties?
Solution: The number of different ways to award the medals is the number of 3-permutations
of a set with eight elements. Hence, there are P(8, 3) = 8 · 7 · 6 = 336 possible ways to award
the medals.
Example 7: The number of four-letter "words" that can be formed by using each of the letters a,
b, c, d, e at most once is P(5,4), and this equals 5!/(5 - 4)! = 120. The number of five-letter words
equals P(5, 5), which is also 120.
Example 8: What is the number of ways to order the 26 letters of the alphabet so that no two of
the vowels a, e, i, o, and u occur consecutively?
Solution: Here we think of two main tasks to be accomplished. The first task is to decide how to
order the consonants among themselves. There are 21 consonants, and so 21! permutations of the
consonants. Since we cannot have two consecutive vowels in our final arrangement, the vowels
must be in 5 of the 22 spaces before, between, and after the consonants. Our second task is to put
the vowels in these places. There are 22 places for the a, then 21 for the e, 20 for the i, 19 for the
o, and 18 for the u. That is, the second task can be accomplished in
12
Discrete Mathematics & Combinatorics

ways. By the multiplication principle, we determine that the number of ordered arrangements
of the letters of the alphabet with no two vowels consecutive is

Example 9: Find n if P(n, 2) = 72.


Solution: P(n, 2) = n(n − 1) = n2 − n. Thus, we get n2 - n = 72 or n2 − n − 72 =0 or
(n − 9)(n + 8) = 0 ⟹ n = 9 and n = -8
Since n must be positive, the only answer is n = 9.
Definition: The number of circular r-permutations of a set of n elements is given by

If r = n, then the number of such permutation is given by

Example 10: Find the number of 3- permutations of the letters p , q , r , s and t in circle.
Solution: n = 5 and r = 3, the using the above formula,
𝑛! 5!
= = 20.
𝑟(𝑛−𝑟)! 3(5−3)!
Example:

13
Discrete Mathematics & Combinatorics

Example 12: In how many ways can the letters of the English alphabet be arranged so that there
are exactly ten letters between a and z?
Solution. There are P(24, 10) arrangements of the letters of the alphabet (excluding a and z) taken
ten at a time, and hence 2.P(24, 10) strings of 12 letters, each beginning and ending with an a and
z (either letter coming first in a string).
For each of these strings, there are 15! ways to arrange the 14 remaining letters and the string.
So there are altogether
2.P(24, 10) . 15! arrangements of the desired type.
Example 13: A man, a woman, a boy, a girl, a dog, and a cat are walking down a long and
winding road one after the other.
a) In how many ways can this happen?
b) In how many ways can this happen if the dog comes first?
c) In how many ways can this happen if the dog immediately follows the boy?
d) In how many ways can this happen if the dog (and only the dog) is between the man and
the boy?
Solution: a) There are 6! = 720 ways for six creatures to form a line.
b) If the dog comes first, the others can form = 5! lines behind.
c) If the dog immediately follows the boy, then the dog-boy pair should be thought of
as a single object to be put into a line with four others.
There are 5! = 120 such lines.
d) If the man, dog, and boy appear in this order, then thinking of man-dog-boy as a
e) single object to be put into a line with three others, we see that there are 4!
possible lines. Similarly, there are 4! lines in which the boy, dog, and man appear
in this order.
So, by the addition rule, there are 4! + 4! = 48 lines in which the dog (and only the
dog) is between the man and the boy.
Example 14: Find the number of positive integers greater than a million that can be formed with
the digits 2, 3, 0, 3, 4, 2 and 3.

14
Discrete Mathematics & Combinatorics

Solution: The numbers greater than a million must be of 7 digits.


In the given set of digits, 2 appear twice, 3 appear thrice and all others are distinct.
Thus, the total number of seven digit numbers that can be formed with given digits is

The set of these 420 positive integers, include some numbers which begin with 0.
Clearly, these numbers are less than a million and they must not be counted in our answer.
The number of such numbers is given by the permutations of 6 non-zero digits and is equal to

Therefore, the number of positive integers greater than a million that can be formed with given
digits is equal to 420 – 60 = 360.
Example 15: In how many different ways can 5 men and 5 women sit around a table, if
i) there is no restriction
ii) no two women sit together?
Solution: i) The problem is related to circular permutation of 10 objects (5 men and 5 women). If
there is no restriction then the number of permutations is (10 – 1)! = 9! = 362880.
Notice here the difference in arrangement between clockwise and anticlockwise.
ii) there is a restriction that no two women are allowed to sit side by side. To meet this
restriction each woman should occupy a sit between two men.
The number of ways five men can sit around a table is 4! = 24.
Once these five men have sat on alternate chairs, the five women can occupy the 5 empty chairs
in 5! ways.
Thus, total number of ways, in this case is 24 * 5! = 24 * 120 = 2880.
Definition: A combination of r elements from a set of size n is a subset of size r. An r-
combination of elements of a set is an unordered selection of r elements from the set of n
elements.
Example 1: If S = {a, b, c, d, e} is the set of n = 5 objects under consideration and r = 3, then all
of the possible combinations of 3 elements from S are listed below.
{a, b, c} {a, b, d} {a, b, e} {a, c, d} {a, c, e}
{a, d, e} {b, c, d} {b, c, e} {b, d, e} {c, d, e}
15
Discrete Mathematics & Combinatorics

Example 2: Let S be the set {1, 2, 3, 4}. Then {1, 3, 4} is a 3-combination from S. Note that {4,
1, 3} is the same 3-combination as {1, 3, 4}, because the order in which the elements of a set are
listed does not matter.
Example 3: The 2-combinations of {a, b, c, d} are the six subsets {a, b},{a, c}, {a, d}, {b, c}, {b,
d}, and {c, d}.
Theorem 2: The number of r-combinations of a set with n elements, where n is a nonnegative
integer and r is an integer with 0 ≤ r ≤ n, is given by
𝑛!
𝐶(𝑛, 𝑟) = 𝑟! (𝑛 − 𝑟)!

Note: The number 𝐶(𝑛, 𝑟) is also denoted by (𝑛𝑟)


Example 4: How many poker hands of five cards can be dealt from a standard deck of 52 cards?
Also, how many ways are there to select 47 cards from a standard deck of 52 cards?
Solution: Because the order in which the five cards are dealt from a deck of 52 cards does not
52! 52!
matter, there are 𝐶(52, 5) = = 5!47! = 2,598,960
5!(52−5)!

different hands of five cards that can be dealt.


Example 5: A farmer buys 3 cows, 2 pigs, and 4 hens from a man who has 6 cows, 5 pigs, and 8
hens. Find the number of choices that the farmer has.
Solution: The farmer can choose the cows in C(6, 3) ways, the pigs in C(5, 2) ways, and the
hens in C(8, 4) ways.
Thus the number of choices is

by Multiplication principle.
Corollary 2: Let n and r be nonnegative integers with r ≤ n. Then
𝐶(𝑛, 𝑟) = 𝐶(𝑛, 𝑛 − 𝑟).

1.3 The Binomial Theorem


Theorem 3: The binomial theorem
Let x and y be variables, and let n be a non-negative integer. Then
𝑛
(𝑥 + 𝑦)𝑛 = ∑𝑛𝑟=0 ( ) 𝑥 𝑛−𝑟 𝑦 𝑟
𝑟
Example 1: Expand (𝑥 + 𝑦)4 using binomial theorem

16
Discrete Mathematics & Combinatorics

Solution: From the binomial theorem it follows that


(𝑥 + 𝑦)4 = 𝑥 4 + 4𝑥 3 𝑦 + 6𝑥 2 𝑦 2 + 4𝑥𝑦 3 + 𝑦 4 .
Example 2:

Example 3: What is the coefficient of 𝑥 5 𝑦 4 in the expansion of (𝑥 + 𝑦)9 ?


25 9!
Solution: From the binomial theorem it follows that this coefficient is ( ) = 4! (9 − 4)! = 126.
13
Example 4: What is the coefficient of 𝑥 3 𝑦 2 in the expansion of (2𝑥 − 3𝑦)5 ?
Solution: First, note that this expression equals (2𝑥 + (−3𝑦))5.
By the binomial theorem, the term containing 𝑥 3 𝑦 2 is
5
( ) (2𝑥)5−2 (−3𝑦)2 = 10 ⋅ 23 (−3)2 𝑥 3 𝑦 2 = 720𝑥 3 𝑦 2 .
2
Therefore the required coefficient is 720.
Corollary 3: Let n be a nonnegative integer. Then
𝑛
∑𝑛𝑟=0 ( ) = 2𝑛
𝑟
Proof:

17
Discrete Mathematics & Combinatorics

Pascal’s triangle identity

Theorem 4: Pascal’s identity

Let n and k be positive integers with n ≥ k. Then

𝑛 𝑛−1 𝑛−1
( )=( )+( )
𝑟 𝑟−1 𝑟

Pascal’s triangle identity

0
( ) … n=0
0

1 1
( ) ( ) … n=1
0 1

2 2 2
( ) ( ) ( ) … n=2
0 1 2

3 3 3 3
( ) ( ) ( ) ( ) … n=3
0 1 2 3

Theorem 5: The multinomial theorem:

Example 1:

Solution: Here, the sum in our expansion is indexed over the triples

18
Discrete Mathematics & Combinatorics

Example 2: What is the coefficient of u2w3x 4y2 in the expansion of (u + v + 2w + x + 3y + z) 11?

Solution:

Hence, the desired coefficient is 4989600. .

Generalized Permutations and Combinations

In many counting problems, elements may be used repeatedly. For instance, a letter or digit may
be used more than once on a license plate. When a dozen donuts are selected, each variety can be
chosen repeatedly. This contrasts with the counting problems discussed earlier in the chapter where
we considered only permutations and combinations in which each item could be used at most once.
In this section we will show how to solve counting problems where elements may be used more
than once.
Also, some counting problems involve indistinguishable elements. For instance, to count the
number of ways the letters of the word SUCCESS can be rearranged, the placement of identical
letters must be considered. This contrasts with the counting problems discussed earlier where all
elements were considered distinguishable. In this section we will describe how to solve counting
problems in which some elements are indistinguishable.
19
Discrete Mathematics & Combinatorics

Counting permutations when repetition of elements is allowed can easily be done using the
product rule, look example below.

Example: How many strings of length r can be formed from the uppercase letters of the English
alphabet?
Solution: By the product rule, because there are 26 uppercase English letters, and because each
letter can be used repeatedly, we see that there are 26r strings of uppercase English letters of
length r.
Theorem 6: The number of r-permutations of a set of n objects with repetition allowed is given
by
𝑈(𝑛, 𝑟) = 𝑛𝑟
Proof: There are n ways to select an element of the set for each of the r positions in the r-
permutation when repetition is allowed, because for each choice all n objects are available.
Hence, by the multiplication principle there are 𝑛𝑟 r-permutations when repetition is allowed.

Combinations with Repetition


Theorem 7: There are C(n + r − 1, r) = C(n + r − 1, n − 1) r-combinations from a set with n
elements when repetition of elements is allowed.
Example 1: Suppose that a cookie shop has four different kinds of cookies. How many different
ways can six cookies be chosen? Assume that only the type of cookie, and not the individual
cookies or the order in which they are chosen, matters.
Solution: The number of ways to choose six cookies is the number of 6-combinations of a set
with four elements.
Using Theorem 7 this equals C(4 + 6 − 1, 6) = C(9, 6) = 84
Therefore, there are 84 different ways to choose the six cookies.
Theorem 7 can also be used to find the number of solutions of certain linear equations where
the variables are integers subject to constraints.
Example 2: How many solutions does the equation 𝑥1 + 𝑥2 + 𝑥3 = 11 have, where x1, x2, and x3
are nonnegative integers?
Solution: Using theorem 7 it follows that there are C(3 + 11 − 1, 11) = C(13, 11) =
C(13, 2)=78. Therefore there are 78 non – negative integer solution to the equation of the form
(x1 , x2 , x3).
20
Discrete Mathematics & Combinatorics

Theorem 8: The number of different permutations of n objects, where there are n1


indistinguishable objects of type 1, n2 indistinguishable objects of type 2, . . . , and nk
indistinguishable objects of type k, is given by
𝑛!
𝑃(𝑛; 𝑛1 , 𝑛2 , … , 𝑛𝑘 ) = 𝑛
1 ! 𝑛2 !… 𝑛𝑘!

Example 1: Find the number of words that can be formed using the letters of the word
“BENZENE.”
Solution:

Example 2: The number of permutations of the letters in the word MISSISSIPPI is


11!
P(11 ; 1, 4, 4, 2) = 1!4!4!2! = 34650

1.4 The Inclusion – Exclusion principle


Objectives: At the end of this subtopic the students will be able to
 State the inclusion – exclusion principle.
 Solve problems related to inclusion – exclusion principle.

The Inclusion – Exclusion principle


Let A and B be any finite sets. Then

For any finite sets A, B, C we have

Example: Find the number of mathematics students at a college taking at least one of the
languages French, German, and Russian, given the following data:
65 study French, 20 study French and German,
45 study German, 25 study French and Russian,
42 study Russian, 15 study German and Russian,
and 8 study all three languages.

21
Discrete Mathematics & Combinatorics

We want to find n(F ∪ G ∪ R) where F, G, and R denote the sets of students studying French,
German, and Russian, respectively.
By the Inclusion–Exclusion Principle,
n(F ∪ G ∪ R )= n(F ) + n(G) + n(R) − n(F ∩ G) − n(F ∩ R) − n(G ∩ R) + n(F ∩ G ∩ R)
= 65 + 45 + 42 − 20 − 25 − 15 + 8 = 100
This implies, 100 students study at least one of the three languages.

1.5 The Pigeonhole Principle


Objectives: At the end of this subtopic the students will be able to
 State the pigeonhole principle.
 Solve problems related to pigeonhole principle.

The Pigeonhole Principle


If k +1 or more objects are placed in to k boxes, then there is at least one box containing two or
more of the objects.

Example 1: Suppose a department contains 13 professors, then two of the professors were born
in the same month. Because there are 12 months in a year.
Example 2: There are n married couples. How many of the 2n people must be selected to
guarantee that a married couple has been selected?
Solution. To apply the pigeonhole principle in this case, think of n boxes, one corresponding
to each of the n couples. If we select n + 1 people and put each of them in the box corresponding
to the couple to which they belong, then some box contains two people; that is, we have selected
a married couple. Two of the ways to select n people without getting a married couple are to
select all the husbands or all the wives.
Therefore, n + 1 is the smallest number that will guarantee a married couple has been selected.
Example 3: Find the minimum number of elements that one needs to take from the set S = {1, 2,
3, . . . , 9} to be sure that two of the numbers add up to 10.
Here the pigeonholes are the five sets {1, 9}, {2, 8}, {3, 7}, {4, 6}, {5}. Thus any choice of six
elements of S will guarantee that two of the numbers add up to ten.

22
Discrete Mathematics & Combinatorics

Generalized Pigeonhole Principle:


𝑁
If N objects are placed into k boxes, then there is at least one box containing ⌈ 𝑘 ⌉ or more objects.
𝑁 𝑁
Where ⌈ 𝑘 ⌉ is the greatest integer greater than or equal to 𝑘 .

Example 1: Find the minimum number of students in a class to be sure that three of them are
born in the same month.
Solution: the number of months on one year is k = 12. Then the required minimum number of
students in a class is equal to 2(12) + 1 = 24 + 1 = 25.
Check list
To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. Define permutation and combination.
2. List r – permutations and r – combinations of n distinct objects.
3. Evaluate the number of r – permutations and r – combinations of n
distinct objects.
4. Solve problems related to permutations and combinations.
5. State inclusion – exclusion principle.
6. State pigeonhole principle.
7. Solve problems related to inclusion – exclusion principle and
pigeonhole principle.
Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.

Exercise 1.2
1. List all the permutations of {a, b, c}.
2. How many different permutations are there of the set {a, b, c, d, e, f, g}
3. How many permutations of {a, b, c, d, e, f, g} end with a?
4. Let S = {1, 2, 3, 4, 5}
a) List all the 3-permutations of S.
b) List all the 3-combinations of S.
5. Find the value of each of these quantities.
23
Discrete Mathematics & Combinatorics

a) P(6, 3) b) P(6, 5)
6. Find the value of each of these quantities.
a) C(5, 1) b) C(5, 3)
7. Find the number of 5-permutations of a set with nine elements.
8. A class contains 10 students with 6 men and 4 women. Find the number of ways to:
a) Select a 4 member committee from the students.
b) Select a 4 member committee with 2 men and 2 women.
9. Find n if
a) P(n, 2) = 110.
b) P(n, n) = 5040.
c) P(n, 4) = 12P(n, 2).
d) C(n, 2) = 45.
e) C(n, 3) = P(n, 2).
f) C(n, 5) = C(n, 2).
10. How many integers greater than 5400 have both of the following properties?
(a) The digits are distinct.
(b) The digits 2 and 7 do not occur.
11. In how many ways can four men and eight women be seated at a round table if there are to
be two women between consecutive men around the table?
12. In how many ways can six men and six women be seated at a round table if the men and
women are to sit in alternate seats?
13. In how many ways can 15 people be seated at a round table if B refuses to sit next to A?
What if B only refuses to sit on A's right?
14. Consider all 5 letter “words” made from the letters a through h. (Recall, words are just
strings of letters, not necessarily actual English words.)
(a) How many of these words are there total?
(b) How many of these words contain no repeated letters?
(c) How many of these words start with the sub-word “aha”?
(d) How many of these words either start with “aha” or end with “bah” or both?
(e) How many of the words containing no repeats also do not contain the sub-word “bad”?
15. Let S = {1, 2, 3, 4, 5, 6}

24
Discrete Mathematics & Combinatorics

(a) How many subsets are there total?


(b) How many subsets have {2, 3, 5} as a subset?
(c) How many subsets contain at least one odd number?
(d) How many subsets contain exactly one even number?
16. Let S = {1, 2, 3, 4, 5, 6}
a) How many subsets are there of cardinality 4?
b) How many subsets of cardinality 4 have {2, 3, 5} as a subset?
c) How many subsets of cardinality 4 contain at least one odd number?
d) How many subsets of cardinality 4 contain exactly one even number?
17. Find the expansion of (x + y)6 using binomial theorem.
18. Find the coefficient of x 5y8 in (x + y)13.
19. What is the coefficient of x7 in (1 + x)11?
20. What is the coefficient of x9 in (2 − x)19?

21.

b) c)
22. What is the coefficient of x4y 6z2w4 in the expansion of (w − z + y − x)20?
23. What is the coefficient of x4y2z5w3 3 in the expansion of (x + y − 2z + w)14?
Review Exercise
1. In how many different orders can five runners finish a race if no ties are allowed?
2. How many possibilities are there for the win, place, and show (first, second, and third)
positions in a horse race with 12 horses if all orders of finish are possible?
3. Find the number of automobile license plates where
a) Each plate contains 2 different letters followed by 3 different digits.
b) The first digit cannot be 0.
4. A class has 10 male students and 8 female students. Find the number of ways the class can elect
a) a class representative
b) 2 class representatives, one male and one female
c) a class president and vice president.
5. Suppose a code consists of five characters, two letters followed by three digits. Find the number of: (a)
codes; (b) codes with distinct letter; (c) codes with the same letters.

25
Discrete Mathematics & Combinatorics

6. A class contains 9 men and 3 women. Find the number of ways a teacher can select a committee
of 4 from the class where there is:
a) no restrictions b) 2 men and 2 women c) exactly one woman d) at least one woman.
7. There are six different candidates for governor of a state. In how many different orders can the
names of the candidates be printed on a ballot?
8. How many bit strings of length 10 contain
a) exactly four 1s?
b) at most four 1s?
c) at least four 1s?
d) an equal number of 0s and 1s?
9. A group contains n men and n women. How many ways are there to arrange these people in a
row if the men and women alternate?
10. In how many ways can a set of two positive integers less than 100 be chosen?
11. In how many ways can a set of five letters be selected from the English alphabet?
12. How many subsets with an odd number of elements does a set with 10 elements have?
13. How many subsets with more than two elements does a set with 100 elements have?
14. A coin is flipped eight times where each flip comes up either heads or tails. How many possible
outcomes
a) are there in total?
b) contain exactly three heads?
c) contain at least three heads?
d) contain the same number of heads and tails?
15. A coin is flipped 10 times where each flip comes up either heads or tails. How many possible
outcomes
a) are there in total?
b) contain exactly two heads?
c) contain at most three tails?
d) contain the same number of heads and tails?
16. Simplify

17.
26
Discrete Mathematics & Combinatorics

18. Find the minimum number of students needed to guarantee that five of them belong to the same
class (Freshman, Sophomore, Junior, Senior). Ans 17
19. Find the minimum number of students needed to guarantee that 3 of them:
a) have last names which begin with the same first letter;
b) were born on the same day of a month (with 31 days).
20. Find the number of permutations that can be formed from all the letters of each word:
a) QUEUE b) COMMITTEE c) PROPOSITION d) BASEBALL.
21. Suppose you have sets A and B with |A| = 10 and |B| = 15.
a) What is the largest possible value for |A ∩ B|?
b) What is the smallest possible value for |A ∩ B|?
c) What are the possible values for |A ∪ B|?
22. If |A| = 8 and |B| = 5, what is |A ∪ B| + |A ∩ B|?

27
Discrete Mathematics & Combinatorics

Chapter Two

Recurrence Relations

Chapter Objectives
On completion of this chapter, students will be able to

 Understand a recurrence relation for a sequence.


 Form a recurrence relation which represent a given problem.
 Understand a recurrence relation with constant coefficients of degree k.
 Know the methods solving linear recurrence relation with constant coefficients.
 Understand generating function of infinite sequence.

Introduction

Some of the counting problems that cannot be solved using the techniques discussed in chapter 1
can be solved by finding recurrence relations involving the terms of a sequence. In this section
we will study a variety of counting problems that can be modeled using recurrence relations. In
this section we will study methods for finding explicit formulae for the terms of sequences that
satisfy certain types of recurrence relations.

2.1 Definition and Examples of recurrence relations

Objectives: On completion of subtopic, students will be able to

 Define recurrence relation for a sequence.


 Derive recurrence relation which represent the given problem.
 Define linear recurrence relation with constant coefficients.

Definition: A recurrence relation for a sequence {𝑎𝑛 }∞


𝑛=0 is an equation that express 𝑎𝑛 interms of

one or more of previous term 𝑎0 , 𝑎1 , …, 𝑎𝑛−1 for all 𝑛 ≥ 𝑛0 , where 𝑛0 is a non – negative integer.

Example 1: Consider the following sequence which begins with the number 3 and for which
each of the following terms is found by multiplying the previous term by 2:
3, 6, 12, 24, 48, . . .
It can be defined recursively by
a0 = 3, an= 2an-1 for n ≥1 or a0 = 3, an+1 = 2ak for n ≥ 0
28
Discrete Mathematics & Combinatorics

The second definition may be obtained from the first by setting n = n +1.
Clearly, the formula an = 3(2n) gives us the nth term of the sequence without calculating any
previous term.
The following remarks about the above example are in order.
1) The equation an = 2an-1 or, equivalently, an+1 = 2an, where one term of the sequence is
defined in terms of previous terms of the sequence, is called a recurrence relation.
2) The equation a0 = 3, which gives a specific value to one of the terms, is called an initial
condition.
3) The function an = 3(2n), which gives a formula for an as a function of n, not of previous
terms, is called a solution of the recurrence relation.
4) There may be many sequences which satisfy a given recurrence relation.
For example, each of the following is a solution of the recurrence relation
an = 2an -1.
1, 2, 4, 8, 16, . . . and 7, 14, 28, 56, 112, . . .
All such solutions form the so called general solution of the recurrence relation.
5) On the other hand, there may be only a unique solution to a recurrence relation which
also satisfies given initial conditions. For example, the initial condition a0 = 3 uniquely
yields the solution 3, 6, 12, 24, . . . of the recurrence relation an = 2an -1.
Example 2: Find a6 in the sequence defined by an = 2an-1 – an-2 with a0 = 3
and a1 = 4.
Solution. We know that a6 = 2a5 – a4. So to find a6 we need to find a5 and a4. Well

29
Discrete Mathematics & Combinatorics

Example 3: Find a recurrence relation and initial conditions for 1, 5, 17, 53, 161, 485 . . ..
Solution: Notice that these are growing by a factor of 3. i.e 1 · 3 = 3, 5 · 3 = 15, 17 · 3 = 51
and so on. It appears that we always end up with 2 less than the
next term.
So an = 3an-1 + 2 is our recurrence relation and the initial condition is a0 = 1.\
Example 4: A person invests 10,000 birr at 12% interest compounded annually. How much will
be there at the end of 15 years.
Solution: Let An represents the amount at the end of n years.
So at the end of n – 1 years, the amount is An-1.
Since the amount after n years equals the amount after n – 1 years plus interest for the nth year.
Thus the sequence {An} satisfies the recurrence relation
An = An-1 + (0.12) An-1 = (1.12) An-1, n ≥ 1.
With initial condition A0 = 10,000.
The recurrence relation with the initial condition allow us to compute the value of An for any n.
For example, A1 = (1.12) A0
A2 = (1.12) A1 = (1.12)2 A0
A3 = (1.12) A2 = (1.12)3A0
An = (1.12)n A0
which is an explicit formula and the required amount can be derived from the formula by putting
n = 15. So,
A15 = (1.12)15(10000).
Note: A sequence is solution of the recurrence relation if its terms satisfy the recurrence relation.
Example 4: Determine whether the sequences
a) an = 3n , n = 0 ,1 , 2, …
b) an = 2n , n = 0 ,1 , 2, …

30
Discrete Mathematics & Combinatorics

c) an = 5 , n = 0 ,1 , 2, …
is the solution of the recurrence relation an = 2an -1 - an-2 , n ≥2.

Solution. a) an = 3n , n = 0 ,1 , 2, … . From this formula we have

an- 1 = 3(n – 1) and an-2 = 3(n-2)

By substituting these values on the recurrence relation

an = 2[3(n-1)] – 3(n -2) = 6n – 6 – 3n +6 = 3n. which is true.

(b) and (c) are left as exercise for the reader.


Example 5: Check that an = 2n + 1 is a solution to the recurrence relation an = 2an-1 − 1 with
a1 = 3.
Solution. First, it is easy to check the initial condition: a1 should be 21 +1 according to our
closed formula. Indeed, 21 +1 = 3, which is what we want. To check that our proposed solution
satisfies the recurrence relation, by substituting it in.

Thus, it is true.
Example 6: Find a recurrence relation and give initial conditions for the number of bit strings of
length n that do not have two consecutive 0s. How many such bit strings are there of length five?
Solution: Let 𝑎𝑛 denote the number of bit strings of length n that do not have two consecutive 0s.
To obtain a recurrence relation for 𝑎𝑛 , note that by the sum rule, the number of bit strings of length
n that do not have two consecutive 0s equals the number of such bit strings ending with a 0 plus
the number of such bit strings ending with a 1.We will assume that n ≥ 3, so that the bit string has
at least three bits.
The bit strings of length n ending with 1 that do not have two consecutive 0s are precisely the
bit strings of length n − 1 with no two consecutive 0s with a 1 added at the end. Consequently,
there are 𝑎𝑛−1 such bit strings. Bit strings of length n ending with a 0 that do not have two
consecutive 0s must have 1 as their (n − 1) bit; otherwise they would end with a pair of 0s. It
31
Discrete Mathematics & Combinatorics

follows that the bit strings of length n ending with a 0 that have no two consecutive 0s are precisely
the bit strings of length n − 2 with no two consecutive 0s with 10 added at the end. Consequently,
there are 𝑎𝑛−2 such bit strings.
We conclude that, 𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2 for n ≥ 3.The initial conditions are 𝑎1 = 2, 𝑎2 = 3 ,
To obtain a5, we use the recurrence relation three times to find that
a3 = a2 + a1 = 3 + 2 = 5,
a4 = a3 + a2 = 5 + 3 = 8,
a5 = a4 + a3 = 8 + 5 = 13.

Linear Recurrence Relations

Definition: A linear recurrence relation of degree k with constant coefficients is a recurrence


relation of the form
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 + 𝑓(𝑛)
where 𝑐1 , 𝑐2 , … , 𝑐𝑘 are real numbers, 𝑐𝑘 ≠ 0 and 𝑓(𝑛) is a function of 𝑛.
The recurrence relation in the definition is linear because the right-hand side is a sum of previous
terms of the sequence.
Example 1: Determine whether the following recurrence relations are linear recurrence relation
with constant or not.
Definition: A linear homogeneous recurrence relation of degree k with constant coefficients is a
recurrence relation of the form
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘
where 𝑐1 , 𝑐2 , … , 𝑐𝑘 are real numbers, 𝑐𝑘 ≠ 0 and the coefficients of the terms of the sequence are
all constants, rather than functions that depend on n. The degree is k because 𝑎𝑛 is expressed in
terms of the previous k terms of the sequence and 𝑓(𝑛) = 0 for all 𝑛 ≥ 0.
Example 1: The following are examples of a linear homogeneous recurrence relations of degree
with the indicated degree k.
a) 𝑎𝑛 = 2𝑎𝑛−1 + 𝑎𝑛−2 ; 𝑛 ≥ 2 , k = 2
b) 𝑎𝑛 = 5𝑎𝑛−1 ; 𝑛 ≥ 1 , k = 1
c) 𝑐𝑛 = 4𝑎𝑛−1 − 2𝑎𝑛−2 + 𝑎𝑛−3 ; 𝑛 ≥ 3 , k = 3

32
Discrete Mathematics & Combinatorics

Example 2: The recurrence relation 𝑎𝑛 = 𝑎𝑛−1 2 + 𝑎𝑛−2 is not linear. The recurrence relation
ℎ𝑛 = 2ℎ𝑛−1 + 1 is not homogeneous. The recurrence relation 𝑎𝑛 = 𝑛𝑎𝑛−1 + 𝑎𝑛−2 does not have
constant coefficients.
Linear recurrence relations are studied for two reasons. First, they often occur in modeling of
problems. Second, they can be systematically solved.

Check list
To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. Define recurrence relation for a sequence.
2. Derive recurrence relation for a sequence and from a given problem.
3. Check whether a given sequence is solution for a given recurrence
relation.
4. Find terms of a sequence from the given recurrence relation with
initial conditions.
5. Identify whether the given recurrence relation is linear recurrence
relation with constant coefficient.
Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.

Exercise 2.1
1. Determine which of these linear homogeneous recurrence relations with constant coefficients
are. Also, find the degree of those that are.

2. Determine which of these linear homogeneous recurrence relations with constant coefficients
are. Also, find the degree of those that are.

33
Discrete Mathematics & Combinatorics

3. Show that the following sequences are solutions of the given recurrence relations.
a) an = 3(2n) ; an = 2an -1 for n ≥ 1, a0 = 3
b) an =3 · 2n − 2 · 3n ; an = 5an -1 − 6an - 2 for n ≥ 2, a0 = 1, a1 = 0
a) an = 6 · 2n − 2 · n2n ; an = 4an -1 − 4an - 2 for n ≥ 2, a0 = 6, a1 = 8

2.2 Solving Linear Homogeneous Recurrence Relations with Constant


Coefficients
Objectives: On completion of subtopic, students will be able to

 Solve the given linear recurrence relation with constant coefficients using different
methods.
 Define generating function.
 Find the generating function for a given sequence.
i) Characteristic roots method
The basic approach for solving linear homogeneous recurrence relations is to look for solutions
of the form 𝑎𝑛 = 𝑟 𝑛 , where r is a constant. Note that 𝑎𝑛 = 𝑟 𝑛 is a solution of the recurrence
relation 𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 if and only if
𝑟 𝑛 = 𝑐1 𝑟 𝑛−1 − c2 𝑟 𝑛−2 − . . . −𝑐𝑘 𝑟 𝑛−𝑘 .
When both sides of this equation are divided by 𝑟 𝑛−𝑘 and the right-hand side is subtracted from
the left, we obtain the equation 𝑟 𝑘 −𝑐1 𝑟 𝑘−1 − c2 𝑟 𝑘−2 − . . . −𝑐𝑘 = 0. Consequently, the sequence
{𝑎𝑛 } with 𝑎𝑛 = 𝑟 𝑛 is a solution if and only if r is a solution of this last equation. We call this the
characteristic equation of the recurrence relation. The solutions of this equation are called the
characteristic roots of the recurrence relation. As we will see, these characteristic roots can be used
to give an explicit formula for all the solutions of the recurrence relation.
Theorem 1: Let 𝑐1 and 𝑐2 be real numbers. Suppose that 𝑟 2 − 𝑐1 𝑟 − 𝑐2 = 0 has two distinct
roots 𝑟1and 𝑟2 . Then the sequence {𝑎𝑛 } is a solution of the recurrence relation 𝑎𝑛 = 𝑐1 𝑎𝑛−1 +

34
Discrete Mathematics & Combinatorics

𝑐2 𝑎𝑛−2 if and only if 𝑎𝑛 = 𝛼1 𝑟1 𝑛 + 𝛼2 𝑟2 𝑛 for n = 0, 1, 2, . . . , where 𝛼1 and 𝛼2 are constants


which are obtained from initial conditions.
Example 1: Solve the recurrence relation 𝑎𝑛 = 𝑎𝑛−1 + 2𝑎𝑛−2 ; 𝑛 ≥ 2 with 𝑎0 = 2 , 𝑎1 = 7.
Solution: The characteristic equation of the recurrence relation is 𝑟 2 − 𝑟 − 2 = 0. This implies
(𝑟 − 2)(𝑟 + 1) = 0. Its roots are r = 2 and r = −1.
Hence, the sequence {𝑎𝑛 } is a solution to the recurrence relation if and only if 𝑎𝑛 = 𝛼1 2𝑛 +
𝛼2 (−1)𝑛 , for some constants 𝛼1 and 𝛼2 .
From the initial conditions, it follows that 𝑎0 = 𝛼1 20 + 𝛼2 (−1)0 = 2 and
𝑎1 = 𝛼1 21 + 𝛼2 (−1)1 = 7 by rewriting we have
𝛼1 + 𝛼2 = 2 and
2𝛼1 − 𝛼2 = 7
Solving these system of equations shows that 𝛼1 = 3 and 𝛼2 = −1. Hence, the solution to the
recurrence relation and initial conditions is the sequence 𝑎𝑛 = 3. 2𝑛 − (−1)𝑛 , 𝑛 ≥ 0
Example 2: Solve the recurrence relation an = 7an-1 − 10an-2 with a0 = 2 and
a1 = 3.

35
Discrete Mathematics & Combinatorics

Theorem 2: Let 𝑐1 and 𝑐2 be real numbers with 𝑐2 ≠ 0. Suppose that 𝑟 2 − 𝑐1 𝑟 − 𝑐2 = 0 has


only one root 𝑟. Then the sequence {𝑎𝑛 } is a solution of the recurrence relation 𝑎𝑛 = 𝑐1 𝑎𝑛−1 +
𝑐2 𝑎𝑛−2 if and only if 𝑎𝑛 = 𝛼1 𝑟 𝑛 + 𝛼2 𝑛𝑟 𝑛 for n = 0, 1, 2, . . . where 𝛼1 and 𝛼2 are constants.
Example 1: Solve the recurrence relation 𝑎𝑛 = 6𝑎𝑛−1 − 9𝑎𝑛−2 with initial conditions 𝑎0 =
1 , 𝑎1 = 6.
Solution: The characteristic equation of the recurrence relation is 𝑟 2 − 6𝑟 + 9 = 0 and by
solving the equation, it has only one root r = 3. Hence, the solution to this recurrence relation is
𝑎𝑛 = 𝛼1 3𝑛 + 𝛼2 𝑛3𝑛 for some constants 𝛼1 and 𝛼2 . Using the initial conditions,

it follows that 𝛼1 = 1 and 𝛼2 = 1.


Therefore, the solution to this recurrence relation and the initial conditions is 𝑎𝑛 = 3𝑛 + 𝑛3𝑛 .

Theorem 3: Let 𝑐1 , 𝑐2 , … , 𝑐𝑘 be real numbers. Suppose that the characteristic equation


𝑟 𝑘 −𝑐1 𝑟 𝑘−1 − c2 𝑟 𝑘−2 − . . . −𝑐𝑘 = 0 has k distinct roots 𝑟1 , 𝑟2 , … , 𝑟𝑘 . Then a sequence 𝑎𝑛 is a
solution of the recurrence relation 𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 if and only if 𝑎𝑛 =
𝛼1 𝑟1 𝑛 + 𝛼2 𝑟2 𝑛 + ⋯ + 𝛼𝑘 𝑟𝑘 𝑛 for n = 0, 1, 2, . . . , where 𝛼1 , 𝛼2 , … , 𝛼𝑘 are constants.
Example 1: Find the solution to the recurrence relation 𝑎𝑛 = 6𝑎𝑛−1 −11𝑎𝑛−2 + 6𝑎𝑛−3 ; 𝑛 ≥ 3.
with the initial conditions 𝑎0 = 2 , 𝑎1 = 5 and 𝑎2 = 15.
Solution: The characteristic polynomial of this recurrence relation is 𝑟 3 −6𝑟 2 + 11𝑟 − 6 = 0.
𝑟 3 −6𝑟 2 + 11𝑟 − 6 = (r − 1)(r − 2)(r −3)=0. This implies the characteristic roots are r1 = 1, r2 =
2, and r3 = 3. Hence, the solutions to this recurrence relation are of the form 𝑎𝑛 = 𝛼1 1𝑛 +
𝛼2 2𝑛 + 𝛼3 3𝑛 . To find the constants α1, α2, and α3, use the initial conditions. This gives
a0 = 2 = α1 + α2 + α3,
a1 = 5 = α1 + α2 · 2 + α3 · 3,
a2 = 15 = α1 + α2 · 4 + α3 · 9.
36
Discrete Mathematics & Combinatorics

When these three simultaneous equations are solved for α1, α2, and α3, we find that α1 = 1,
α2= −1, and α3 = 2. Hence, the unique solution to this recurrence relation and the given initial
conditions is the sequence 𝑎𝑛 = 1 − 2𝑛 + 2. 3𝑛 .
Example 2: Suppose that the roots of the characteristic equation of a linear homogeneous
recurrence relation are 2, 2, 2, 5, 5, and 9 (that is, there are three roots, the root 2 with
multiplicity three, the root 5 with multiplicity two, and the root 9 with multiplicity one).What is
the form of the general solution?
Solution: The general form of the solution is
𝑎𝑛 = 𝛼1 2𝑛 + 𝛼2 𝑛2𝑛 + 𝛼3 𝑛2 2𝑛 + 𝛽1 5𝑛 + 𝛽2 𝑛5𝑛 + 𝜎9𝑛 .
Example 3: Find the solution to the recurrence relation an = −3an-1 − 3an-2 – an-3
with initial conditions a0 = 1, a1 = −2, and a2 = −1.
Solution: The characteristic equation of this recurrence relation is
𝑟 3 +3𝑟 2 + 3𝑟 + 1 = (r + 1)2 =0 , which implies there is a single root r = −1 of multiplicity 3 of
the characteristic equation. Then the solutions of this recurrence relation are of the form
𝑎𝑛 = 𝛼1 (−1)𝑛 + 𝛼2 𝑛(−1)𝑛 + 𝛼3 𝑛2 (−1)𝑛 .
To find the constants α1, α2, and α3, use the initial conditions. This gives
a0 = 1 = α1
a2 = −2 = −α1 – α2 – α3
a3 = −1 = α1+ 2α2 + 4α3
The simultaneous solution of these three equations is α1 = 1, α2= 3, and α3 = −2.
Therefore, the solution to this recurrence relation with the given initial conditions is the sequence
an = (1 + 3n − 2n2)(−1)n.
Linear Nonhomogeneous Recurrence Relations with Constant Coefficients
Definition: A linear nonhomogeneous recurrence relation with constant coefficients, that is, a
recurrence relation of the form
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 + 𝑓(𝑛)
where c1, c2, . . . , ck are real numbers and f(n) is a function not identically zero depending
only on n. The recurrence relation 𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 is called the associated
homogeneous recurrence relation. It plays an important role in the solution of the
nonhomogeneous recurrence relation.
Example: Each of the recurrence relations an = an-1 + 2n, an = an-1 + an-2 + n2 + n + 1,
37
Discrete Mathematics & Combinatorics

an =3an-1 + n3n, and an = an-1 + an-2 + an-3 + n! is a linear nonhomogeneous recurrence relation
with constant coefficients. The associated linear homogeneous recurrence relations are
an = an-1, an = an-1 + an-2, an = 3an-1, and an = an-1 + an-2 + an-3, respectively.
The key fact about linear nonhomogeneous recurrence relations with constant coefficients
is that every solution is the sum of a particular solution and a solution of the associated linear
homogeneous recurrence relation.
Theorem 4: If anp is a particular solution of the nonhomogeneous linear recurrence relation with
constant coefficients 𝑎𝑛 =𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 + 𝑓(𝑛),
then all solution is of the form 𝑎𝑛 = 𝑎𝑛ℎ + 𝑎𝑛𝑝 ,where 𝑎𝑛ℎ is a solution of the associated
homogeneous recurrence relation 𝑎𝑛 =𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 .
Example 1: Find all solutions of the recurrence relation 𝑎𝑛 =3𝑎𝑛−1 + 2𝑛. What is the solution
with a1 = 3?
Solution: To solve this linear nonhomogeneous recurrence relation with constant coefficients,
we need to solve its associated linear homogeneous equation and to find a particular solution for
the given nonhomogeneous equation. The associated linear homogeneous equation is 𝑎𝑛 =3𝑎𝑛−1 .
Its solutions are 𝑎𝑛ℎ = 𝛼3𝑛 where α is a constant.
We now find a particular solution. Because f(n) = 2n is a polynomial in n of degree
one, a reasonable trial solution is a linear function in n , say An + B, where A and B are
constants. To determine whether there are any solutions of this form, suppose that 𝑎𝑛𝑝 = An + B is
such a solution. By substitution on the recurrence relation 𝑎𝑛 =3𝑎𝑛−1 + 2𝑛, implies
An + B =3(A(n-1) + B) + 2n.
Simplifying and combining like terms gives
(2 + 2A)n+ (2B – 3A) = 0. It follows
2 + 2A = 0 and
2B – 3A = 0.
This shows that An + B is a solution if and only if A = −1 and B = −3/2.
Which implies, 𝑎𝑛𝑝 = −n − 3/2 is a particular solution.
Then all solutions are of the form 𝑎𝑛 = 𝑎𝑛ℎ + 𝑎𝑛𝑝 = 𝛼3𝑛 + −𝑛 − 3/2 , where α is a constant.
To find the solution with a1 = 3, let n = 1 on general solution. We find that 3 = −1 − 3/2 + 3α,
which implies that α = 11/6. Therefore the required solution is

38
Discrete Mathematics & Combinatorics

11
𝑎𝑛 = 3𝑛 + −𝑛 − 3/2.
6

Example 2: Find all solutions of the recurrence relation an = 5an-1 − 6an-2 + 7n.
Solution: This is a linear nonhomogeneous recurrence relation. The solutions of its associated
homogeneous recurrence relation an = 5an-1 − 6an-2 are 𝑎𝑛ℎ = α1·3n + α2·2n, where α1 and α2 are
constants.
Here f(n) = 7n, a reasonable trial solution is anp = C· 7n, where C is a constant.
Substituting the terms of this sequence into the recurrence relation implies that
C·7n = 5C · 7n-1 − 6C·7n-2 + 7n.
Dividing both sides of this equation by 7n-2 becomes 49C = 35C − 6C + 49,
⇒20C = 49, ⇒C = 49/20.
Hence, anp = (49/20)7n is a particular solution.
Therefore, all solutions are
an = α1· 3n + α2·2n + (49/20)7n
Theorem 5: Suppose that {an} satisfies the linear nonhomogeneous recurrence relation
𝑎𝑛 =𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 + 𝑓(𝑛), where c1, c2, . . . , ck are real numbers, and
f(n) = (btnt + bt-1nt-1 +· · ·+b1n+ b0)sn, where b0, b1, . . . , bt and s are real numbers. When s is not
a root of the characteristic equation of the associated linear homogeneous recurrence relation,
there is a particular solution of the form
anp = (ptnt + pt-1nt-1 +· · ·+p1n+ p0)sn
When s is a root of this characteristic equation and its multiplicity is m, there is a particular
solution of the form
anp = nm(ptnt + pt-1nt-1 +· · ·+p1n+ p0)sn
Note that in the case when s is a root of multiplicity m of the characteristic equation of
the associated linear homogeneous recurrence relation, the factor nm ensures that the proposed
particular solution will not already be a solution of the associated linear homogeneous recurrence
relation.
Example 1: What form does a particular solution of the linear nonhomogeneous recurrence
relation an = 6an-1 − 9an-2 +f(n) have when
a) f(n) = 3n
b) f(n) = n3n,
c) f(n) = n22n
39
Discrete Mathematics & Combinatorics

d) F(n) =(n2 + 1)3n?


Solution: The associated linear homogeneous recurrence relation is an = 6an-1 − 9an-2. Its
characteristic equation, r2 − 6r + 9 = (r − 3)2 = 0, has a single root, r = 3, of multiplicity two.
a) If f(n) = 3n the above theorem tells us that a particular solution has the form Cn23n.
b) If f(n) = n3n , a particular solution has the form n2(p1n + p0)3n.
c) If f(n) = n22n , a particular solution has the form (p2n2 + p1n + p0)2n.
d) if f(n) = (n2 + 1)3n , a particular solution has the form n2(p2n2 + p1n + p0)3n
Example 2: Find all solution of the recurrence relation.

with initial values a0 = a1 = 1. The characteristic equation of the associated homogeneous


recurrence relation

is r2 – 3r + 2 = 0. Its roots are r = 1 and r = 2. Hence the general solution to the homogeneous
equation is 𝑎𝑛ℎ = 𝛼1 1𝑛 + 𝛼2 2𝑛 = 𝛼1 + 𝛼2 2𝑛 . In order to find a particular solution to the non-
homogeneous solution, let anp = (An+B)n2n be a particular solution of the given
nonhomogeneous recurrence relation. Then by substitution we have,

Dividing both sides by 2n – 1

Comparing coefficients, we obtain


B = B - A + 1 and A + B = 0.
which yields A = 1, B = - 1.
By substituting on
𝑎𝑛 = 𝑎𝑛ℎ + 𝑎𝑛𝑝
The general solution to the recurrence relation is given by
𝑎𝑛 = 𝛼1 + 𝛼2 2𝑛 + (𝑛 − 1)𝑛2𝑛
Using initial conditions, 𝛼1 = 1 , 𝛼2 = 0.
Therefore, the required solution is
𝑎𝑛 = 1 + (𝑛 − 1)𝑛2𝑛 .
40
Discrete Mathematics & Combinatorics

Example: Solve the recurrence equation an - 5an-1 + 6an-2 = 2n + n with initial condition a1 = 0
and a2 = 10.
Solution: The general to the problem is given by the homogeneous part of the given recurrence
equation.
The homogeneous part of the equation is

The characteristic equation of is given as


r2 – 5r + 6 = 0, implies r – 2)(r – 3) = 0
Implies r = 2 and r = 3.
The two roots 2 and 3 of characteristic equation are distinct. So the homogeneous solution is
given by

anh
Let particular solution be

anp =
Substituting this particular solution in the given recurrence relation , we have

Thus, particular solution is

41
Discrete Mathematics & Combinatorics

Using initial conditions for n = 1 and n = 2, we get

Replacing the values of A and B, we get the closed form formula for the given
recurrence equation

ii) Substitution method


Example 1: Use iteration to solve the recurrence relation an = an-1 + n with
a0 = 4.

42
Discrete Mathematics & Combinatorics

Example 2: Solve the recurrence equation an = an – 1 + 3 with a1 = 2.


Solution: Using substitution Method,

2.3 Generating Functions


Generating functions are used to represent sequences efficiently by coding the terms of a sequence
as coefficients of powers of a variable x in a formal power series. Generating functions can be used
to solve many types of counting problems, such as the number of ways to select or distribute
objects of different kinds, subject to a variety of constraints, and the number of ways to make
change for a dollar using coins of different denominations. Generating functions can be used to

43
Discrete Mathematics & Combinatorics

solve recurrence relations by translating a recurrence relation for the terms of a sequence into an
equation involving a generating function. This equation can then be solved to find a closed form
for the generating function. From this closed form, the coefficients of the power series for the
generating function can be found, solving the original recurrence relation.
Definition: The generating function for the sequence a0, a1. . . ak, . . . of real numbers is the
infinite series

Note: The generating function for {ak} given in the above definition is sometimes called the
ordinary
generating function of {ak} to distinguish it from other types of generating functions for this
sequence.
Example 1: The generating functions for the sequences {ak} with
a) ak= 3,
b) ak = k + 1
c) ak = 2k
are

Example 2: What is the generating function for the sequence 1, 1, 1, 1, 1, 1?


Solution. The generating function of 1, 1, 1, 1, 1, 1 is

G(x) =

.
Example 3: Let m be a positive integer. Let ak = C(m, k), for k = 0, 1, 2, . . . , m. What is the
generating function for the sequence a0, a1, . . . , am?
Solution: The generating function for this sequence is

The binomial theorem shows that G(x) = (1 + x) m.


44
Discrete Mathematics & Combinatorics

Example 4:

Example 5:

Example 6: Find a generating function for 1, 3, 5, 7, 9, . . ..


Solution: Notice that the sequence of differences is constant. We know how to find the
generating function for any constant sequence. So denote the generating function for 1, 3, 5, 7, 9,
. . . by A. We have

Example 7: Find the generating function for 1, 4, 9, 16, . . .. Note we take a0 = 1.


Solution: Again we call the generating function for the sequence A. Using differencing

45
Discrete Mathematics & Combinatorics

Example 8: The sequence 1, 3, 7, 15, 31, 63, . . . satisfies the recurrence relation
an = 3an-1 − 2an-2. Find the generating function for the sequence.
Solution: Call the generating function for the sequence A. We have

Thus, the generating function is

Definition:

Example 1: Find the values of the extended binomial coefficients

Solution: Taking u = −2 and k = 3 in definition above gives us

46
Discrete Mathematics & Combinatorics

EXAMPLE 2: When the top parameter is a negative integer, the extended binomial coefficient
can be expressed in terms of an ordinary binomial coefficient. To see that this is the case, note
that

Theorem 6: The extended binomial theorem

Let x be a real number with |x| < 1 and let u be a real number. Then

Example 1: Find the generating functions for (1 + x)-n and (1 − x)-n, where n is a positive integer,
using the extended binomial theorem.
Solution: By the extended binomial theorem, it follows that

Using the above example

47
Discrete Mathematics & Combinatorics

Useful Generating Functions

48
Discrete Mathematics & Combinatorics

Example 2: Since Heather’s neighbors just moved in, she thought it would be nice to put
together a fruit basket for them in the basket she recently made at summer camp. When
Heather’s mother returned from the grocery store, she had a bag containing apples, bananas, and
oranges. How many different possibilities are there for a fruit basket consisting of 36 pieces of
fruit if
a) there is an ample supply of apples and bananas, but there are only 4 oranges?
b) there are 16 of each kind of fruit?
c) there is an ample supply of bananas and oranges, and there are 4 distinguishable apples
(one Cortland, one Delicious, one Empire, and one Macintosh)?
In each case, fruit baskets are distinguished solely by how many of each type
of fruit they contain.
Solution:

with n = 3 tell us that the coefficient of x36 in g(x) is

49
Discrete Mathematics & Combinatorics

iii) Using Generating Functions to Solve Recurrence Relations


Example 1: Solve the recurrence relation ak = 3ak-1 for k = 1, 2, 3, . . . and initial condition a0 =
2.
Let G(x) be the generating function for the sequence {ak}, that is,

50
Discrete Mathematics & Combinatorics

Example 2: Use generating functions to find an explicit formula for an for the recurrence
relation

Solution:

51
Discrete Mathematics & Combinatorics

Example: Use generating functions to solve the recurrence relation


an = 3an-1 + 2, a0 = 1

52
Discrete Mathematics & Combinatorics

Hence an = 2.3n – 1, which is the required solution.


Check list
To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. Solve linear recurrence relations with constant coefficients using
a) Characteristic roots method
b) Substitution method.
c) Generating function.
2. Define generating function.
3. Find a generating function for a given sequence.
Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.

Exercise 2.2
1. For each recurrence relation and initial conditions, find: (i) general solution; (ii) unique
solution with the given initial conditions:

2. Solve the following recurrence relations with the initial conditions.

53
Discrete Mathematics & Combinatorics

3. Find the unique solution to each recurrence relation with the given initial conditions:

a)

b)
4.

5.

6. What is the general form of the particular solution of the linear non homogeneous recurrence
relation

7. Find the generating function for the finite sequence 2, 2, 2, 2, 2, 2.


8. Find the generating function for the finite sequence 1, 4, 16, 64, 256.
9. Find a closed form for the generating function for each of these sequences. (For each
sequence, use the most obvious choice of a sequence that follows the pattern of the initial
terms listed.)
a) 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, . . .
b) 0, 0, 0, 1, 1, 1, 1, 1, 1, . . .
c) 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, . . .
d) 2, 4, 8, 16, 32, 64, 128, 256, . . .
e) 2, −2, 2, −2, 2, −2, 2, −2, . . .

54
Discrete Mathematics & Combinatorics

f) 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, . . .
g) 0, 0, 0, 1, 2, 3, 4, . . .
10. Find a closed form for the generating function for the sequence {an}, where
a) an = 5 for all n = 0, 1, 2, . . . .
b) an= 3n for all n = 0, 1, 2, . . . .
c) an = 2 for n = 3, 4, 5, . . . and a0 = a1 = a2 = 0.
d) an = 2n + 3 for all n = 0, 1, 2, . . . .
11. Find a generating function for the sequence with recurrence relation an = 3an -1 – an-2 with
initial terms a0 = 1 and a1 = 5.
12. Find the generating function for the sequence with closed formula an = 2(5n) + 7(−3)n.
13. Find a closed formula for the nth term of the sequence with generating function

G(x) =
14. For each of these generating functions, provide a closed formula for the sequence it
determines.

15. Use generating functions to solve the recurrence relation ak = 5ak-1 − 6ak-2 with initial
conditions a0 = 6 and a1 = 30.
16. Use generating functions to solve the recurrence relation ak = ak-1 + 2ak-2 + 2k with initial
conditions a0 = 4 and a1 = 12.

Review Exercise

55
Discrete Mathematics & Combinatorics

56
Discrete Mathematics & Combinatorics

Chapter Three
Elements of Graph Theory
Chapter Objectives
On completion of this chapter, students will be able to

 Understand a graph.
 Understand simple graph and multi graph.
 Know different types of simple graphs.
 Understand isomorphism of two graphs.
 Understand walk and path on a graph.
 Understand connectivity of graphs.
 Understand Eulerian graphs and Hamiltonian graphs.
 Understand planar graph.
 Understand tree.
 Understand directed graph.

Introduction
Graphs are discrete structures consisting of vertices and edges that connect these vertices. There
are different kinds of graphs, depending on whether edges have directions, whether multiple edges
can connect the same pair of vertices, and whether loops are allowed. Problems in almost every
conceivable discipline can be solved using graph models.
Objectives: On completion of subtopic, students will be able to.

 Define a graph.
 Identify simple graph and multi graph.
 Identify different types of simple graphs.
 Find degree of a vertex in an undirected graph.
 State hand shaking theorem and verify it for any finite undirected graph.

3.1 Definitions of terms of graphs and types of graphs

Definition: A graph G = (V, E) consists of V, a nonempty set of vertices (or nodes) and E, a set
of edges. Each edge has either one or two vertices associated with it, called its endpoints. An
edge is said to connect its endpoints.
57
Discrete Mathematics & Combinatorics

Example 1: Let G= (V, E) is a graph with V ={a, b, c, d} and

E= {(a, b), (a, c),(a, d), (b, c), (b, d), (c, d)}
Then draw the graph G.
Solution: G is the graph below

b
a

c
d
Note: The set of vertices V of a graph G may be infinite. A graph with an infinite vertex set or an
infinite number of edges is called an infinite graph, and in comparison, a graph with a finite
vertex set and a finite edge set is called a finite graph.
Undirected graph
An undirected graph G consists of set V of vertices and a set E of edges such that each edge e ∈
E is associated with an unordered pair of vertices.
In other words, if each edge of the graph G has no direction then the graph is called undirected
graph.
We can refer to an edge joining the vertex pair i and j as either (i, j) or (j, i).
Example: The graph G below is an undirected graph.

Example 2: The following is the graph with 5 vertices and 6 edges.

58
Discrete Mathematics & Combinatorics

Graph Terminology and Special Types of Graphs


Definition: Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in
G if u and v are endpoints of an edge e of G. Such an edge e is called incident with the vertices u
and v and e is said to connect u and v.
Example 1: The vertices a and b , b and c are adjacent vertices and the respective edges
Definition: The set of all neighbors of a vertex v of G = (V ,E), denoted by N(v), is called the
neighborhood of v. If A is a subset of V , we denote by N(A) the set of all vertices in G that are
adjacent to at least one vertex in A. So,

Definition: The degree of a vertex in an undirected graph is the number of edges incident with it,
except that a loop at a vertex contributes twice to the degree of that vertex. The degree of the
vertex v is denoted by deg(v).
Example 1: what are the degrees and what are the neighborhoods of the vertices in the graph G
displayed in Figure below?

Solution: deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d ) = 1, deg(e) = 3, and


deg(g) = 0.
The neighborhoods of these vertices are N(a) = {b, f }, N(b) = {a, c, e, f },
59
Discrete Mathematics & Combinatorics

N(c) = {b, d, e, f }, N(d) = {c}, N(e) = {b, c, f }, N(f ) = {a, b, c, e}, and N(g) = ∅.
Example 2: what are the degrees and what are the neighborhoods of the vertices in the graph G
displayed in figure below?

H
Solution: deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, and deg(d ) = 5. The neighborhoods of
these vertices are N(a) = {b, d, e}, N(b) = {a, b, c, d, e}, N(c) = {b}, N(d) = {a, b, e}, and N(e) =
{a, b, d}.
Isolated and pendent vertices
Isolated vertex
A vertex having no incident edge is called an isolated vertex. In other words, isolated vertices are
those with zero degree.
Pendent or end vertex
A vertex of degree one, is called a pendent vertex or an end vertex. In the above Figure, v5 is a
pendent vertex.
In degree and out degree
In a graph G, the out degree of a vertex vi of G, denoted by out degG (vi) or degG+ (vi), is the
number of edges beginning at vi and the in degree of vi, denoted by in degG (vi) or degG− (vi), is
the number of edges ending at vi.
The sum of the in degree and out degree of a vertex is called the total degree of the vertex.
Theorem 1: Handshaking theorem
If G = (v, E) be an undirected graph with e edges .then the sum of degrees of the vertices of G is
equal to twice the number of edges. i.e

Example 1: Verify handshaking theorem for the graph G below.

60
Discrete Mathematics & Combinatorics

Solution: deg(a) = 2 , deg(b) = 2, deg(c) =4, deg(d) =2 deg(e) =2 and deg(f) =2.
e=7
deg(a) +deg(b) + deg(c) + deg(d)+deg(e) +deg(f) = 2*e
2+2+4+2+2+2 = 14 = 2*7.
Example 2: How many vertices and edges must a graph have if its degree sequence is (4, 4, 3, 3,
3, 2, 1)?
Solution: The number of vertices is easy to find, it is the number of degrees in the sequence: that
is 7. To find the number of edges, we compute the degree sum:
4 + 4 + 3 + 3 + 3 + 2 + 1 = 20,
so the number of edges is half this. Which is 10.
Example 3: Determine the number of edges in a graph with 6 vertices, 2 of degree 4 and 4 of
degree 2. Draw two such graphs.
Solution: Suppose the graph with 6 vertices has e number of edges. Therefore by Handshaking
theorm, we have

Hence the number of edges in a graph with 6 vertices with given condition is 8.
The graph is as follows

61
Discrete Mathematics & Combinatorics

Corollary 1: In a non-directed graph, the total number of odd degree vertices is even.
Example 4: How many edges are there in a graph with 10 vertices each of degree six?

Solution: Because the sum of the degrees of the vertices is 6 ・ 10 = 60, it follows that 2e = 60

where m is the number of edges.


Therefore, e = 30.

Some Special Simple Graphs


i) Complete Graphs
Definition: A complete graph on n vertices is a simple graph that contains exactly one edge
between each pair of distinct vertices. Denoted by Kn,
Example 1: The graphs Kn, for n = 1, 2, 3, 4, 5 are given below.

K1 K2 K3 K4 K5

𝑛(𝑛−1)
Note: A complete graph with n vertices has C(n , 2) = edges.
2

ii) Cycles
Definition: A cycle graph Cn, n ≥ 3, consists of n vertices v1, v2, . . . , vn and edges (v1, v2),(v2,
v3) , . . . , (vn-1, vn}, and {vn, v1}.
Example 2: The cycles C3, C4 and C5 are given below

C3 C4 C5

62
Discrete Mathematics & Combinatorics

iii) Bipartite Graphs


Definition: A simple graph G is called bipartite if its vertex set V can be partitioned into two
disjoint sets V1 and V2 such that every edge in the graph connects a vertex in V1 and a vertex in
V2 (so that no edge in G connects either two vertices in V1 or two vertices in V2).
When the condition holds in the above definition we call the pair (V1, V2) a bipartition of the
vertex set V of G.
Example 3: C6 is bipartite, as shown in diagram below.
Because its vertex set can be partitioned into the two sets V1 = {v1, v3, v5} and V2 = {v2, v4, v6},
and every edge of C6 connects a vertex in V1 and a vertex in V2.

C6

Example 4: Show that K3 is not bipartite.


Solution: To verify this, note that if we divide the vertex set of K3 into two disjoint sets, one of
the two sets must contain two vertices. If the graph were bipartite, these two vertices could not
be connected by an edge, but in K3 each vertex is connected to every other vertex by an edge.
Example 5: Are the graphs G and H displayed in Figure below bipartite?

G H
Solution: Graph G is bipartite because its vertex set is the union of two disjoint sets, {a, b, d} and
{c, e, f, g}, and each edge connects a vertex in one of these subsets to a vertex in the other subset.
Graph H is not bipartite because its vertex set cannot be partitioned into two subsets so that edges
do not connect two vertices from the same subset.

63
Discrete Mathematics & Combinatorics

Definition: A complete bipartite graph Km ,n is a graph that has its vertex set partitioned into two
subsets of m and n vertices, respectively with an edge between two vertices if and only if one
vertex is in the first subset and the other vertex is in the second subset.
Example 6: Draw the complete bipartite graphs K2,3 and K3,3.
Solution:

K2,3 K3,3.

Definition: A subgraph of a graph G = (V ,E) is a graph H = (W, F), where W ⊆ V and F ⊆ E.


Example 7: The graph G is a subgraph of K5.
Solution: K5 and its subgraph G are given below.

K5 G

Check list
To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. Define a graph (undirected graph).
2. Define simple graph and multi graph.
3. Define simple graphs (regular graph, complete graph, bipartite graph).
4. Find degree of a vertex in an undirected graph.
5. State handshaking theorem and verify it for any finite undirected
graph.

64
Discrete Mathematics & Combinatorics

Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.
Exercise 3.1
1. Find the number of vertices, the number of edges, and the degree of each vertex in the given
undirected graph. Identify all isolated and pendant vertices.

G H

K
2. Find the sum of the degrees of the vertices of each graph in question no.1 and verify that it
equals twice the number of edges in the graph.
3. Draw the following graphs.
a) K7 b) K1,5 c) K4,4 d) C7
4. Determine whether the following graphs are bipartite or not.

G1 G2

G3 G4
5. Which of the graphs below are bipartite? Justify your answers.
65
Discrete Mathematics & Combinatorics

G1 G2 G3 G4
6. For which values of n are these graphs bipartite.
a) Kn b) Cn
7. How many vertices and how many edges do these graphs have?
a) Kn b) Cn
8. How many edges does a graph have if its degree sequence is 4, 3, 3, 2, 2? Draw such a graph.
9. How many edges does a graph have if its degree sequence
is 5, 2, 2, 2, 2, 1? Draw such a graph.
10. For which values of n are these graphs regular?
a) Kn b) Cn
11. For which values of m and n is Km,n regular?
12. If 10 people each shake hands with each other, howmany handshakes took place? What does
this question have to do with graph theory?

3.2 Isomorphism of Graphs and Matrix Representations of Graphs


Objectives: On completion of subtopic, students will be able to

 Define isomorphism of two graphs.


 Determine whether the given two graphs are isomorphic or not.
 List the invariant properties of isomorphic graphs.
 Define incidence matrix and adjacency matrix of a graph.
 Find the incidence matrix and adjacency matrix of a graph.

Isomorphism of Graph
Definition: The simple graphs G1 = (V1 ,E1) and G2 = (V2 ,E2) are isomorphic if there exists a one
-to-one and onto function f from V1 to V2 with the property that a and b are adjacent in G1 if
and only if f (a) and f (b) are adjacent in G2, for all a and b in V1. Denoted by G1≅ G2.
Two simple graphs that are not isomorphic are called non isomorphic. In other words, when two
simple graphs are isomorphic, there is a one-to-one correspondence
66
Discrete Mathematics & Combinatorics

between vertices of the two graphs that preserves the adjacency relationship.
Example 1: Show that the graphs G = (V ,E) and H = (W, F) are isomorphic.

G H
Solution: Take the function f with f (u1) = v1, f (u2) = v4,
f (u3) = v3, and f (u4) = v2
is a one to-one and onto function between V and W. To see that this correspondence preserves
adjacency.
In graph G u1 and u2, u1 and u3, u2 and u4 and u3 and u4, and each of the pairs f (u1) = v2 and
f (u2) = v4, f (u1) = v1 and f (u3) = v3, f (u2) = v4 and f (u4) = v2 and f (u3) = v3 and f (u4) = v2
consists of two adjacent vertices in H.
Therefore, the graphs G and H are isomorphic.
Example 2: Decide whether the graphs G1 = {V1, E1} and G2 = {V1, E2} are isomorphic.
V1 = {a, b, c, d}, E1 = {{a, b}, {a, c}, {a, d}, {c, d}}
V2 = {a, b, c, d}, E2 = {{a, b}, {a, c}, {b, c}, {c, d}}

Solution: We can try to build an isomorphism. How about we say f (a) = b, f (b) = c, f (c) = d
and f (d) = a. This is definitely a bijection, but to make sure that the function is an isomorphism.
Alternatively, notice that in G1, the vertex a is adjacent to every other vertex. In G2, there is also
a vertex with this property: c. So build the bijection g : V1 → V2 by defining g(a) = c to start
with. Next, where should we send b? In G1, the vertex b is only adjacent to vertex a. There is
exactly one vertex like this in G2, namely d. So let g(b) = d. As for the last two, in this example,
we have a free choice: let g(c) = b and g(d) = a.
We should check that this really is an isomorphism. It is definitely a bijection. We must make
sure that the edges are respected.
The four edges in G1 are {a, b}, {a, c}, {a, d}, {c, d}.
67
Discrete Mathematics & Combinatorics

Under the proposed isomorphism these become


{g(a), g(b)}, {g(a), g(c)}, {g(a), g(d)}, {g(c), g(d)} i.e {c, d}, {c, b}, {c, a}, {b, a},
which are precisely the edges in G2. Thus g is an isomorphism, so G1 is isomorphic to G2
Note: A property preserved by isomorphism of graphs is called a graph invariant.
Isomorphic simple graphs must have the same number of vertices, because there is a one-to-one
correspondence between the sets of vertices of the graphs.
Isomorphic simple graphs also must have the same number of edges, because the one-to-one
correspondence between vertices establishes a one-to-one correspondence between edges. In
addition, the degrees of the vertices in isomorphic simple graphs must be the same. That is, a
vertex v of degree d in G must correspond to a vertex f (v) of degree d in H, because a vertex
w in G is adjacent to v if and only if f (v) and f (w) are adjacent in H. i.e.
The necessary conditions for two graphs to be isomorphic are
i. both must have the same number of vertices.
ii. both must have the same number of edges.
iii. both must have equal number of vertices with the same degree.
iv. they must have the same degree sequence and same cycle vector (c1, ......, cn), where
ci is the number of cycles of length i.
Example 3: Show that the graphs G and H are not isomorphic.

G H
Solution: Both G and H have five vertices and six edges. However,H has a vertex of degree one,
namely, e, whereas G has no vertices of degree one. It follows that G and H are not isomorphic.
Matrix Representations of Graphs
i) Adjacency Matrix
ii) Incidence Matrix

68
Discrete Mathematics & Combinatorics

Definition: Suppose that G = (V ,E) is a simple graph where |V| = n. Suppose that the vertices of
G are listed arbitrarily as v1, v2, . . . , vn. The adjacency matrix A (or AG) of G, with respect
to this listing of the vertices, is the n x n zero–one matrix with 1 as its (i, j )th entry when vi
and vj are adjacent, and 0 as its (i, j )th entry when they are not adjacent. In other words, if its
adjacency matrix is A = [aij ], then

Example 4: Find the adjacency matrix of the graph G.

Solution: Using the definition the adjacency matrix of G is


A(G) =

Example 5: Draw a graph with the adjacency matrix with respect to the ordering of vertices a, b,
c, d.

Solution: The graph with given adjacency matrix is

69
Discrete Mathematics & Combinatorics

Definition: Let G = (V ,E) be an undirected graph. Suppose that v1, v2, . . . , vn are the vertices
and e1, e2, . . . , em are the edges of G. Then the incidence matrix with respect to this ordering of
V and E is the n × m
matrix

Example 6: Represent the graph G shown below with an incidence matrix.

G
Solution: The incidence matrix of G is

Note: If the adjacency matrix of G is the same as the adjacency matrix of H, then the two graphs
are isomorphic.

Example 7: Determine whether the graphs G and H are isomorphic.

G H
Solution: Both G and H have six vertices and seven edges. Both have four vertices of degree two
and two vertices of degree three. It is also easy to see that the subgraphs of G and H consisting of
all vertices of degree two and the edges connecting them are isomorphic. Because G and H agree
with respect to these invariants,
The adjacency matrix of G is

70
Discrete Mathematics & Combinatorics

and the adjacency matrix of H is

This implies AG = AH, it follows that G and H are isomorphic.


Subgraphs
We say that G′ = (V′, E′) is a subgraph of G = (V, E), and write G′ ⊆ G, provided V′ ⊆ V and
E′ ⊆ E. We say that G′ = (V′, E′) is an induced subgraph of G = (V, E) provided V′ ⊆ V and
every edge in E whose vertices are still in V′ is also an edge in E′.
Example 1: Consider the graphs

Here both G2 and G3 are subgraphs of G1. But only G2 is an induced subgraph. Every edge in G1
that connects vertices in G2 is also an edge in G2. In G3, the edge {a, b} is in E1 but not E3, even
though vertices a and b are in V3.
The graph G4 is not a subgraph of G1, even though it looks like all we did is remove vertex e.
The reason is that in E4 we have the edge {c, f } but this is not an element of E1, so we don’t
have the required E4 ⊆ E1.

71
Discrete Mathematics & Combinatorics

3.3 Path and Connectivity


Objectives: On completion of subtopic, students will be able to
 Define walk and path on undirected graph.
 Find walk and path on a graph.
 Define connectivity of graphs.

Determine whether the given graph is connected or disconnected.


Many problems can be modeled with paths formed by traveling along the edges of graphs. For
instance, the problem of determining whether a message can be sent between two computers using
intermediate links can be studied with a graph model. Problems of efficiently planning routes for
mail delivery, garbage pickup, diagnostics in computer networks, and so on can be solved using
models that involve paths in graphs.
Definition: A walk is defined as a finite alternative sequence of vertices and edges which begins
and ends with vertices, such that no edge appears more than once in the sequence.
Example 1: In the graph shown below the sequences v2e4v6 e5v4 e3v3 is a walk.

Example 2:

72
Discrete Mathematics & Combinatorics

Definition: Let n be a nonnegative integer and G an undirected graph. A path of length n from u
to v in G is a sequence of n edges e1,e2 . . . , en of G for which there exists a sequence x0 = u, x1, . .
. , xn-1, xn = v of vertices such that ei has, for i = 1, . . . , n, the endpoints xi-1 and xi . When the graph
is simple, we denote this path by its vertex sequence x0, x1, . . . , xn (because listing these vertices
uniquely determines the path).
The path is a circuit if it begins and ends at the same vertex, that is, if u = v, and has length greater
than zero. The path or circuit is said to pass through the vertices x1, x2. . . xn-1 or traverse the edges
e1, e2, . . . , en.
A path or circuit is simple if it does not contain the same edge more than once.
Example 1: In the simple graph H shown below a, d, c, f , e is a simple path of length 4, because
{a, d},{d, c}, {c, f }, and {f, e} are all edges. However, d, e, c, a is not a path, because {e, c} is
not an edge. Note that b, c, f , e, b is a circuit of length 4 because {b, c}, {c, f }, {f, e}, and {e, b}
are edges, and this path begins and ends at b. The path a, b, e, d, a, b, which is of length 5, is not
simple because it contains the edge {a, b} twice.

H
A path or circuit is called simple if it does not contain the same edge more than once.

Connectedness in Undirected Graphs


Definition: An undirected graph is called connected if there is a path between every pair of distinct
vertices of the graph. An undirected graph that is not connected is called disconnected. We say
that we disconnect a graph when we remove vertices or edges, or both, to produce a disconnected
subgraph.
Thus, any two computers in the network can communicate if and only if the graph of this network
is connected.

73
Discrete Mathematics & Combinatorics

Example 1: The graph G1 given below is connected, because for every pair of distinct vertices
there is a path between them. However, the graph G2 is not connected. For instance, there is no
path in G2 between vertices a and d.

G1 G2
Theorem 2: There is a simple path between every pair of distinct vertices of a connected
undirected graph.
A connected component of a graph G is a connected subgraph of G that is not a proper subgraph
of another connected subgraph of G. That is, a connected component of a graph G is a maximal
connected subgraph of G.A graph G that is not connected has two or more connected components
that are disjoint and have G as their union.
Example 2: What are the connected components of the graph H?
Solution: The graph H is the union of three disjoint connected subgraphs H1, H2, and H3.
.These three subgraphs are the connected components of H given below.

H1 H2 H3
How Connected is a Graph?
Suppose that a graph represents a computer network. Knowing that this graph is connected tells
us that any two computers on the network can communicate. However, we would also like to
understand how reliable this network is. For instance, will it still be possible for all computers to
communicate after a router or a communications link fails? To answer this and similar questions,
we now develop some new concepts.

74
Discrete Mathematics & Combinatorics

Sometimes the removal from a graph of a vertex and all incident edges produces a subgraph with
more connected components. Such vertices are called cut vertices (or articulation points).
The removal of a cut vertex from a connected graph produces a subgraph that is not connected.
Analogously, an edge whose removal produces a graph with more connected components than
in the original graph is called a cut edge or bridge. Note that in a graph representing a computer
network, a cut vertex and a cut edge represent an essential router and an essential link that cannot
fail for all computers to be able to communicate.
Example 1: Find the cut vertices and cut edges in the graph G.

Solution: The cut vertices of G are b, c, and e. The removal of one of these vertices (and its
adjacent edges) disconnects the graph. The cut edges are {a, b} and {c, e}. Removing either one
of these edges disconnects G1.
A subset U of the vertex set V of G = (V , E) is a vertex cut, or separating set, if G – U is
disconnected. For instance, in the following graph G, the set {b, c, e} is a vertex cut with three
vertices.

G
Paths and Isomorphism
There are several ways that paths and circuits can help determine whether two graphs are
isomorphic.
For example, the existence of a simple circuit of a particular length is a useful invariant that can
be used to show that two graphs are not isomorphic. In addition, paths can be used to construct
mappings that may be isomorphism.

75
Discrete Mathematics & Combinatorics

As we mentioned, a useful isomorphic invariant for simple graphs is the existence of a simple
circuit of length k, where k is a positive integer greater than 2.
Example 2: Determine whether the graphs G and H shown below are isomorphic.

G H
Solution: Both G and H have six vertices and eight edges. Each has four vertices of degree three,
and two vertices of degree two. So, the three invariants number of vertices, number of edges, and
degrees of vertices all agree for the two graphs. However, H has a simple circuit of length three,
namely, v1, v2, v6, v1, whereas G has no simple circuit of length three, as can be determined by
inspection (all simple circuits in G have length at least four). Because the existence of a simple
circuit of length three is an isomorphic invariant, G and H are not isomorphic.
Example 3: Determine whether the graphs G1 and G2 are isomorphic.

Solution: Both G and H have five vertices and six edges, both have two vertices of degree three
and three vertices of degree two, and both have a simple circuit of length three, a simple circuit
of length four, and a simple circuit of length five. Because all these isomorphic invariants agree,
G and H may be isomorphic.
To find a possible isomorphism, we can follow paths that go through all vertices so that the
corresponding vertices in the two graphs have the same degree. For example, the paths u1, u4, u3,
u2, u5 in G and v3, v2, v1, v5, v4 in H both go through every vertex in the graph; start at a vertex of
degree three; go through vertices of degrees two, three, and two, respectively; and end at a vertex
of degree two. By following these paths through the graphs, we define the mapping f with f (u1) =

76
Discrete Mathematics & Combinatorics

v3, f (u4) = v2, f (u3) = v1, f (u2) = v5, and f (u5) = v4. This show that f is an isomorphism, so G and
H are isomorphic.
Check list
To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t

1. Define isomorphism of two graphs.


2. Determine whether the given two graphs are isomorphic or not.
3. List the invariant properties of isomorphic graphs.
4. Define incidence matrix and adjacency matrix of a graph.
5. Find the incidence matrix and adjacency matrix of a graph.
6. Define walk and path on undirected graph.
7. Find walk and path on a graph.
8. Define connectivity of graphs.
9. Determine whether the given graph is connected or disconnected.
Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.
Exercise 3.2
1. Define isomorphism of two graphs
2. Determine whether the given pair of graphs isomorphic.

a)
G H

b)
G1 G2

77
Discrete Mathematics & Combinatorics

c)
G H

d)
G1 G2
3. Represent the given graphs using
a) Adjacency matrix.
b) Incidence matrix

G1 G2

G3
c) Draw an undirected graph represented by the given adjacency matrix.

78
Discrete Mathematics & Combinatorics

A1 = A2 =

A3 =
4. Are the simple graphs with the following adjacency matrices isomorphic?

5. Describe the row and column of an adjacency matrix of a graph corresponding to an


isolated vertex.
6. Describe the row of an incidence matrix of a graph corresponding to an isolated vertex.
7. Does each of these lists of vertices form a path in the following graph? Which are circuits?
What are the lengths of those that are paths?

8. Determine whether the given graph is connected or disconnected.

G H
79
Discrete Mathematics & Combinatorics

9. Find the number of paths between c and d in the graph G of length


a) 2 b) 3 c) 4 d) 5 e) 6 f) 7

10. Find all the cut vertices of the following graphs.

G1 G2
11. Find all the cut edges in the graphs G1 and G2 on Q no. 10 above.
12. Find κ(Km,n) and λ(Km,n), where m and n are positive integers.
13. Draw a graph G with κ(G) = 1, λ(G) = 2, and minv∈V deg(v) = 3.

3.4 Eulerian and Hamiltonian Graph


Objectives: On completion of subtopic, students will be able to
 Define Eulerian graphs and Hamiltonian graphs.
 Determine whether a graph is Eulerian or not.
 Determine whether a graph is Hamiltonian or not.

Euler circuit and Euler path


Definition: An Euler circuit in a graph G is a simple circuit containing every edge of G. An
Euler path in G is a simple path containing every edge of G.
Definition: A graph G is said to be Eulerian if it has an Eulerian circuit.
The following examples illustrate the concept of Euler circuits and paths.

80
Discrete Mathematics & Combinatorics

Example: Which of the undirected graphs given below are Eulerian graph?

G1 G2 G3
Solution: The graph G1 has an Euler circuit, for example, a, e, c, d, e, b, a. Neither of the graphs
G2 or G3 has an Euler circuit.
However, G3 has an Euler path a, c, d, e, b, d, a, b. G2 does not have an Euler path.
Therefore, G1 is Eulerian graph.

Hamilton Paths and Circuits


Definition: A simple path in a graph G that passes through every vertex exactly once is called a
Hamilton path, and a simple circuit in a graph G that passes through every vertex exactly once is
called a Hamilton circuit.
Definition: A graph is said to be a Hamiltonian graph if it contains Hamiltonian cycle i.e. A
graph G is Hamiltonian if there exist a cycle containing every vertex of G.
Example 1: Which of the simple graphs are Hamilton graph?

Solution: G1 has a Hamilton circuit: a, b, c, d, e, a. This implies G1 is Hamiltonian graph. There


is no Hamilton circuit in G2 (this can be seen by noting that any circuit containing every vertex
must contain the edge {a, b} twice), but G2 does have a Hamilton path, namely, a, b, c, d. G3 has
neither a Hamilton circuit nor a Hamilton path, because any path containing all vertices must
contain one of the edges {a, b},{e, f }, and {c, d} more than once.

81
Discrete Mathematics & Combinatorics

Example 2: Show that neither graph displayed below has a Hamilton circuit.

Solution: There is no Hamilton circuit in G because G has a vertex of degree one, namely, e.
Now consider H. Because the degrees of the vertices a, b, d, and e are all two, every edge
incident with these vertices must be part of any Hamilton circuit. It is now easy to see that no
Hamilton circuit can exist in H, for any Hamilton circuit would have to contain four edges
incident with c, which is impossible.
Example 3: Show that K5 has a Hamilton circuit whenever n ≥ 3.
Solution: We can form a Hamilton circuit in K5 beginning at any vertex. Such a circuit can be
built by visiting vertices in any order we choose, as long as the path begins and ends at the same
vertex and visits each other vertex exactly once. This is possible because there are edges in K5
between any two vertices.

3.5 Planar Graph


Objectives: At the end of this lesson, students will be able to
 Define planar graph.
 Determine whether a graph is planar or nonplanar.
 State Euler’s formula.
 Verify Euler’s formula for a connected planar graph

Definition: A graph is called planar if it can be drawn in the plane without any edges crossing ,
where a crossing of edges is the intersection of the lines or arcs representing them at a point other
than their common endpoint. Such a drawing is called a planar representation of the graph.
A graph may be planar even if it is usually drawn with crossings, because it may be possible to
draw it in a different way without crossings.
Example 1: Is K4 planar?
Solution: K4 is planar because it can be drawn without crossings as shown below.

82
Discrete Mathematics & Combinatorics

K4 with edge crossing K4 without edge crossing (planar representation)

Applications of planar graphs


Planarity of graphs plays an important role in the design of electronic circuits. We can model a
circuit with a graph by representing components of the circuit by vertices and connections between
them by edges. We can print a circuit on a single board with no connections crossing if the graph
representing the circuit is planar. When this graph is not planar, we must turn to more expensive
options. For example, we can partition the vertices in the graph representing the circuit into planar
subgraphs. We then construct the circuit using multiple layers.We can construct the circuit using
insulated wires whenever connections cross. In this case, drawing the graph with the fewest
possible crossings is important.
The planarity of graphs is also useful in the design of road networks. Suppose we want to connect
a group of cities by roads. We can model a road network connecting these cities using a simple
graph with vertices representing the cities and edges representing the highways connecting them.
We can built this road network without using underpasses or overpasses if the resulting graph is
planar.
Euler’s Formula
A planar representation of a graph splits the plane into regions, including an unbounded region.
Euler showed that all planar representations of a graph split the plane into the same number of
regions. He accomplished this by finding a relationship among the number of regions, the
number of vertices, and the number of edges of a planar graph.
Theorem 3: Euler’s formula
Let G be a connected planar simple graph with e edges and v vertices. Let r be the number of
regions in a planar representation of G. Then r = e − v + 2.

83
Discrete Mathematics & Combinatorics

Example 1: Suppose that a connected planar simple graph has 20 vertices, each of degree 3. Into
how many regions does a representation of this planar graph split the plane?
Solution: This graph has 20 vertices, each of degree 3, so v = 20. Because the sum of the degrees

of the vertices, 3v = 3 ・ 20 = 60, is equal to twice the number of edges(2e)

we have 2e = 60, This implies e = 30.


Consequently, from Euler’s formula, the number of regions is
r = e − v + 2 = 30 − 20 + 2 = 12.
Corollary 2: If G is a connected planar simple graph with e edges and v vertices, where v ≥ 3,
then e ≤ 3v − 6.
Example 1: Show that K5 is nonplanar using the above corollary.

Solution: The graph K5 has five vertices and 10 edges. However, the inequality e ≤ 3v − 6 is

not satisfied for this graph because e = 10 and 3v − 6 = 3(5) – 6 = 9. Implies 10 > 9.Therefore,

K5 is not planar.
Theorem 4: Kuratowski’s Theorem
A graph is nonplanar if and only if it contains a subgraph which is a subdivision of K3,3 or K5.

3.6 Trees and forest


Objectives: At the end of this lesson, students will be able to
 Define tree graph.
 Determine whether a graph is a tree or not.
 Define rooted tree.

Trees are particularly useful in computer science, where they are employed in a wide range of
algorithms. For instance, trees are used to construct efficient algorithms for locating items in a list.
They can be used in algorithms, such as Huffman coding, that construct efficient codes saving
costs in data transmission and storage. Trees can be used to study games such as checkers and
chess and can help determine winning strategies for playing these games. Trees can be used to
model procedures carried out using a sequence of decisions. Constructing these models can help
determine the computational complexity of algorithms based on a sequence of decisions, such as
sorting algorithms.

84
Discrete Mathematics & Combinatorics

We can assign weights to the edges of a tree to model many problems. For example, using weighted
trees we can develop algorithms to construct networks containing the least expensive set of
telephone lines linking different network nodes.
Definition: A tree is a simple connected undirected graph with no simple circuits.
Example 1: Which of the graphs shown below are trees?

Solution: G1 and G2 are trees, because both are connected graphs with no simple circuits. G3 is
not a tree because e, b, a, d, e is a simple circuit in this graph. Finally, G4 is not a tree because
it is not connected.
Trees are often defined as undirected graphs with the property that there is a unique simple path
between every pair of vertices.
THEOREM 5: An undirected graph is a tree if and only if there is a unique simple path between
any two of its vertices.
Theorem 6: A tree T with n vertices has exactly (n – 1) edges.
Example: A graph G1 on example1 above is tree with n = 6 vertices and 6 – 1 = 5 edges.
Definition: A forest is a graph that contains no cycles.
Example: The graph G given below is forest with 9 vertices and 6 edges.

b e g h

a c
f i
d
G

85
Discrete Mathematics & Combinatorics

Note: Each components of a forest is a tree.


Definition: If G is connected graph and u and v are any two vertices of G, the length of the shortest
path between u and v is called the distance between u and v and is denoted by d (u, v). The distance
function on defined above has the following properties. If u, v and w are any three vertices of a
connected graph then.
i. d (u, v) ≥ 0 and d (u, v) = 0 iff u = v
ii. d (u, v) = d (v, u)
iii. d(u, v) ≤ d (u, w) + d (w, v)
Definition: Let G be a connected graph. For any vertex v on G, the eccentricity of v denoted by
e(v) is
e (v) = max {d (u, v) : u, v ∈ v}
Note: e (v) is the length of the longest path in G starting from the vertex v.
Example: In the graph G below, e (v1) = 3.

Definition: The diameter of a connected r graph G is defined as the maximum eccentricity among
all vertices of the graph G. It is denoted by d.
Hence, d = diameter of G = max {e (v): v ∈V}
Definition: The radius of a connected graph G is defined as the maximum eccentricity among all
vertices of the graph. It is denoted by r.
Thus r = radius of G = min {e(v): v ∈V}
Note: The radius of connected graph may not be half of its diameter.
Example: Consider the tree T below.

86
Discrete Mathematics & Combinatorics

Solution: e (v1) = 5, e (v2) = 5, e (v3) = 4,


e (v4) = 3, e (v5) = 3, e (v6) = 4,
e (v7) = e (v8) = 5
The radius of T = r = 3
Definition: The center of connected graph G is defined as the set of vertices having minimum
eccentricity among all vertices of the graph. It is denoted by C or C (G).
C = C (G) = center of G = {v ∈V : e(v) = r}
Example 1: Consider the graph G below.

G
Solution: e (v1) = 4, e (v2) = 3, e (v3) = 2,
e (v4) = 3, e (v5) = 4, radius of G = i = 2.
Hence center of G = {v3}.
Note:
i. The distance between two adjacent vertices of a connected graph G is 1.
ii. The maximum distance from each vertex of G occurs at a pendant vertices of G.
iii. If C (G) = V (G) then G is called self-centred graph.
iv. If P is a path of even length the P has only one vertex at the centre.
v. If P is a path of odd length this centre of P contains two adjacent vertices.
Example 2: In the graph G below.

G
Solution: Centre of G = {v3, v4}

87
Discrete Mathematics & Combinatorics

Rooted Trees
Definition: A rooted tree is a tree in which one vertex has been designated as the root and every
edge is directed away from the root.
The terminology for trees has botanical and genealogical origins. Suppose that T is a rooted tree.
If v is a vertex in T other than the root, the parent of v is the unique vertex u such that there is a
directed edge from u to v (the reader should show that such a vertex is unique). When u is the
parent of v, v is called a child of u. Vertices with the same parent are called siblings. The ancestors
of a vertex other than the root are the vertices in the path from the root to this vertex, excluding
the vertex itself and including the root (that is, its parent, its parent’s parent, and so on, until the
root is reached). The descendants of a vertex v are those vertices that have v as an ancestor. A
vertex of a rooted tree is called a leaf if it has no children. Vertices that have children are called
internal vertices. The root is an internal vertex unless it is the only vertex in the graph, in which
case it is a leaf.
If a is a vertex in a tree, the subtree with a as its root is the subgraph of the tree consisting of a and
its descendants and all edges incident to these descendants.
Example 1: In the rooted tree T (with root a) shown below, find the parent of c, the children of
g, the siblings of h, all ancestors of e, all descendants of b, all internal vertices, and all leaves.
What is the subtree rooted at g?

Solution: The parent of c is b. The children of g are h, i, and j . The siblings of h are i and j .
The ancestors of e are c, b, and a. The descendants of b are c, d, and e. The internal vertices
are a, b, c, g, h, and j . The leaves are d, e, f , i, k, l, and m. The subtree rooted at g is shown
below

88
Discrete Mathematics & Combinatorics

Note: Rooted trees with the property that all of their internal vertices have the same number of
children are used in many different applications. like searching, sorting, and coding.
Definition: A rooted tree is called an m-ary tree if every internal vertex has no more than m
children.
The tree is called a full m-ary tree if every internal vertex has exactly m children. An m-ary
tree with m = 2 is called a binary tree.
Example 1: Are the rooted trees given below full m-ary trees for some positive integer m?

Solution: T1 is a full binary tree because each of its internal vertices has two children. T2 is a
full 3-ary tree because each of its internal vertices has three children. In T3 each internal vertex
has five children, so T5 is a full 5-ary tree. T4 is not a full m-ary tree for any m because some of
its internal vertices have two children and others have three children.
Ordered rooted trees
Definition: An ordered rooted tree is a rooted tree where the children of each internal vertex are
ordered. Ordered rooted trees are drawn so that the children of each internal vertex are shown in
order from left to right. Note that a representation of a rooted tree in the conventional way
determines an ordering for its edges. We will use such orderings of edges in drawings without
explicitly mentioning that we are considering a rooted tree to be ordered.

89
Discrete Mathematics & Combinatorics

In an ordered binary tree (usually called just a binary tree), if an internal vertex has two children,
the first child is called the left child and the second child is called the right child.
The tree rooted at the left child of a vertex is called the left subtree of this vertex, and the tree
rooted at the right child of a vertex is called the right subtree of the vertex. The reader should note
that for some applications every vertex of a binary tree, other than the root, is designated as a right
or a left child of its parent. This is done even when some vertices have only one child.
Example 1: What are the left and right children of d in the binary tree T shown below (where the
order is that implied by the drawing)? What are the left and right subtrees of c?

Solution: The left child of d is f and the right child is g.


The left and right subtrees T1 and T2 respectively are shown as follows

T1 T2

Definition: Let G be a simple graph. A spanning tree of G is a subgraph of G that is a tree


containing every vertex of G.
A simple graph with a spanning tree must be connected, because there is a path in the spanning
tree between any two vertices. The converse is also true; that is, every connected simple graph
has a spanning tree.

90
Discrete Mathematics & Combinatorics

Example 1: Find two different spanning trees of the graph

Example 2: Find a spanning tree of the simple graph G.

G
Solution: The graph G is connected, but it is not a tree because it contains simple circuits.
Remove the edge {a, e}. This eliminates one simple circuit, and the resulting subgraph is still
connected and still contains every vertex of G. Next remove the edge {e, f } to eliminate a
second simple circuit. Finally, remove edge {c, g} to produce a simple graph with no simple
circuits. This subgraph is a spanning tree, because it is a tree that contains every vertex of G.

T1

T2 T3

91
Discrete Mathematics & Combinatorics

T4 T5

T1 , T2 , T3, T4 and T5 Spanning trees of G


Theorem 7: A simple graph is connected if and only if it has a spanning tree.

3.7 Graph Coloring


Objectives: At the end of this sub topic, students will be able to
 Define coloring of graph.
 Find chromatic number of a graph.
Definition: Properly coloring of a graph
Coloring all the vertices of a graph with colors such that no two adjacent vertices have the same
color is called the proper coloring (or simply coloring) of a graph.
The k-colorings of the graph G is a coloring of graph G using k-colors. If the graph G has k-
coloring, then the graph G is said to be k-colorable.
Example: The following are three different coloring of the graph G.

5- Coloring of G 4- coloring of G 3-coloring of G

92
Discrete Mathematics & Combinatorics

Definition: The chromatic number of a graph is the least number of colors needed for a coloring
of this graph. The chromatic number of a graph G is denoted by χ(G). (Here χ is the Greek letter
chi.)
Example 1: What are the chromatic numbers of the graphs G and H given below?

Solution: The chromatic number of G is at least three, because the vertices a, b, and c must be
assigned different colors. To see if G can be colored with three colors, assign red to a, blue to b,
and green to c. Then, d can (and must) be colored red because it is adjacent to b and c.
Furthermore, e can (and must) be colored green because it is adjacent only to vertices colored red
and blue, and f can (and must) be colored blue because it is adjacent only to vertices colored red
and green. Finally, g can (and must) be colored red because it is adjacent only to vertices colored
blue and green. This produces a coloring of G using exactly three colors. i.e χ(G) = 3.
The graph H is made up of the graph G with an edge connecting a and g. Any attempt to color H
using three colors must follow the same reasoning as that used to color G, except at the last stage,
when all vertices other than g have been colored. Then, because g is adjacent (in H) to vertices
colored red, blue, and green, a fourth color, say brown, needs to be used. Hence, H has a chromatic
number equal to 4. i.e χ(G) = 4.
The coloring of G and H using 3 and 4 colors respectively are given below

93
Discrete Mathematics & Combinatorics

Example 2: What is the chromatic number of Kn?


Solution: A coloring of Kn can be constructed using n colors by assigning a different color
to each vertex. Is there a coloring using fewer colors? The answer is no. No two vertices can be
assigned the same color, because every two vertices of this graph are adjacent. Hence, the
chromatic number of Kn is n. That is, χ(Kn) = n.
Example 3: What is the chromatic number of the complete bipartite graph Km,n, where m and n
are positive integers?
Solution: The number of colors needed may seem to depend on m and n. Only two colors are
needed, because Km,n is a bipartite graph. Hence, χ(Km,n) = 2. This means that we can color the
set of m vertices with one color and the set of n vertices with a second color. Because edges connect
only a vertex from the set of m vertices and a vertex from the set of n vertices, no two adjacent
vertices have the same color.
The coloring of K5 and K3,4 using 5 and 2 colors respectively are given below.

5 coloring of K5 2 coloring of K3 , 4

Example 4: What is the chromatic number of the graph Cn, where n ≥ 3?


Solution: We will first consider some individual cases. To begin, let n = 6. Pick a vertex and color
it red. It is necessary to assign a second color, say blue, to the next vertex reached. Continue in the
clockwise direction; the third vertex can be colored red, the fourth vertex blue, and the fifth vertex
red. Finally, the sixth vertex, which is adjacent to the first, can be colored blue. Hence, χ(C6) =2.

94
Discrete Mathematics & Combinatorics

C6 C5
2 coloring and 3 coloring of C6 and C5
THEOREM: The four color theorem
The chromatic number of a planar graph is not greater than four.
Note:
- χ (G) ≤ | V |, where | V | is the number of vertices of G.
- If some subgraph of G requires k colors then χ (G) ≥k.
- If deg(v) = d, then at most d colors are required to color the vertices adjacent to v.

3.8 Directed Graph


Objectives: At the end of this sub topic, students will be able to
 Define directed graph.
 Find adjacency matrix and incidence matrix of a directed graph.

A directed graph or digraph D consists of a set V of vertices and a set E of edges such that e ∈E
is associated with an ordered pair of vertices.
In other words, if each edge of the graph D has a direction then the graph is called directed graph.
In the diagram of directed graph, each edge e = (u, v) is represented by an arrow or directed curve
from initial point u of e to the terminal point v.
The following graph is an example of a directed graph.

Directed graph D
95
Discrete Mathematics & Combinatorics

Suppose e = (u, v) is a directed edge in a digraph, then


(i) u is called the initial vertex of e and v is the terminal vertex of e
(ii) e is said to be incident from u and to be incident to v.
(iii) u is adjacent to v, and v is adjacent from u.

Definition: A directed graph D that contain a directed self-loop an directed parallel edges is said

to be a directed multi graph.

Note: The initial vertex and terminal vertex of loop are the same.

Definition: In a directed graph D, if there is no more than one directed edge in a particular direction
between a pair of vertices, then it is called simple directed graph.

Note: A directed graph which is not simple is called directed multi graph.

D1 D2

D1 is simple directed graph D2 is directed multi graph

Degree of a vertex on directed graph

Definition: Let D be a directed graph the out degree of a vertex v of D is the number of edge

beginning at v, it is denoted by deg+(v).

Definition: Let D be a directed graph the in degree of vertex v of D is the number of edge

deg-(v).

Note: a directed loop contributes one for out-degree and one for in degree.

Example: Consider the directed graph G.

G
96
Discrete Mathematics & Combinatorics

deg⁺(u1) =1 deg⁻(u1) =2 deg⁺(u3)=3 deg⁻(u3)=1

deg⁺(u2) =3 deg⁻(u2) =2 deg⁺(u4) = 0 deg⁻(u4)=2

Theorem 7: Let G=(V,E) be a graph with directed edges then the sum of the in- degrees and the
sum of out- degrees of all vertices in a graph are equal. Both of these sums are equal to number
of edges in the graph.

That is, ∑deg⁻(v) = ∑deg⁺(v) = |E|

In the above example, ∑deg⁺(v) =∑deg⁻(v)

⇒ deg⁺(u1)+deg⁺(u2)+deg⁺(u3)+deg⁺(u4)= deg⁻(u1)+deg⁻( u2)+deg⁻(u3)+deg⁻(u4)

1+3+3+0=2+2+1+2

⇒ 7 = 7 = |E|

Definition: A vertex with zero in- degree is called a source where as a vertex without zero out-

degree is called a sink.

Matrix Representation of Directed Graph

Adjacency Matrix Representation of Directed Graph


Definition: The adjacency matrix for a directed graph G on the ordered list of vertices v1, v2, . . .
, vn is the n × n matrix A= [ai,j ] such that ai,j is the number of edges from vi to vj .
Example 1: Find the adjacency matrix of the directed graph D.

Solution: D

we take the ordering of the vertices to be 1, 2, 3, 4, 5, then the adjacency matrix


obtained is

A=

97
Discrete Mathematics & Combinatorics

Remark:- The adjacency matrices can also be used to represent directed multi graphs. Again
such matrices are not zero one matrices. When there are multiple edges in the same direction
connecting two vertices in the adjacency matrix for a directed multi graph aij equals the number
of edges that are associated to (vi,vj).

Incidence Matrix Representation of Directed Graph

Definition: The incidence matrix B = {bij} of a di graph D with n vertices and m edges is the

nxm matrix in which

1, if arc j is directed away from a vertex vi

bij = -1, if arc j is directed towards vertex vi

0, otherwise

Example: A directed graph G and its incidence matrix are shown

Connectivity of Directed Graph

Definition: A directed graph is strongly connected if there is a path from a to b and from b to a

whenever a and b are vertices in the graph. In other word, a directed graph to be strongly connected
there must be a sequence of directed edges from any vertex in the graph to any other vertex.
98
Discrete Mathematics & Combinatorics

Definition: A directed graph is weakly connected if there is a path between any two vertices in the

underlying undirected graph. That is a directed graph is weakly connected if and only if there is

always a path between two vertices when the direction of the edges are disregarded.

Remark: Any strongly connected directed graph is also weakly connected.

Example:

Solution: G is strongly connected because there is a path between any two vertices in this
directed graph and G is also can be weakly connected. H is not strongly connected because there
is no directed path from a to b in this graph , hence H is weakly connected graph.
Check list

To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. Define Eulerian graph and Hamiltonian graph.
2. Find Eulerian circuit in a graph if it exist.
3. Find Hamiltonian cycle in a graph if it exist.
4. Determine whether a graph is Eulerian or not.
5. Determine whether a graph is Hamiltonian or not.
6. Define planar graph.
7. Determine whether a graph is planar or nonplanar.
8. State Euler’s formula.
9. Verify Euler’s formula for a connected planar graph.
10. Define tree graph.
11. Determine whether a graph is a tree or not.

99
Discrete Mathematics & Combinatorics

12. Define rooted tree and spanning tree of a connected graph.


13. Define directed graph.
14. Find adjacency matrix and incidence matrix of a directed graph.

Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.

Exercise 3.3

1. Determine whether the given graph has an Euler circuit or not. Construct such a circuit
when one exists.

G1 G2

G3
2. For which values of n do these graphs have an Euler circuit?
a) Kn b) Cn
3. Determine whether the given graph has a Hamilton circuit.

G H

4. Draw the given planar graph without any crossings.

100
Discrete Mathematics & Combinatorics

G1 G2

G3
5. Determine whether the given graph is planar. if so, draw it so that no edges cross.

G H

H1 H2

6. Suppose that a connected planar graph has eight vertices, each of degree three. Into how
many regions is the plane divided by a planar representation of this graph?
7. Suppose that a connected planar graph has six vertices, each of degree four. Into how
many regions is the plane divided by a planar representation of this graph?
8. Suppose that a connected planar graph has 30 edges. If a planar representation of this
graph divides the plane into 20 regions, how many vertices does this graph have?
9. Which of these nonplanar graphs have the property that the removal of any vertex and all
edges incident with that vertex produces a planar graph?
a) K5 b) K6 c) K3,3 d)K3,4
10. Which of these graphs are trees?
101
Discrete Mathematics & Combinatorics

11. In the graph G below , find


a) Eccentricity of G.
b) Center of G.

G
12. Which of the following graphs are trees?
(a) G = (V, E) with V = {a, b, c, d, e} and
E = {{a, b}, {a, e}, {b, c}, {c, d}, {d, e}}
(b) G = (V, E) with V = {a, b, c, d, e} and
E = {{a, b}, {b, c}, {c, d}, {d, e}}
(c) G = (V, E) with V = {a, b, c, d, e} and
E = {{a, b}, {a, c}, {a, d}, {a, e}}
(d) G = (V, E) with V = {a, b, c, d, e} and E = {{a, b}, {a, c}, {d, e}}
13. Answer these questions about the rooted tree illustrated.

102
Discrete Mathematics & Combinatorics

a) Which vertex is the root?


b) Which vertices are internal?
c) Which vertices are leaves?
d) Which vertices are children of j?
e) Which vertex is the parent of h?
f) Which vertices are siblings of o?
g) Which vertices are ancestors of m?
h) Which vertices are descendants of b?
14. Find a spanning tree for the graph shown by removing edges in simple circuits.

G1
G2

15. Find a spanning tree for each of these graphs.


a) K5 b) K4,4 c) C5

d) e)

103
Discrete Mathematics & Combinatorics

15. Find the chromatic number of the following graphs.

G1 G2

G3 G4
16. Determine whether each of these graphs is strongly connected and if not, whether it is weakly
connected.

G1 G2

G3 G4

Review Exercise

104
Discrete Mathematics & Combinatorics

105
Discrete Mathematics & Combinatorics

Chapter 4

Weighted Graphs and Their Applications

Chapter Objectives
On completion of this chapter, students will be able to

 Understand weighted graph.


 Know the minimal spanning tree of a weighted graph.
 Know the shortest path between two vertices.
 Understand algorithms (kruskal’s , Prim’s) algorithms to find the minimal spanning tree
of a graph and the shortest path between two vertices.
 Understand algorithms Dijkstra’s algorithm to find the shortest path between two
vertices.
 Understand travelling sales man problem.

4.1 Definition and Examples of Weighted Graph

Objectives: After completion of this topic, students will be able to


 Define weighted graph.
 Give examples of weighted graph.
 Define the minimal spanning tree of a weighted graph.
 Find the minimal spanning tree of a weighted graph.
 Define the shortest path between two vertices.
 Find the shortest path between two vertices.
 Use kruskal’s algorithm and Prim’s algorithm to find the minimal spanning
tree of a graph and the shortest path between two vertices.
 Use Dijkstra’s algorithm to find the shortest path between two vertices.

Definition: A graph G = (V, E) is called weighted graph if each edge of graph G is assigned
positive number we called the weight of the edge. Such weights might represent for example costs,
lengths or capacities, depending on the problem at hand. Some authors call such a graph a network.

106
Discrete Mathematics & Combinatorics

Example 1: The following two graphs are weighted graphs.

G H

G is weighted undirected graph and H is directed weighted graph

4.2 Minimum Spanning Trees


Objectives: After completion of this topic, students will be able to
 Define the minimal spanning tree of a weighted graph.
 Find the minimal spanning tree of a weighted graph.
 Use kruskal’s algorithm and Prim’s algorithm to find the minimal spanning
tree of a graph.

Definition: Let G= (V, E) be a connected weighted graph. A minimum spanning trees T of the
graph G is a tree whose total weight is smallest among all the spanning trees of the graph G. Total
weight of a spanning tree is the sum of the weights of each edges on the spanning tree.

Example: Consider the given graph G,

a
4 1
2 b
d 5
3

c
G

Find the minimum spanning tree of this graph.


Solution: First find all spanning tree of this graph.

107
Discrete Mathematics & Combinatorics

T8

Let Tw is the weight of the tree, then

Tw(T1) = 4+3+5 = 12 , Tw(T2) =4+1+5 =10, Tw(T3) =1+2+5 = 8, Tw(T4) =4+3+5 =12, Tw(T5) =
4+2+5 =11, Tw(T6) = 4+2+5 = 9, Tw(T7) = 1+2+3 = 6, Tw(T8) = 4+3+2 = 9

108
Discrete Mathematics & Combinatorics

 The minimum spanning tree of above graph is


Tm = min(Tw(T1), Tw(T2), Tw(T3) ,Tw(T4), Tw(T5) ,Tw(T6) Tw(T7) ,Tw(T8))
= min(8, 10, 8, 12, 11, 9, 6, 9)

Tw(T7) = 6 is the minimum spanning tree of this graph.

There are two famous algorithms finding the minimum spanning tree:

i. Kruskal’s Algorithm

Kruskal’s Algorithm builds the spanning tree by adding edges one by one into a growing spanning
tree. This algorithm finds an edge which has least weight and add it to the growing Kruskal’s
Algorithm

Input: A connected weighted graph G with n vertices.


Step 1: Arrange the edges of in order of increasing weights and select the edge with minimum
weight.
Step 2: Proceed sequentially, add each edge which does not result in a cycle until n – 1, edges are
selected.
Step 3: Exit.
Example 1: Consider the graph G.

G
Solution: We have n = 6
We order the edges by increasing weights (v2, v4) is edge with minimum weight. Select the
edge(v2, v4) we successively add edges to (v2, v4), without forming cycles until 6 – 1 = 5 edges

109
Discrete Mathematics & Combinatorics

are selected. This yields:

Edges in the minimum spanning tree are (v2, v4), (v1, v5), (v4, v6), (v3, v5), (v1, v6). The resulting
minimal (optimal) spanning tree is

We apply the steps of Kruskal’s algorithm to the graph G as follows:


(v2, v4) is the edge with minimum weight, therefore we select the edge (v2, v4). The next edge
with minimum weight is (v1, v5), selection of (v1, v5) does not result in a cycle.
edge (v1, v5) is selected.
ii. Prim’s Algorithm

In Prim’s Algorithm we grow the spanning tree from starting position. Unlike an edge in Kruskal’s,
we add vertex to the growing spanning tree in Prim’s

Step1. Choose any vertex v1 of G

Step2. Choose an edge e1 =(v1, v2) of G such that v2 ≠ v1 and e1 has smallest weight among the

edges of G incident with v1.

Step3. If edges e1, e2 ,…, ei have been choosen involving end points v1, v2, …, vi+1. Choose an edge

ei+1= (vj, vk) with vjϵ ( v1, v2, …, vi+1) and vk∉ (v1, v2, …, vi+1) such that ei+1 has smallest weight
among the of G with precisely one end in (v1, v2, …, vi+1).

Step4. Stop after n-1 edges n-1 edges have been choosen

Example: Find the minimal spanning tree of the weighted graph in figure below by Prim’s
algorithm.

110
Discrete Mathematics & Combinatorics

Solution: Let denote the edge of G ; e1 = (v1, v2), e2 = (v2, v3) , e3 = (v3, v4), e4 = (v4, v1) , e5 = (v2,
v5) and e6 = (v4, v6).

We apply Prims algorithm to the graph as follows:


The edge e3 = (v3, v4) is an edge with minimum weight. Hence, we start with the vertex v3 and
select the edge e3 incident with v3.

We next consider the edges connecting a vertex {v3, v4} with the vertex of the set V – {v3, v4}.
We observe that e6 the edge with minimum weight.

Consider the edges connecting the vertices of the set {v3, v4, v6} with the vertices of V – {v3, v4,
v6}. The edge e2 has the minimum weight. The edge e2 is selected.

111
Discrete Mathematics & Combinatorics

of the connecting the vertices of {v2, v3, v4, v6}; with the vertex set V – {v2, v3, v4, v6}, e4 has
minimum weight, therefore e4 is selected.

e1, e5 are the edges remaining. e5 is the only edge connecting {v1, v2, v3, v4, v5, v6} and {v5} such
that the inclusion of e5 does not result in a cycle. Hence e5 is selected. Since number of edges
selected is 5 we stop.
The minimal spanning tree obtained is shown below

Weight of the minimal spanning tree = 2 + 4.8 + 5 + 6.3 + 12.5= 30.6

4.3 Shortest path problem


Objectives: After completion of this topic, students will be able to
 Define the shortest path between two vertices.
 Find the shortest path between two vertices.
 Use Dijkstra’s algorithm to find the shortest path between two vertices.

In many areas like transportation, cartoon motion planning, communication network topology
design etc, problems related to finding shortest path algorithms.
The shortest path problem is concerned with finding the least cost (that costs minimum) path
from an originating node in a weighted graph to a destination node in that graph.

112
Discrete Mathematics & Combinatorics

Shortest path algorithms


Dijkstra’s algorithm
To find the length of a shortest path from vertex A to vertex E in a weighted graph, proceed as
follows:
Step 1: Set v1 = A and assign to this vertex the permanent label O.
Assign every other vertex a temporary label of ∞, where ∞ is a symbol which, by definition, is
deemed to be larger than any real number.
Step 2: Until E has been assigned a permanent label or no temporary labels are changed in (a) or
(b), do the following.
a) Take the vertex vi which most recently acquired a permanent label, say d. For each vertex
v which is adjacent to vi and has not yet received a permanent label, if d + w(viv) < t the
current temporary label of v to d + w(viv).
b) Take a vertex v which has a temporary smallest among all temporary labels in the graph.
Set vi + 1 = v and make its temporary label permanent. If there are several vertices v which
tie for smallest temporary label, make any choice.
Example: Apply Dijkstra’s algorithm to the graph given below and find the shortest path
from a to f.

Solution: The initial labelling is given by

113
Discrete Mathematics & Combinatorics

114
Discrete Mathematics & Combinatorics

Applications of weighted graphs


Traveling Salesman Problem
A salesman required to visit a number of cities going through each city exactly once and return to
the starting point with the minimum kilometers travelled, given the distance and the routes.

However, currently there is no algorithm to solve this problem with in fewer steps. If the graph is
complete with a n vertices then there are (n-1)! different circuits. For n larger we have closest-
neighbour algorithm, which gives near optimal solution.

Closest Neighbour Algorithm

Let G =(V, E ,W) be a complete graph with n vertices. The closet- neighbour circuit of G starting
at v1 is (v1, v2, v3,…,vn) got by the following steps.

1. v1= v1-{ v1}


2. For i=2 to n-1 do;
2.1. vi; the closest vertex in vi-1 to vi-1; w(vi-1, vi) = min[w(vi-1, v) : vϵ vi-1]
a. vi=vi-1-{vi}
iii. un = the only element in vn.

Example 1: solve the sales man problem of the following graph.


a

7 c 12 9 14 b 10

13 5 6 8

d 11 e

115
Discrete Mathematics & Combinatorics

Solution:

Step1: Take one vertex that has small weight to another vertex, i.e. e. Now edge with smallest
weight incident on e is (e, d) =11, (e, c) = 8,(e, b) =5,(e, a) =10 .Now choose (e, b) because it
has minimum weight

Step 2: Now w(b, a) = 14, w(b, c) = 9, w(b, d) = 13, then we choose (b, c) because it has
minimum weight to each other. i.e

b c

Step 3: Now, w(c, e) = 8, w(c, d) = 6, w(c, a) = 12, we choose (c, d) because it has minimum
weight when compare to each other. i.e

b c

d e

Step 4: Now w(d, a) = 7, w(d, b) = 13, w(d, e) = 11, we choose (d, a) because it has minimum
weight when we compare each other. i.e

b c

d e

Step 5: Now w(a, b) = 14 , w(a, c) = 12, w(a, e) = 10, we choose (a, e) because it has
minimum weight when we compare to each other. i.e

b c

d e

116
Discrete Mathematics & Combinatorics

Now we stop to draw the edge because it has form a circle, then the sales man problem of the
above is this

Example 2: Look the following a weighted graph showing monthly lease cost for line in a
computer network.
$2000 New York
$1000
Chicago $800
San Francisco $1200 $1300 $700
$900 $1600 Atlanta
Denver $1400
$2200

Use prim’s algorithm to design a minimum cost communications network connecting all the
computers represented by the graph below.
Solution: we solve this problem by finding spanning tree in the graph in figure above. Prim’s
algorithm is carried out by choosing an initial edge of minimum weight and successively adding
edges of minimum weight that are incident to a vertex in the tree and that do not form simple
circuits.

Choice Edge cost

Step1 1 {Chicago, Atlanta} $700

Chicago

$700

Atlanta

Step2 2 {Atlanta, New york} $800

Chicago New york

$700 $800

Atlanta
117
Discrete Mathematics & Combinatorics

Step3 3 {Chicago, San-Francisco} $1200

$1200 Chicago New york

$700 $800

San-Francisco Atlanta

Step4 4 {San-Francisco, Denver} $900

Chicago New york

San-Francisco $1200 $700 $800

$900

Denver Atlanta

This graph shows minimum spanning tree produced by Prim’s algorithm with choice made at
each step displayed.

Therefore, the minimum cost communications network connecting all the computers represented
by above graph,

$800+$700+$1200+$900=$3600

Check list

To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. Define weighted graph.
2. Give examples of weighted graph.
3. Define the minimal spanning tree of a weighted graph.
4. Give examples of minimal spanning trees.
5. Find the minimal spanning tree of a weighted graph.

118
Discrete Mathematics & Combinatorics

6. Define the shortest path between two vertices.


7. Find the shortest path between two vertices.
8. Use kruskal’s algorithm and Prim’s algorithm to find the minimal
spanning tree of a graph and the shortest path between two vertices.
9. Use Dijkstra’s algorithm to find the shortest path between two
vertices.
Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.

Exercise

1. Determine whether the following graphs are weighted graphs or not.

G
2. Prim’s algorithm to find a minimum spanning tree for the given weighted graphs.

G1 G2
3. Determine a railway network of minimal cost for the cities.

119
Discrete Mathematics & Combinatorics

4. Find the length of a shortest path between a and z in the given weighted graph.

120
Discrete Mathematics & Combinatorics

Chapter 5

Network and Flow

Chapter Objectives
On completion of this chapter, students will be able to

 Understand the concept of network and network flow.


 Know the maximum flow of a given network flow.
 Understand max- flow and min- cut theorem and apply the theorem.

5.1 Definition and Examples of Network and Flow

Objectives: After completion of this topic, students will be able to


 Define network on a weighted directed graph.
 Define network flow.

Network
Let N = (V, E) be a loop-free connected directed graph. Then N is called a network, or transport
network, if the following conditions are satisfied:
i) There exists a unique vertex a ∈V with id(a), the in degree of a, equal to O. This
vertex a is called the source.
ii) There is a unique vertex z ∈V, called the sink, where od(z), the out degree of z,
equals O.
iii) The graph N is weighted, so there is a function from E to the set of non negative
integers that assigns to each edge e = (v, w) ∈E a capacity, denoted by
c(e) = c(v, w).
If N = (V, E) is a transport network, a function f from E to the non-negative integers is called a
flow for N.

121
Discrete Mathematics & Combinatorics

Example: The graph N below is network. Here vertex a is the source, the sink is at vertex z, and
capacities are shown beside each edge. Since c(a, b) + c(a, g) = 5 + 7 = 12, the amount of the
commodity being transported from a to z cannot exceed 12. With c(d, z) + c(h, z) = 5 + 6 = 11,
the amount is further restricted to be no greater than 11.

For the network, the label x, y on each edge e is determined so that x = c(e) and y is the value
assigned for a possible flow f. The label on each edge e satisfies f(e) & c(e).
In part (a) of the network flow, the flow into vertex g is 5, but the flow out from that vertex is 2 +
2 = 4.
Hence the function f is not a flow in this case.

For the network flow in above (b), only the edge (h, d) is saturated. All other edges are
unsaturated.
The value of the flow in this network is

122
Discrete Mathematics & Combinatorics

We observe that in the network flow (b)

Consequently, the total flow leaving the source a equals the total flow into the sink z.

5.2 Max–flow and Min–cut


Objectives: After completion of this topic, students will be able to
 Find the maximum flow of a given network flow.
 State max- flow and min- cut theorem and apply the theorem.

In any network, the value of any maximum flow is equal to the capacity of any minimum cut.
Example: Find a maximum flow in the network shown below and prove that it is a maximum.

N
Solution: We start by sending a flow of 2 units through the path sadt, a flow of 3 units through
sbet, and a flow of 3 units through scft, obtaining the flow shown on graph A below.
Continue by sending flows of 2 units through sbdt and 2 units through sbft, obtaining the flow
shown on graph B below.

A B
At this point, there are no further flow-augmenting chains from s to t involving only forward
arcs.

123
Discrete Mathematics & Combinatorics

However, we can use the backward arc da to obtain a flow-augmenting chain scbdaet. Since the
slack of this chain is 2, we add a flow of 2 to sc, cb, bd, ae, and et, and subtract 2 from ad. The
result is shown in graph C below.

C
A search for further flow-augmenting chains takes us from s to c or b and on to d, where we are
stuck.
This tells us that the current flow (of value 14) is maximum.
It also presents us with a cut verifying maximality, namely, S = {s, b, c, d} (those vertices reachable
from s by flow-augmenting chains) and T = {a, e, f, t} (the complement of s).
The capacity of this cut is
Csa + Cbe + Cbf + Ccf + Cdt = 2 + 3 + 2 + 3 + 4 = 14.
Since this is the same as the value of the flow, we have verified that our flow is maximum.
Example 2: In the network given below

i) Verify the law of conservation of flow at a, e, and d.


ii) Find the value of the indicated flow.
iii) Find the capacity of the (s, t)-cut defined by S = {s, a, b} and T = {c, d, e, t}
iv) Can the flow be increased along the path sbedt ? If so, by how much ?
v) Is the given flow maximum? Explain.
Solution: The law of conservation holds at a because

124
Discrete Mathematics & Combinatorics

It holds at e because

It holds at d because

ii) the value of the flow is 6.


iii) The capacity of the cut is Cac + Cae + Cbe + Cbd = 3 + 1 + 4 + 3 = 11.
iv) No. Arc dt is saturated.
v) The flow is not maximum. For instance, it can be increased by adding 1 to the flow in the
arcs along sact.
Check list
To check your mastery the topic put (√ ) if you can perform it.; otherwise put (X) in front of each
statement.
Important points I Can I Can’t
1. Define network on a weighted directed graph.
2. Define network flow.
3. Find the maximum flow of a given network flow.
4. State max- flow and min- cut theorem and apply the theorem.
Is your response positive for the above questions? If your answer is “I Can”, go to the next
section. If your answer is “I Can’t”, go back and read once again.

125
Discrete Mathematics & Combinatorics

Exercise
1. Determine which of the graphs are networks.
a
a 4 t 2 4

1 2 b 2 s 4 t

s 3 c 5 b 6

G H

•b •t

1 2 0

s 0 •a •c

4 5

d•

2. Consider the flow f in the network N shown below.

a• (5, 2) •c

(4, 3) (3, 1) (2, 2)

s• •t

(7, 2) (1, 1) (1, 1)

b• (2 , 1) •d

a) Find the capacity of the edges (s , a) and (a , c).


b) Find f(s ,a) f(a , c) f(a , d) and f(b ,d).
c) Determine which edges are saturated.

126
Discrete Mathematics & Combinatorics

d) Find the value of the flow (|F|).


3. Consider the network N on Q. No. 2 above.
a) Find two different maximal flows.
b) Find the value of each of these flows.
4. In the following network N, fill in the missing edge flows so that the result is a flow in
the given network. Determine the value of each of the flows.
a• (4 ,3) • c
(5, -) (1 , 1)
s• (2 ,2) •t
(4 , 2) (7 , _ )
b• (5 , _) • d
N

127
Discrete Mathematics & Combinatorics

Reference:

- Rosen, Kenneth H. Discrete mathematics and its applications. Seventh edition.


- Shanker G. Rao. Discrete mathematical Structure. Second edition.
- Vasudev C. Graph Theory with application, new age international publishers.
- Thomas K. Discrete Mathematics with Applications.
- Oscar L. Discrete mathematics. An open introduction. Third Edition.
- Kevin F. Discrete Mathematics. An introduction to proofs and combinatorics.

128

You might also like