0% found this document useful (0 votes)
15 views52 pages

Discrete Mathematics and Combinatory

Mathematics

Uploaded by

Remedan Kelil
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)
15 views52 pages

Discrete Mathematics and Combinatory

Mathematics

Uploaded by

Remedan Kelil
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/ 52

Discrete Mathematics and Combinatory

Introduction to combinatorics and graph theory (maths 274)


Handout
For 2nd year mathematics students

Prepared by; Tigist M.

1
Chapter One
Elementary counting principles
1.1 Basic counting principles

There are two basic counting principles. The first one involves addition and the
Second one multiplication.

Sum Rule Principle:


Suppose some event E can occur in m ways and a second event F can occur in n ways,
and suppose both events cannot occur simultaneously. Then E or F can occur in m + n
ways.
Product Rule Principle:
Suppose there is an event E which can occur in m ways and, independent of this event,
there is a second event F which can occur in n ways. Then combinations of E and F can
occur in mn ways.
The above principles can be extended to three or more events. That is, suppose an event
can occur in
ways, a second event can occur in ways, and, following ; a third event can
occur in ways, and so on. Then:

Sum Rule: If no two events can occur at the same time, then one of the events can occur
in:
+ + +・ ・ ・ ways.

Product Rule: If the events occur one after the other, then all the events can occur in the
order indicated in:
・ ・ . . . ways.

Example 1. Suppose a college has 3 different history courses, 4 different mathematics


courses, and 2 different biology courses.
(a) The number m of ways a student can choose one of each kind of courses is:

(b) The number n of ways a student can choose just one of the courses is:

n=3+4+2=9
Example 2. A guest at a formal dinner has 4 entrée choices and 2 dessert
choices. If a guest’s dinner is entirely determined by these two choices, then
how many different dinner choices are there?
Solution. The total number of dinner choices is given by the product
4 · 2 = 8.

2
The reason can be seen in the tree Figure each of the 4 branches connected
to the root of that tree splits off into 2 more branches. The 8 different ends represent
the various possible pairings of an entrée choice with a dessert Choice.

1.2. Permutations and combinations

Permutation

Definition: Any arrangement of a set of n objects in a given order is called a permutation


of the object (taken all at a time).
Any arrangement of any r ≤ n of these objects in a given order is called an “r-
permutation” or “a permutation of the n objects taken r at a time.” Consider, for
example, 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.
We usually are interested in the number of such permutations without listing them.
The number of permutations of n objects taken r at a time will be denoted by
, (Other texts may use Pr, , , ).
The following theorem applies.
Theorem 5.4: , ・・・ =
We emphasize that there are r factors in ・・・ .

Example1: Find the number m of permutations of six objects, say, A, B, C, D, E, F, taken


three at a time.
Solution: The first letter can be chosen in 6 ways; following this the second letter can be
chosen in 5 ways; and, finally, the third letter can be chosen in 4 ways. Write each
number in its appropriate position as follows:
6,5,4
By the Product Rule there are m = 6 ・ 5 ・ 4 = 120 possible three-letter words
without repetition from the six letters. Namely, there are 120 permutations of 6 objects
taken 3 at a time. This agrees with the formula in Theorem :
, = 6 ・ 5 ・ 4 = 120

3
Example2: How many ways are there to elect a class president, vice president, and
treasurer from a class of 30 students? We assume that each student is eligible for any
office and that no student may be elected to more than one office.

Solution. Regard the election results as an ordered list of length 3.


President, Vice President, Treasurer
There are 30 ways to fill in the first office, then 29 ways left to fill in the second office,
and finally 28 ways left to fill in the last. Hence, there are
30 · 29 · 28 = 24360 possible election results.
Example3: 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. 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.
In the second case, 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, will be 24・ 5! = 24 ・120 = 2880.

Definition: The number of ways to put n distinct items in order is n!


Example: How many ways are there to put 8 children in a line to get
ice cream?
Solution. Of course, the ordering of the children is important, especially to them! There
are 8 children from which to pick the child who is first. Then there are 7 children left
from which to pick the second child. Then there are 6 left, and so on. Therefore, there
are
8 · 7 · 6 · 5 · 4 · 3 · 2 · 1 = 8! = 40320

Exercise
1: Find , , , ,

2: In how many ways can we select 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?
3: 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?

4
Permutation with repetitions

The number of permutations of a multiset, that is, a set of objects some of which
are alike. We will let
, ,...,
Denote the number of permutations of n objects of which are alike, are alike, . . .,
are alike. The general formula follows:

Theorem: , ,..., , ,...,

Example. Find the number m of seven-letter words that can be formed using the letters
of the word “BENZENE.”

Solution: the number of permutations of 7 objects of which 3 are alike (the three E’s ,
and 2 are alike (the two N’s . By Theorem

,
,

Combination

Let S be a set with n elements. A combination of these n elements taken r at a time is any
selection of r of the elements where order does not count. Such a selection is called an
r-combination; it is simply a subset of S with r elements. The number of such
combinations will be denoted by , .
Before we give the general formula for C(n, r), we consider a special case.

Example: Find the number of combinations of 4 objects, A, B, C, D, taken 3 at a time.


Each combination of three objects determines 3! = 6 permutations of the objects as
follows:
ABC : ABC, ACB, BAC, BCA, CAB, CBA
ABD: ABD, ADB, BAD, BDA, DAB, DBA
ACD: ACD, ADC, CAD, CDA, DAC, DCA
BCD: BDC, BDC, CBD, CDB, DBC, DCB
Thus the number of combinations multiplied by 3! gives us the number of permutations;
that is,
, ・ , , , 3!
But , ・ ・ and 3! = 6; hence , as noted above. As
indicated above, any combination of n objects taken r at a time determines r!
Permutations of the objects in the combination; that is,
, ,
Accordingly, we obtain the following formula for , which we formally state as a
theorem.
,
Theorem: ,
Example 1: 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 m of choices that the farmer has.

5
Solution: The farmer can choose the cows in , ways, the pigs in , ways, and
the hens in , ways.
Thus the number m of choices follows:

・ ・

Example2: How many different committees of three students can be formed from a
group of four students?

Solution: here the order does not mater then by our formula
,

Exercise:
1. How many ways are there to select five players from a 10-member tennis team to
make a trip to a match at another school?
2. How many committees of five people can be chosen from 20 men and 12 women?
(a) if exactly three men must be on each committee ?
(b) if at least four women must be on each committee ?

The inclusion – exclusion principle


Let A and B be any finite sets. Then

n B n n B n B
In other words, to find the number n(A B) of elements in the union of A and B, we add
n(A) and n(B) and then we subtract n(A B) that is, we “include” n(A) and n(B), and
we “exclude” n(A B). This follows from the fact that, when we add n(A) and n(B), we
have counted the elements of (A B) twice. The above principle holds for any number
of sets. We first state it for three sets.

Theorem : For any finite sets A, B, C we have


n(A B C) = n(A) + n(B) + n(C) n(A B) n(A C) n(B C) + n(A B C)
That is, we “include” n(A), n(B), n(C), we “exclude” n(A B), n(A C), n(B C), and
finally “include”
n(A B C).

Example1: 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, 8 study all three languages.
15 study German and Russian,

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,

6
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

Namely, 100 students study at least one of the three languages.

Example2: How many students are there in a discrete math class if 15 students are
computer science majors, 7 are math majors, and 3 are double majors in math and
computer science?

Solution: Let A denote the subset of computer science majors in the class, and
B denote the math majors.
Then , . So by the principle of
Inclusion/exclusion there are 15 + 7 3 = 19 students in the class.

Example3: Consider the set


, , ,..., .

a) How many elements are there in A?


b) How many are divisible by 3?
c) How many are divisible by 5?
d) How many are divisible by 15?
e) How many are divisible by either 3, 5 or both?
f) How many are neither divisible by 3 nor 5?
g) How many are divisible by exactly one of 3 or 5?

Solution: Let be the set of those integers divisible by 3 and be the set of
those integers divisible by 5.
a) Notice that the elements are 2 = 2(1), 4 = 2(2), . . . , 114 = 2(57). Thus card (A) =
57.
b) There are = 19 integers in A divisible by 3. They are {6,12,18, . . . ,114}.
Notice that 114 = 6(19). Thus .
c) There are = 11 integers in A divisible by 5. They are {10,20,30, . . . ,110}.
Notice that 110 = 10(11). Thus card ( ) = 11
d, e, f, g (left as an exercise)

Binomial theorem

The binomial theorem gives the coefficients of the expansion of powers of binomial expressions.
A binomial expression is simply the sum of two terms, such as x + y. (The terms can be products
of constants and variables)

Theorem (binomial theorem): Let x and y be variables, and let n be a nonnegative


integer. Then

7
Example1: What is the expansion of ?

Solution: from the binomial theorem it follows that

= .

Example2: find the coefficient of in

Solution: =
=
=
=

Therefore the coefficient of is -32.

Exercise:
1. What is the expansion of a)
b)

2. Find the coefficient of in

COROLLARY 1 Let n be a nonnegative integer. Then

Proof: Using the binomial theorem with x = 1 and y = 1, we see that

This is the desired result.

8
COROLLARY 2 Let n be a positive integer. Then

Proof: When we use the binomial theorem with x = −1 and y = 1, we see that

Remark: Corollary 2 implies that

COROLLARY 3 Let n be a nonnegative integer. Then

Prove it.

Binomial Coefficients and Pascal’s Triangle

The numbers are called binomial coefficients, since they appear as the coefficients in
the expansion of .

THEOREM: (P SC L’S IDENTITY . Let n and k be positive integers with n ≥ k. Then

9
This triangle is known as Pascal’s triangle. Pascal’s identity shows that when two
adjacent binomial coefficients in this triangle are added, the binomial coefficient in the
next row between these two coefficients is produced.

10
Chapter two
Elementary probability theory
Sample space and events

The set S of all possible outcomes of a given experiment is called the sample space. A
particular outcome, i.e., an element in S, is called a sample point. An event A is a set of
outcomes or, in other words, a subset of the sample space S. In particular, the set {a}
consisting of a single sample point a ∈ S is called an elementary event.
Furthermore, the empty set and S itself are subsets of S and so and S are also events;
is sometimes called the impossible event or the null event. Since an event is a set, we
can combine events to form new events using the various set operations:
(i) A B is the event that occurs iff A occurs or B occurs (or both).
(ii) A B is the event that occurs iff A occurs and B occurs.
(iii) Ac, the complement of A is the event that occurs iff A does not occur.
Two events A and B are called mutually exclusive if they are disjoint, that is, if A B = .
In other words, A and B are mutually exclusive iff they cannot occur simultaneously.
Three or more events are mutually exclusive if every two of them are mutually
exclusive.

EXAMPLE
(a) Experiment: Toss a coin three times and observe the sequence of heads (H) and
tails (T ) that appears.
The sample space consists of the following eight elements:

S = {HHH,HHT,HTH,HTT ,T HH,THT,T T H,T T T }


Let A be the event that two or more heads appear consecutively, and B that all the tosses
are the same:
A = {HHH,HHT,THH } and B = {HHH,T T T }
Then A B = {HHH} is the elementary event that only heads appear. The event that five
heads appears is the empty set .

(b) Experiment: Toss a (six-sided) die, and observe the number (of dots) that appear on
top.
The sample space S consists of the six possible numbers, that is, S = {1, 2, 3, 4, 5, 6}.
Let A be the event that an even number appears,
B that an odd number appears, and
C that a prime number appears.
That is, let
A = {2, 4, 6}, B= {1, 3, 5}, C= {2, 3, 5}
Then
A C = {2, 3, 4, 5, 6} is the event that an even or a prime number occurs.
B C = {3, 5} is the event that an odd prime number occurs.
= {1, 4, 6} is the event that a prime number does not occur.
Note that A and B are mutually exclusive: A B = . In other words, an even number
and an odd number cannot occur simultaneously.

11
Example2: Toss a pair of dice and record the two numbers on the top.
There are six possible numbers, 1, 2, . . . , 6, on each die. Thus S consists of the pairs of
numbers from 1 to 6, and hence n(S) = 36. Figure below shows these 36 pairs of
numbers arranged in an array where the rows are labelled by the first die and the
columns by the second die.
Let be the event that the sum of the two numbers is 6, and
Let B be the event that the largest of the two numbers is 4. That is,

, , , , , , , , , ,
, , , , , , , , , , , , ,

Then the event “A and B” consists of those pairs of integers whose sum is and whose
largest number is 4 or, in other words, the intersection of A and B. Thus
, , ,
Similarly, “A or B,” the sum is or the largest is , shaded in Fig(b). is the union .

Probability of an event

DEFINITION: Let S be a finite sample space. The outcomes in S are said to be equally
likely if , ∈ , . , ∈ ,
DEFINITION: If the outcomes in a finite sample space S are all equally likely, then the
probability of an event E is given by

Example1: If two fair coins are tossed, then what is the probability of getting exactly one
head?

Solution: the sample space of possible outcomes is given by the set of ordered pairs
S = {TT, TH, HT, HH}.

12
Since the coins are assumed to be fair, each of the outcomes in S is equally likely. The
event of getting exactly one head is given by
E = {TH, HT}.

Hence,

is the desired probability.

Theorem: The probability function P defined on the class of all events in a finite
probability space has the following properties:
For every event , ≤ ≤ .
.
If events A and B are mutually exclusive, then .

Theorem: Let A be any event. Then .

If p is the probability that an event E occurs, then s the probability that E does
not occur.
(That is, if we hit a target of the times, then we miss the target of the
times.)
Theorem (Addition Principle): For any events A and B,

EXAMPLE 1. Suppose a student is selected at random from 100 students where 30 are
taking mathematics, 20 are taking chemistry, and 10 are taking mathematics and
chemistry. Find the probability p that the student is taking mathematics or chemistry.
Let M = {students taking mathematics} and C = {students taking chemistry}. Since the
space is equiprobable,

Thus, by the Addition Principle (above Theorem)

13
Conditional probability

DEFINITION: Let E and F be events with . The conditional probability of E


given F, denoted by , is defined as

EXAMPLE: What is the conditional probability that a family with two children has two
boys, given they have at least one boy? Assume that each of the possibilities BB, BG, GB,
and GG is equally likely, where B represents a boy and G represents a girl. (Note that BG
represents a family with an older boy and a younger girl while GB represents a family
with an older girl and a younger boy.)

Solution: Let E be the event that a family with two children has two boys, and let F be
the event that a family with two children has at least one boy. It follows that
E = {BB},
F = {BB, BG, GB}, and
E F = {BB}. Because the four possibilities are equally likely, it follows that
.We conclude that

Example2; A pair of fair dice is tossed. The sample space S consists of the 36 ordered
pairs (a, b), where a and b can be any of the integers from 1 to 6.Thus the probability of
any point is 1 36. Find the probability that one of the dice is 2 if the sum is 6. That is,
find P(A\E) where:

E = {sum is 6} and A = {2 appears on at least one die}

Now E consists of 5 elements and A E consists of two elements; namely

, , , , , , , , , , , ,

On the other hand A itself consists of 11 elements, that is,

A = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (1, 2), (3, 2), (4, 2), (5, 2), (6, 2)}
Since S consists of 36 elements,
P(A) = 11/36.
Exercises
1) A couple has two children; the sample space is S = {bb, bg, gb, gg} with probability ¼
for each point. Find the probability p that both children are boys if it is known that:
(i) at least one of the children is a boy; (ii) the older child is a boy.

14
2) At a company picnic, the children played a soccer game, after which one player’s
name was randomly drawn to win a prize. The winning team in the soccer game
consists of 7 girls and 4 boys, and the losing team consists of 5 girls and 6 boys. Given
that the prize winner is a boy, what is the probability that he also comes from the
winning soccer team?

Independent events
DEFINITION. Two events E and F in a sample space S are said to be independent if

If E and F are independent events and P(E | F ) is defined, then P(E | F ) = P(E), In this
case, knowing that event F has occurred does not affect the likelihood of event E
occurring.

Example; Assume, that each of the four ways a family can have two children is equally
likely. Are the events E, that a family with two children has two boys, and F, that a family
with two children has at least one boy, independent?

Solution: Because E = {BB}, we have p(E) = 1/4. And F={BB,BG,GB} we have p(F) = 3/4
and that p(E F) = 1/4.
But p(E)p(F) =
Therefore p(E F) p(E)p(F),
so the events E and F are not independent.

Exercise
1. Are the events E, that a family with three children has children of both sexes, and F,
that this family has at most one boy, independent? Assume that the eight ways a
family can have three children are equally likely.
2. Consider the experiment of tossing two dice in sequence. Let E be the event that the
first die shows a value of at most 3, let F be the event that the values on the two dice
are the same, and let G be the event that the sum of the values on the two dice is 5.
A) Are E and F independent?
B) Are E and G independent?

INDEPENDENT REPEATED TRIALS, BINOMIAL DISTRIBUTION

Definition 7.3: Let S be a finite probability space. By the space of n independent repeated
trials, we mean the probability space Sn consisting of ordered n-tuples of elements of S,
with the probability of an n-tuple defined to be the product of the probabilities of its
components:
, ,..., ...

EXAMPLE .Whenever three horses a, b, and c race together, their respective


probabilities of winning are1/2, 1/3, and 1/6. In other words, S = {a, b, c} with

15
P(a) = 1/2, P(b) = 1/3, and P(c) = 1/6. If the horses race twice, then the sample space
of the two repeated trials is
S2 = {aa, ab, ac, ba, bb, bc, ca, cb, cc}
For notational convenience, we have written ac for the ordered pair (a, c). The
probability of each point in S2 is
P aa P a P a , P ba , P ca
P ab P a P b , P bb , P cb
P ac P a P c , P bc , P cc
Thus the probability of c winning the first race and a winning the second race is
P(ca) = 1/12 .

Repeated Trials with Two Outcomes, Bernoulli Trials, Binomial Experiment

Now consider an experiment with only two outcomes. Independent repeated trials of
such an experiment are called Bernoulli trials. The term independent trials mean that
the outcome of any trial does not depend on the previous outcomes (such as tossing a
coin). We will call one of the outcomes success and the other outcome failure.

Let p denote the probability of success in a Bernoulli trial, and so q = 1 p is the


probability of failure.
A binomial experiment consists of a fixed number of Bernoulli trials. A binomial
experiment with n trials and probability p of success will be denoted by B(n, p)

Theorem: The probability of exactly k successes in a binomial experiment B(n, p) is


given by

P(k) = P(k successes) =

The probability of one or more successes is 1 qn.

Example. A fair coin is tossed 6 times; call heads a success. This is a binomial
experiment with n = 6 and p = q = 12
.
(a) The probability that exactly two heads occurs (i.e., k = 2) is

b) The probability of getting at least four heads (i.e., k = 4, 5 or 6) is

16
Random variables and expectation
Definition: A random variable X is a rule that assigns a numerical value to each outcome
in a sample space S.
We shall let RX denote the set of numbers assigned by a random variable X, and we shall
refer to RX as the range space.

EXAMPLE .A pair of fair dice is tossed. The sample space S consists of the 36 ordered
pairs (a, b) where a and b can be any of the integers from 1 to 6.

Let X assign to each point in S the sum of the numbers; then X is a random variable with
range space
RX = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}

Let Y assign to each point the maximum of the two numbers; then Y is a random
variable with range space
RY = {1, 2, 3, 4, 5, 6}

Probability Distribution of a Random Variable

Let X be a random variable on a finite sample space S with range space


, ,..., . Then X induces a function f which assigns probabilities to the
points as follows:
f ( ) = pk = P(X = ) = sum of probabilities of points in S whose image is

The set of ordered pairs (x1, f (x1)), (x2, f (x2)), . . . , (xt, f (xt )) is called the distribution of
the random variable X. This function f has the following two properties:

Theorem: Let S be an equiprobable space, and let f be the distribution of a random


variable X on S with the range space RX= {x1, x2, . . . , xt}. Then

17
Expectation of a Random Variable

Let X be a random variable on a probability space S = {s1, s2, . . . , sm } Then the mean or
expectation of X is denoted and defined by:

EXAMPLE. Let X be the random variable which assigns the sum to the toss of a pair of
dice. Note n(S) = 36, and Rx = {2, 3, . . . , 12}. Using Theorem, we obtain the distribution
f of X as follows:

And find the expectation

Exercise; suppose a fair coin is tossed six times. The number of heads which can occur
then find the distribution and expectation

18
Chapter three

Recurrence relations
We begin with some examples.
Example. 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:

, ≥ , ≥
th
Clearly, the formula gives us the n term of the sequence without calculating any
previous term.

The following remarks about the above example are in order.


(1) The equation or, equivalently, ak+1 = 2ak, 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 .
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

LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS

A recurrence relation of order k is a function of the form


, ,..., ,
that is, where the nth term an of a sequence is a function of the preceding k terms an 1,
an 2, . . . , an k (and possibly n). In particular, a linear kth-order recurrence relation with
constant coefficients is a recurrence relation of the form

an = C1an 1 + C2an 2 +・ ・ ・+Ck an k + f (n)

Where C1,C2, . . . , Ck are constants with Ck = 0, and f (n) is a function of n. The meanings
of the names linear and constant coefficients follow:
Linear: There are no powers or products of the aj ’s.
Constant coefficients: The C1C2, . . . ,Ck are constants (do not depend on n).

19
If f (n) = 0, then the relation is also said to be homogeneous.

Example. Consider each of the following recurrence relations.

(a) an= 5an-1 4an 2 + n2

This is a second-order recurrence relation with constant coefficients. It is


nonhomogeneous because of the n2. Suppose we are given the initial conditions a1 = 1,
a2 = 2. Then we can find sequentially the next few elements of the sequence:
a3 = 5(2) 4(1) + 32 = 15, a4 = 5(15) 4(2) + 42 = 83

(b) an = 2an 1 an 2 + n2
The product an 1an 2 means the recurrence relation is not linear. Given initial
conditions a1 = 1, a2 = 2, we can still find the next few elements of the sequence:
a3 = 2(2)(1) + 32 = 13, a4 = 2(13)(2) + 42 = 68
(c) an = nan 1 + 3an 2
This is a homogeneous linear second-order recurrence relation but it does not have
constant coefficients because the coefficient of an 1 is n, not a constant. Given initial
conditions a1 = 1, a2 = 2, the next few elements of the sequence follow:
a3 = 3(2) + 3(1) = 9, a4 = 4(9) + 3(2) = 42
(d) an = 2an 1 + 5an 2 – 6 an 3
This is a homogeneous linear third-order recurrence relation with constant coefficients.
Thus we need three, not two, initial conditions to yield a unique solution of the
recurrence relation. Suppose we are given the initial conditions a1 = 1, a2 = 2, a3 = 1.
Then, the next few elements of the sequence follow:
a4 = 2(1) + 5(2) 6(1) = 6, a5 = 2(2) + 5(1) 6(6) 37
a6 = 2(1) + 5(6) 6( 37) = 254

SOLVING SECOND-ORDER HOMOGENEOUS LINEAR RECURRENCE RELATIONS


Consider a homogeneous second-order recurrence relation with constant coefficients
which has the form

a = sa +ta or a sa ta =0

where s and t are constants with t _= 0.We associate the following quadratic polynomial
with the above recurrence relation:

x x sx t

This polynomial is called the characteristic polynomial of the recurrence relation,


and the roots of are called its characteristic roots.

Theorem: Suppose the characteristic polynomial of the recurrence


relation
=s +t
has distinct roots and . Then the general solution of the recurrence relation follows,
where and are arbitrary constants:

20
We emphasize that the constants and may be uniquely computed using initial
conditions.

Example; Consider the following homogeneous recurrence relation:

=2 +3

The general solution is obtained by first finding its characteristic polynomial and
its roots r1 and r2:

= x2 2x 3 = (x – 3)(x + 1); roots r1 = 3, r2 1

Since the roots are distinct, we can use Theorem to obtain the general solution:

Thus any values for c1 and c2 will give a solution to the recurrence relation.

Suppose we are also given the initial conditions a0 = 1, a1 = 2. Using the recurrence
relation we can compute the next few terms of the sequence:

1, 2, 8, 28, 100, 356, 1268, 3516, . . .

The unique solution is obtained by finding c1 and c2 using the initial conditions.
Specifically:

For n = 0 and a0 = 1, we get: c130 + c2 ( 1)0 =1 or c1 + c2 = 1


For n = 1 and a1 = 2, we get: c131 + c2 ( 1)1 =2 or 3 c1 c2 = 2
Solving the system of the two equations in the unknown’s c1 and c2 yields:
c1 = ¾ and c2 = ¼

Thus the following is the unique solution of the given recurrence relation with the given
initial conditions a0 = 1, a1 = 2:

Solution when Roots of the Characteristic Polynomial are Equal

Suppose the roots of the characteristic polynomial are not distinct. Then we have the
following result.
Theorem: Suppose the characteristic polynomial of the recurrence
relation
=s +t

21
has only one root r0. Then the general solution of the recurrence relation follows, where
c1 and c2 are arbitrary constants:

The constants c1 and c2 may be uniquely computed using initial conditions.

Example; Consider the following homogeneous recurrence relation:

=6 9

The characteristic polynomial follows:


= x2 – 6x + 9 = (x – 3)2
Thus has only the one root r0 = 3. Now we use Theorem to obtain the following
general solution of the recurrence relation:

Thus any values for c1and c2 will give a solution to the recurrence relation.
Suppose we are also given the initial conditions a1 = 3, a2 = 27. Using the recurrence
relation we can
compute the next few terms of the sequence:

3, 27, 135, 567, 2187, 8109, . . .

The unique solution is obtained by finding c1 and c2 using the initial conditions.
Specifically:

For n = 1 and a1 = 3, we get: c131 + c2 (1) (3)1 =3 or 3c1 + 3 c2 = 3


For n = 2 and a2 = 27, we get: c132 + c2 (2) (3)2 = 27 or 9 c1 + 18 c2 = 27

Solving the system of the two equations in the unknown’s c1 and c2 yields:

c1 1 and c2 = 2

Thus the following is the unique solution of the recurrence relation with the given initial
conditions:

SOLVING GENERAL HOMOGENEOUS LINEAR RECURRENCE RELATIONS

Consider now a general linear homogeneous kth - order recurrence relation with
constant coefficients which has the form

= c1 + c2 c3 +...+ck = ci (*)

22
Where C1, C2, . . . , Ck are constants with Ck 0. The characteristic polynomial _(x) of the
recurrence relation follows:

= C1 C2 C3 ・ ・ ・ Ck ci

The roots of are called the characteristic roots of the recurrence relation.
The following remarks are in order.

Remark 1: If p(n)and q(n) are solutions of (*), then any linear combination

of p(n) and q(n) is also a solution. (This is not true if the recurrence relation is non
homogeneous.)

Remark 2: If r is a root of multiplicity m of the characteristic polynomial of (*) then


each of the following
rn, nrn, n2rn, . . . , nn 1rn

is a solution of(*) . Thus any linear combination

c1rn + c2nrn + c3n2rn +・ ・ ・+cmnm 1rn = (c1 + c2n + c3n2 +・ ・ ・+cmnm 1)rn

is also a solution.

Example; Consider the following third-order homogeneous recurrence relation:

= 11 39 45

The characteristic polynomial of the recurrence relation follows:

= 11 + 39x 45 = (x – 3)2(x – 5)

Thus has two roots, r1 = 3 of multiplicity 2 and r2 = 5 of multiplicity 1. Thus, by


the above remarks, the following is the general solution of the recurrence relation:

= c1( ) + c2n( ) + c3( ) = (c1 + c2n)( ) + c3( )

Thus any values for c1, c2, c3 will give a solution to the recurrence relation.
Suppose we are also given the initial conditions a0 = 5, a1 = 11, a3 = 25. Using the
recurrence relation we can compute the next few terms of the sequence:

5, 11, 25, 71, 301, 1667, . . .

The unique solution is obtained by finding c1, c2 & c3 using the initial conditions.
Specifically:

23
For n = 0 and a0 = 5, we get: c1 + c3 = 5
For n = 1 and a2 = 11, we get: 3 c1 + 3 c2 + 5 c3 = 11
For n = 2 and a3 = 25, we get: 9 c1 + 18 c2 + 25 c3 = 25

Solving the system of the three equations in the unknown’s c1, c2 & c3 yields:

c1= 4, c2 2, c3 = 1

Thus the following is the unique solution of the recurrence relation with the given initial
conditions:

= (4 2n)( )+

Exercise; consider the following homogenous recurrence relations

1) = 2 with initial conditions a0 = 2, a1 = 7,

2) =6 12 8 with initial conditions a0 = 3, a1 = 4, a2 = 12.


3) = 3 with initial conditions a0 = 1, a1 = – 2 and a2 = – 1.

Then
a) Find the next three terms of the sequence.
b) Find the general solution.
c) Find the unique solution with the given initial conditions.

Linear Non homogeneous Recurrence Relations with Constant Coefficients

A recurrence relation of the form

= c1 + c2 c3 +...+ck + F(n),

where c1, c2, . . . , ck are real numbers and F(n) is a function not identically zero
depending only on n. The recurrence relation

= c1 + c2 c3 +...+ck

is called the associated homogeneous recurrence relation. It plays an important role in


the solution of the non homogeneous recurrence relation.

24
THEOREM
If is a particular solution of the non homogeneous linear recurrence relation
with constant coefficients

= c1 + c2 c3 +...+ck + F(n),,

Then every solution is of the form

Where is a solution of the associated homogeneous recurrence relation

= c1 + c2 c3 +...+ck + F(n),

THEOREM. Suppose that {an} satisfies the linear non homogeneous recurrence relation

= c1 + c2 c3 +...+ck + F(n)

where c1, c2, . . . , ck are real numbers, and

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

When s is a root of this characteristic equation and its multiplicity is m, there is a


particular solution of the form

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 ensures that the
proposed particular solution will not already be a solution of the associated linear
homogeneous recurrence relation.

There are four steps in the process as listed below:

Step 1: Find the homogeneous solution to the homogeneous equation. This results when
you set the R.H.S. to zero. If it is already zero, skip the next two steps and go directly to
the step 4. Your answer will contain one or more undetermined coefficients whose
values cannot be determined until step 4.
Step 2: Find the particular solution by guessing a form similar to the R.H.S. This step
does not produce any additional undetermined coefficients, nor does it eliminate those
from step 1.
Step 3: Combine the homogeneous and particular solution.

25
Step 4: Use boundary or initial conditions to eliminate the undetermined constants from
the step 1.
We shall now discuss the way to find a particular solution : The form of a particular
solution has nothing to do with the order of the recurrence relation. It only depends on
the form of the R.H.S. of recurrence equation expressed in standard form. Guess a
solution of the same form but with undetermined coefficients, which have to be
calculated. We find their values by substituting the guessed particular solution into the
recurrence equation. You may find the following table useful for guessing a particular
solution:

Example; Find all solutions of the recurrence relation

= 6
Solution: This is a linear non homogeneous recurrence relation. The solutions of its
associated homogeneous recurrence relation

= 6

are where and are constants.

Because F(n) = , a reasonable trial solution is

. where C is a constant.

Substituting the terms of this sequence into the recurrence relation implies that

C· = 5C · 6C · + .

Factoring out , this equation becomes

49C = 35C 6C + 49, which implies that

20C = 49, or that C = 49/20.


Hence,
is a particular solution.

All solutions are of the form

26
Example2. Solve the recurrence equation

10 with initial condition = 0 and

Solution. The homogeneous part of the equation

10 ...(1)

is 10 =0 ...(2)

The characteristic equation of (2) is given by

⇒ (x – 2)(x – 5) = 0
⇒ x = 2 and x = 5

Since the two roots 2 and 5 of characteristic equation are distinct, the homogeneous
solution is given by

...(3)

Now, particular solution is given by

Substituting the value of in equation (1), we get

n n 10 n
or, A[4n – 7(n – 1) 2 + 10(n– 2)] =
or, C[4n – 14(n – 1) + 10n – 20] = 4
or, C[4n – 14n + 14 + 10n – 20] = 4
or, – 6C = 4 ⇒ C =

Particular solution is = .
The complete, also called total, solution is obtained by combining the homogeneous and
particular solutions. This is given as

...(4)

The equation (4) contains two undetermined coefficients and , which are to be
determined.
To find this, we use the given initial conditions for n = 0 and n = 1
.
Since values of and are given.

Putting n= 0 and n = 1 in equation (4), we get

27
And

Replacing and in equation (4) by its respective values, we get the closed form
formula for the given recurrence equation. Thus,

Exercise1) What is the general formula for the following recurrence relation

= 6 with initial conditions

2) What is the general formula for the following recurrence relation?

= 12
If
a)
b)
c)

28
Chapter four
Elements of Graph Theory

Definition
A graph G consists of two finite sets: a nonempty set V(G) of vertices and a set E(G) of
edges, where each edge is associated with a set consisting of either one or two vertices
called its endpoints. The correspondence from edges to endpoints is called the edge-
endpoint function.

An edge with just one endpoint is called a loop, and two or more distinct edges with the
same set of endpoints are said to be parallel. An edge is said to connect its endpoints;
two vertices that are connected by an edge are called adjacent; and a vertex that is an
endpoint of a loop is said to be adjacent to itself.
An edge is said to be incident on each of its endpoints, and two edges incident on the
same endpoint are called adjacent. A vertex on which no edges are incident is called
isolated.

A simple graph is a graph G = (V, E) that has no loops and no multiple edges.

Graphs have pictorial representations in which the vertices are represented by dots and
the edges by line segments.
Example; Consider the following graph:

a) Write the vertex set and the edge set, and give a table showing the edge-endpoint
function.
b) Find all edges that are incident on v1, all vertices that are adjacent to v1, all edges
that are adjacent to e1, all loops, all parallel edges, all vertices that are adjacent to
themselves, and all isolated vertices.

Solution
a) vertex set = {v1, v2, v3, v4, v5, v6}
edge set = {e1, e2, e3, e4, e5, e6, e7}
edge-end point function:

29
b) e1, e2, and e3 are incident on v1.
v2 and v3 are adjacent to v1.
e2, e3, and e4 are adjacent to e1.
e6 and e7 are loops.
e2 and e3 are parallel.
v5 and v6 are adjacent to themselves.
v4 is an isolated vertex.

Degree of a vertex

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. Find the degree of each vertices on the graph below

Solution
Deg(a)=4 Deg(b)=6 Deg(c)=1 Deg(d)=5 Deg(e)=6

THEOREM.THE HANDSHAKING THEOREM Let G = (V ,E) be an undirected graph with E


edges. Then
deg

(Note that this applies even if multiple edges and loops are present.)

Example1. 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 E is the number of edges. Therefore, E = 30.

30
Example2. 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
theorem

deg

Now, given 2 vertices are of degree 4 and 4 vertices are of degree 2.


Hence the above equation,
(4 + 4) + (2 + 2 + 2 + 2) = 2e
16 = 2e e = 8.
Hence the number of edges in a graph with 6 vertices with given condition is 8.
Two such graphs are shown below.

Example3. How many vertices are needed to construct a graph with 6 edges in which
each vertex is of degree 2.

Solution. Suppose these are P vertices in the graph with 6 degree. Also given the degree
of each vertex is 2.
By handshaking theorem,
deg

⇒ d(v1) + d(v2) + ...... + d(vn) = 12


⇒ 2 + 2 + ...... + 2 = 12
⇒ 2P = 12
⇒ P = 6 vertices are needed.
Exersics
How many edges are needed to construct a graph with 12 vertices such that 2 of the
vertices have degree 3 and the remaining vertices have degree 4. And draw such a
graph.

Matrix representation of a graph

Two types of matrices commonly used to represent graphs. One is based on the adjacency of vertices, and
the other is based on incidence of vertices and edges.

31
Adjacency Matrices
Suppose that G = (V ,E) is a simple graph where |V| = n. The adjacency matrix with A= [ ], is
then given by
, , .
,

Example. Use an adjacency matrix to represent the graph shown below

Here the adjacency matrix is

Incidence Matrices
Another common way to represent graphs is to use incidence matrices. 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 M = [ ], where
, when edge is incident with .
,

Example. Use an incidence matrix to represent the graph shown below

Exercise. Use an adjacency and incidence matrix to represent the graph shown below

a) b)

32
Isomorphism of Graphs

Let G1 = (v1, E1) and G2 = (v2, E2) be two graphs. A function is called a
graphs isomorphism if

(i) f is one-to-one and onto.


(ii) for all , ∈ , , ∈ if and only , ∈ when such a function
exists, G1 and G2 are called isomorphic graphs and is written as G1 ≅ G2.

In other words, two graphs G1 and G2 are said to be isomorphic to each other if there is
a oneto one correspondence between their vertices and between edges such that
incidence relationship is preserve. Written as ≅ .

The necessary conditions for two graphs to be isomorphic are


1. Both must have the same number of vertices
2. Both must have the same number of edges
3. Both must have equal number of vertices with the same degree.
4. They must have the same degree sequence and same cycle vector (c1, ......, cn), where ci
is the number of cycles of length i.

Example. Show that the following graphs are isomorphic

Solution. Let f : G G′ be any function defined between two graphs degrees of the graph
G and G′ are as follows :
deg (G) deg (G′)
deg (a) = 3 deg (a′) = 3
deg (b) = 2 deg (b′) = 2
deg (c) = 3 deg (c′) = 3
deg (d) = 3 deg (d′) = 3
deg (e) = 1 deg (e′) = 1

Each has 5-vertices and 6-edges.


d(a) = d(a′) = 3
d(b) = d(b′) = 2
d(c) = d(c′) = 3
d(d) = d(d′) = 3
d(e) = d(e′) = 1
Hence the correspondence is a – a′, b – b′, ....., e – e′.
Therefore, the given two graphs are isomorphic.

33
Exr. Show that the following graphs are isomorphic
.
1)

2)

Path and connectivity of a graph

DEFINITION
(a) A walk in a graph G = (V, E) is an alternating list of vertices and edges
v0, e1, v1, e2, v2, e3, . . . , v n 1, en, vn with n ≥ 0 that starts at vertex v0, ends at vertex vn,
(b) A circuit is a walk of positive length that starts and ends at the same vertex.
(c) A trail is a walk with no repeated edges. In a graph with multiple edges, distinct
multiple edges may be included.
(d) A path is a walk with no repeated vertices.
(e) A cycle is a circuit in which the only vertex repetition is vn = v0.

(f) The distance between two vertices u and v in G, denoted distG(u, v), is the length of
the shortest walk in G between u and v. If there is no walk, then we assign distG(u, v)
∞. When G is clear in context, the subscripts may be dropped.

Example. Given the pictured graph G = (V, E)

34
(a) 1, b, 2, e, 5, h, 5, e, 2, d, 4 is a walk of length 5 that starts at 1 and ends at 4.
(b) 1, b, 2, e, 5, h, 5, g, 4, d, 2, a, 1 is a circuit of length 6 that starts and ends at 1.
(c) 2, a, 1, b, 2, e, 5, h, 5 is a trail of length 4 that starts at 2 and ends at 5.
(d) 2, b, 1, c, 3, f, 4 is a path of length 3 that starts at 2 and ends at 4.
(e) 2, b, 1, c, 3, f, 4, d, 2 is a cycle of length 4 that starts and ends at 2.
(f) dist(2, 4) = 1, dist(3, 5) = 2, and dist(5, 5) = 0.

DEFINITION
(a) A graph G is connected if, for any two vertices, there is a path between them.
Otherwise, G is disconnected.

(b) A component of a graph G is a connected subgraph H that is not contained in any


other connected subgraph of G; two vertices are in the same component if and only if
there is a path between them.

Example. The graph in (a) is connected and therefore have a single component. The
graph in (b) is disconnected and has two Components.

(a) (b)

One is induced by {1, 2, 4, 5, 6}, and the other is induced by {3, 7}.

Eulerian and Hamiltonian graphs

Eulerian graphs

DEFINITION
Let G be a graph or a digraph. An Euler circuit (respectively, Euler trail) in G is a
circuit (respectively, trail) that covers every edge exactly once and covers every
vertex. Of course, unless G has isolated vertices, covering every edge will imply
that every vertex is covered. If G contains an Euler circuit, then G is said to be
Eulerian.

Theorem. Euler’s Theorem


Given any graph G,
(a) G has an Euler circuit if and only if G is connected and every vertex of G has even
degree.
(b) G has an Euler trail that is not an Euler circuit if and only if G is connected and has
exactly two vertices with odd degree.

35
Example. Check the graph is eulerian or not

Since the pictured graph G is connected and every vertex has even degree,
Euler’s Theorem guarantees an Euler circuit for G. In fact, the Euler circuit can
be found as follows.
a, i, j, k, b, c, d, e, f, l, m, n, g, h

Exercise. Check whether the given graphs are eulerian or not if it is find the eulerian
circuit.
(a)

(c)
(b)

Hamiltonian graph

DEFINITION
Let G be a graph. A Hamiltonian cycle (respectively, Hamiltonian path) in G is a cycle
(respectively, path) that covers every vertex. By definition, each vertex must be covered
exactly once, with the exception that the starting and ending vertex of a Hamiltonian
cycle is covered twice. If G contains a Hamiltonian cycle, then G is said to be
Hamiltonian.

Although no useful necessary and sufficient conditions for the existence of Hamilton
circuits are known, quite a few sufficient conditions have been found.

Having seen ways to show that a Hamiltonian cycle does not exist, we ought to consider
conditions sufficient to guarantee that one does. There is a bound on the minimum
degree δ(G) of a graph G that implies Hamiltonicity.

36
THEOREM. If G is a simple graph with n vertices with n ≥ 3 such that the degree of every
vertex in G is at least n/2, then G has a Hamilton circuit.

THEOREM. If G is a simple graph with n vertices with n ≥ 3 such that deg(u) + deg(v) ≥
n for every pair of nonadjacent vertices u and v in G, then G has a Hamilton circuit.

Both theorems provide sufficient conditions for a connected simple graph to have a
Hamilton circuit. However, these theorems do not provide necessary conditions for the
existence of a Hamilton circuit. For example, the graph C5 has a Hamilton circuit but
does not satisfy the hypotheses of either of the theorems.

Example. It follows from above Theorem that the pictured graph G = (V, E) is
Hamiltonian, since δ(G) = 4 = .

Of course, it is not hard in this case to find a Hamiltonian cycle, such as

A, B, C, D, H, G, E, F, A.

Exercise. Find and shade a Hamiltonian cycle for the following graphs

Complete, regular and bipartite graphs

Complete Graphs
A graph G is said to be complete if every vertex in G is connected to every other vertex
in G. Thus a complete graph G must be connected. The complete graph with n vertices is
denoted by Figure below shows the graphs K1 through K6.

37
Regular Graphs
A graph G is regular of degree k or k-regular if every vertex has degree k. In other
words, a graph is regular if every vertex has the same degree.

We note that the complete graph with n vertices Kn is regular of degree n 1.


Example.

Bipartite graphs

A graph G = (V, E) is bipartite if the vertex set V can be partitioned into two subsets
(disjoint) V1 and V2 such that every edge in E connects a vertex in V1 and a vertex V2
(so that no edge in G connects either two vertices in V1 or two vertices in V2). (V1, V2)
is called a bipartition of G. Obviously; a bipartite graph can have no loop.

38
Examples of bipartite graphs.

Complete bipartite graph

The complete bipartite graph on m and n vertices, denoted Km, n is the graph, whose
vertex set is partitioned into sets V1 with m vertices and V2 with n vertices in which
there is an edge between each pair of vertices V1 and V6. Where V1 is in V1 and V2 is in
V2. The complete bipartite graphs K2, 3, K3, 3, K3, 5 and K2, 6 are shown in Figure below.
Note that Kr, s has r + s vertices and rs edges.

Definition. a graph which contains a triangle cannot be bipartite.

39
Exercise1. Determine whether or not each of the graphs is bipartite. In each case, give
the bipartition sets or explain why the graph is not bipartite.

1. 2.

2 . Show that C6 is a bipartite graph.

Planar graphs

A graph G is said to be planar if there exists some geometric representation of G which


can be drawn on a plane such that no two of its edges intersect. The points of
intersection are called crossovers.
A graph that cannot be drawn on a plane without a crossover between its edges
crossing is called a plane graph.
Examples of planar graphs

Example

The closed electric circuit on the left-hand side of Figure (a) contains a battery and
some resistors . An intersection of wires not marked by a node • is a wire crossing,
which we would like to avoid. On the right-hand side of Figure (a) is a graph that
models this circuit, with edges representing wires. Since that graph can alternatively be
drawn with no edge crossings, as shown on the right-hand side of Figure (b), the circuit
can similarly be constructed without wire crossings, as shown on the left-hand side of
Figure (b).

Fig(a) an electric circuit with wire crossing

40
Fig(b) an electric circuit without wire crossing

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.

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 build 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.

THEOREM. EULER’S FORMUL 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

Example. 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, or e = . Conse uently, from Euler’s formula, the number of regions is

COROLLARY1. If G is a connected planar simple graph with e edges and v vertices, where
≥ , then
≤ .

COROLLARY 2 If a connected planar simple graph has e edges and v vertices with ≥
and no circuits of length three (i.e bipartite), then

≤ .

41
Example.
1. Show that K5 is non planar graph

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 = 9. Therefore, K5 is not planar.

2. Show that , is planar or not.

Solution.The graph K2,3 has five vertices and 6 edges. However, the inequality e ≤ 2v 4
is satisfied for this graph
Hence e ≤ 2v – 4 gives 6 ≤ . Therefore, K2,3 is planar.
Draw graphs for K5 and K2,3

Graph coloring
Definition1. A coloring of a simple graph is the assignment of a color to each vertex of
the graph so that no two adjacent vertices are assigned the same color.

Definition2. 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. What are the chromatic numbers of the graphs G.

Solution. The chromatic number of G is at least three, because the vertices a, b, and c must
be assigned different colors. Adjacent vertices cannot use the same color .

42
Example. (Accommodating Scheduling Conflicts). a graph G

was used to reflect scheduling conflicts among classes in Astronomy, Biology, Calculus,
Discrete Math, English Composition, and French, each needing to schedule a study
session. That is, in G an edge joins two vertices precisely when the two corresponding
class groups cannot meet simultaneously. We can now see how this graph can be used
to obtain a schedule that accommodates all of the study sessions in a minimum number
of time periods.
Solution. An allowable schedule corresponds to a coloring of the vertices of
G with time periods numbered 1, 2, . . . For example, the coloring

Corrosponds to the schedule

Exercise. Find the chromatic number of the following graphs

Trees and forests


DEFINITION. A tree is a connected undirected graph with no simple circuits.
Because a tree cannot have a simple circuit, a tree cannot contain multiple edges or
loops. Therefore any tree must be a simple graph.

Graphs containing no simple circuits that are not necessarily connected, these graphs
are called forests and have the property that each of their connected components is a
tree.

43
Example.

Example of forest

THEOREM. An undirected graph is a tree if and only if there is a unique simple path
between any two of its vertices.

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 level of a vertex is the number of edges along the unique path between it and the
root.
The height of a rooted tree is the maximum level of any vertex of the tree.
Given the root or any internal vertex v of a rooted tree, the children of v are all those
vertices that are adjacent to v and are one level farther away from the root than v.
If w is a child of v, then v is called the parent of w, and two distinct vertices that are
both children of the same parent are called siblings. Given two distinct vertices v and w,
if v lies on the unique path between w and the root, then v is an ancestor of w and w is a
descendant of v.

The terms are illustrated below

44
Example. Rooted Trees
Consider the tree with root v0 shown below.
a. What is the level of v5? b. What is the level of v0?
c. What is the height of this rooted tree? d. What are the children of v3?
e. What is the parent of v2? f. What are the siblings of v8?
g. What are the descendants of v3?

Definition. A binary tree is a rooted tree in which every parent has at most two children.
Each child in a binary tree is designated either a left child or a right child (but not both).

Spanning trees

Definition. A spanning tree for a graph G is a subgraph of G that contains every vertex of
G and is a tree.
Proposition
1. Every connected graph has a spanning tree.
2. Any two spanning trees for a graph have the same number of edges.

Example. Find all spanning trees for the graph G pictured below.

Solution The graph G has one circuit v2v1v4v2, and removal of any edge of the circuit
gives a tree. Thus, as shown below, there are three spanning trees for G.

Minimum spanning trees

DEFINITION. A minimum spanning tree in a connected weighted graph is a spanning


tree that has the smallest possible sum of weights of its edges.

45
Algorithms for Minimum Spanning Trees
A wide variety of problems are solved by finding a spanning tree in a weighted graph
such that the sum of the weights of the edges in the tree is a minimum.

LGORITHM Prim’s lgorithm.


procedure Prim(G: weighted connected undirected graph with n vertices)
T := a minimum-weight edge
for i := 1 to n 2
e := an edge of minimum weight incident to a vertex in T and not forming a
simple circuit in T if added to T
T := T with e added
return T {T is a minimum spanning tree of G}

LGORITHM ruskal’s lgorithm.


procedure Kruskal(G: weighted connected undirected graph with n vertices)
T := empty graph
for i := 1 to n 1
e := any edge in G with smallest weight that does not form a simple circuit when added
to T
T := T with e added
return T {T is a minimum spanning tree of G}

EXAMPLE. Use Prim’s and ruskal’s algorithm to find a minimum spanning tree in the graph shown
below.

Weighted graph
Solution: a) A minimum spanning tree constructed using Prim’s algorithm is

46
b. A minimum spanning tree constructed using kruskal’s algorithm is

Exercise. Use both algorisms then find the minimum spanning tree for the following graphs

47
Chapter five
Directed graphs
DEFINITION . A directed graph, or digraph, consists of a set V of vertices (or nodes)
together with a set E of ordered pairs of elements of V called edges (or arcs). The vertex
a is called the initial vertex of the edge (a, b), and the vertex b is called the terminal
vertex of this edge.
An edge of the form (a, a) is represented using an arc from the vertex a back to itself.
Such an edge is called a loop.

Example of directed graph

vertices are (a, b, c) and edges are {(c,a),(b,c),(a,b)}

degree of a vertex in digraph

DEFINITION In a graph with directed edges the in-degree of a vertex v, denoted by


, is the number of edges with v as their terminal vertex. The out-degree of v,
denoted by , is the number of edges with v as their initial vertex. (Note that a
loop at a vertex contributes 1 to both the in-degree and the out-degree of this vertex.)

EXAMPLE 4 Find the in-degree and out-degree of each vertex in the graph G with
directed edges shown below

Solution: The in-degrees in G are


deg (a) = 2, deg (b) = 2, deg (c) = 3, deg (d) = 2, deg (e) = 3, and deg (f ) = 0.

The out-degrees are


deg+(a) = 4, deg+(b) = 1, deg+(c)= 2,deg+(d) = 2, deg+(e) = 3, and deg+(f ) = 0.

48
Exercise Find the in-degree and out-degree of each vertex in the graph G with directed
edges shown below

(1) (2)

Matrix representation of digraphs


Adjacency matrix

The adjacency matrix of a diagonal D, with n vertices is the matrix A = {aij}n × n in


which
aij = 1 if arc {vi – vj} is in D
= 0 otherwise.

Incidence matrix

The incidence matrix B = {bij} of digraph D with n vertices and m edges is the n × m
matrix in which
bij = 1 if arc j is directed away from a vertex vi
= – 1 if arc j directed towards vertex vi
= 0 otherwise.

Example1. Use adjacency matrix to represent the graphs shown in Figure below

Solution. Take the order of vertices as v1,v2,v3,v4

Example2. Use incidence matrix to represent the graphs shown in Figure below

Solution; the incidence matrix is

49
Exercise; Use adjacency and incidence matrix to represent the graphs shown in
Figure below

Path and connectivity of digraph


Paths in digraphs
A path in a directed graph is obtained by traversing along edges (in the same direction
as indicated by the arrow on the edge).

DEFINITION 1 A path from a to b in the directed graph G is a sequence of edges (x0, x1),
(x1, x2), (x2, x3), . . . , (xn 1, xn) in G, where n is a nonnegative integer, and x0 = a and xn =
b, that is, a sequence of edges where the terminal vertex of an edge is the same as the
initial vertex in the next edge in the path. This path is denoted by x0, x1, x2, . . . , xn 1, xn
and has length n. We view the empty set of edges as a path of length zero from a to a. A
path of length n ≥ 1 that begins and ends at the same vertex is called a circuit or cycle.

A path in a directed graph can pass through a vertex more than once. Moreover, an edge
in a directed graph can occur more than once in a path.

EXAMPLE . Which of the following are paths in the directed graph shown in Figure 1: a,
b, e, d; a, e, c, d, b; b, a, c, b, a, a, b; d, c; c, b, a; e, b, a, b, a, b, e? What are the lengths of
those that are paths? Which of the paths in this list are circuits?

50
Solution: Because each of (a, b), (b, e), and (e, d) is an edge, a, b, e, d is a path of length
three. Because (c, d) is not an edge, a, e, c, d, b is not a path. Also, b, a, c, b, a, a, b is a path
of length six because (b, a), (a, c), (c, b), (b, a), (a, a), and (a, b) are all edges. We see that
d, c is a path of length one, because (d, c) is an edge. Also c, b, a is a path of length two,
because (c, b) and (b, a) are edges. All of (e, b), (b, a), (a, b), (b, a), (a, b), and (b, e) are
edges, so e, b, a, b, a, b, e is a path of length six.
The two paths b, a, c, b, a, a, b and e, b, a, b, a, b, e are circuits because they begin and end
at the same vertex. The paths a, b, e, d; c, b, a; and d, c are not circuits.

Connectivity
There are three types of connectivity in a directed graph G:

(i) G is strongly connected or strong if, for any pair of vertices u and v in G, there is a
path from u to v and a path from v to u, that is, each is reachable from the other.
(ii) G is unilaterally connected or unilateral if, for any pair of vertices u and v in G, there
is a path from u to v or a path from v to u, that is, one of them is reachable from the
other.

(iii) G is weakly connected or weak if there is a semipath between any pair of vertices u
and v in G. Let G’ be the (nondirected) graph obtained from a directed graph G by
allowing all edges in G to be nondirected. Clearly, G is weakly connected if and only if
the graph G’ is connected.

Observe that strongly connected implies unilaterally connected which implies weakly
connected. We say that G is strictly unilateral if it is unilateral but not strong, and we say
that G is strictly weak if it is weak but not unilateral.

Connectivity can be characterized in terms of spanning paths as follows:

Theorem : Let G be a finite directed graph. Then:

(i) G is strong if and only if G has a closed spanning path.


(ii) G is unilateral if and only if G has a spanning path.
(iii) G is weak if and only if G has a spanning semipath.

51
EXAMPLE . Consider the graph G in Fig. below. It is weakly connected since the
underlying nondirected graph is connected. There is no path from C to any other vertex,
that is, C is a sink, so G is not strongly connected.
However, P = (B,A,D,C) is a spanning path, so G is unilaterally connected.

52

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy