0% found this document useful (0 votes)
5 views25 pages

Goals: Discrete Mathematics and Combinatory

Uploaded by

cherkos welday
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)
5 views25 pages

Goals: Discrete Mathematics and Combinatory

Uploaded by

cherkos welday
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/ 25

Discrete Mathematics and Combinatory 2016

Chapter one

The Basic Principles of Counting

Goals: To introduce basic counting rules and to show how they are used to solve a variety of
counting problems.
Learning Objectives

 Learn the basic counting principles (product and sum) principles.

 Learn about permutations & combinations

 Explore the pigeonhole principle.

 Learn about binomial coefficients and explore the algorithm to compute them

 Learn the Inclusion-Exclusion Principle.

Counting problems arise throughout both mathematics and computer science. For example,

Assume we have a set of objects with certain properties Counting is used to determine the
number of these objects.
• 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.
Counting problems may be very hard, not obvious
Solution: simplify the solution by decomposing the problem, there are two basic counting
principles, the sum and product rules.

THE SUM RULE

Theorem: Suppose that a procedure is carried out by performing the tasks T1, T2, · · · , Tm. If task
Ti can be done in ways, = 1, 2,· · · , , and no two of these tasks can be done at the same
time, then there are n1 + n2 + · · · + nm ways to carry out the procedure. A count decomposes
into a set of independent counts (“elements of counts are alternatives”)
The sum rule can be phrased in terms of sets as follows: If A1, A2, · · · , Am are disjoint sets, then
the number of elements in the union of these sets is the sum of the numbers of elements in them.
To relate this to our statement of the sum rule, let Ti be the task of choosing an element from
for i = 1, 2, · · · ,m. There are |Ai| ways to do Ti. From the sum rule, since no two of the tasks can
be done at the same time, the number of ways to choose an element from one of the sets is
A1 U A2 U A3 U Am  A1  A2  A3    Am
If A and B are finite sets that are disjoint (meaning A  B   ), then A  B  A  B

Prepared by: Getachew.M Page 1/10


Discrete Mathematics and Combinatory 2016

Example: There are three boxes containing books. The first box contains 15 mathematics books
by different authors, the second box contains 12 chemistry books by different authors, and the
third box contains 10 computer science books by different authors. A student wants to take a
book from one of the three boxes. In how many ways can the student do this?

Solution: Suppose tasks T1, T2, and T3 are as follows:

 T1 : Choose a mathematics book.

 T2 : Choose a chemistry book.

 T3 : Choose a computer science book.

Then tasks T1, T2, and T3 can be done in 15, 12, and 10 ways, respectively.

All of these tasks are independent of each other. Hence, the number of ways to do one of these
tasks is 15 + 12 + 10 = 37

Example: Suppose there are 3 doors in a room, 2 on one side and 1 on other side. A man wants to
go out from the room. Obviously he has ‘3’ opitons for it. He can come out by door “A” or Door “B”
or door “C”. so he has three options.
Room

A
Man C
B

Example:
• You need to travel in between city A and B. You can either fly, take a train, or a bus. There are
12 different flights in between A and B, 5 different trains and 10 different buses. How many
options do you have to get from A to B?
• We can take only one type of transportation and for each only one option. The number of
options:
By sum rule:
• n = number of flights + number of trains + number of buses = 27 options

THE PRODUCT RULE

Theorem : Suppose that a procedure is carried out by performing the tasks T1 , T2 ,  Tm . If task Ti
can be done in ni ways after tasks T1 , T2 ,  and Ti 1 have been done, then there are

Prepared by: Getachew.M Page 2/10


Discrete Mathematics and Combinatory 2016

n1 x n2 x  x nm ways to carry out the procedure. A count decomposes into a sequence of


dependent counts (“each element in the first count is associated with all elements of the second
count”)
The product rule is often phrased in terms of sets in the following way:
If A1, A2, · · · , Am are finite sets, then the number of elements in the Cartesian product of these
sets is the product of the number of elements in each set. To relate this to the product rule, note
that the task of choosing an element in the Cartesian product is done by choosing an element in
A1, an element in A2, and an element in Am. From the product rule it follows
That A1 x A2 x A3  x Am  A1 x A2 x A3 x  x Am

Example: Suppose a man wants to cross-out a room, which has 2 doors on one side and 1 door on
toher site. He has 2 x 1 = 2 ways of it.

Room

A
Man
B

Example: Assume an auditorium with a seat labeled by a letter and numbers in between 1 to 50
(e.g. A23). We want the total number of seats in the auditorium.
• 26 letters and 50 numbers. How to count?
• One solution: write down all seats (objects) and count them
A  1 A  2 A  3  A  50 B  1 B  2  Z  50
 eventually we get it
1 2 3  50 51 52  n  1 n
A better solution?
• For each letter there are 50 numbers So the number of seats is 26*50 = 1300
• By product rule: number of letters * number of integers in [1,50]
Example:
• How many different bit strings of length 7 are there? E.g. 1011010
• Is it possible to decompose the count problem and if yes how?
Yes.
• Count the number of possible assignments to bit 1
• For the first bit assignment (say 0) count assignments to bit 2
– For the specific first two bits count assignments to bit 3
– Gives a sequence of n dependent counts and by the product
rule we have:
n = 2* 2 * 2 * 2 * 2 * 2 *2 = 2 = 128
Exercise: Mebrat is a lead actor in a new movie. She needs to shoot a scene in the morning in
studio A and an afternoon scene in studio C. She looks at the map and finds that there is no direct

Prepared by: Getachew.M Page 3/10


Discrete Mathematics and Combinatory 2016

route from studio A to studio C. Studio B is located between studios A and C. There are three
roads, say A1, A2, and A3, from studio A to studio B and four roads, say B1, B2, B3, and B4, from
studio B to studio C. In how many ways can Mebrat go from studio A to studio C?

More complex counting problems typically require a combination of the sum and product rules.

Example : Suppose variable names in a programming language can be either a single uppercase
letter or an uppercase letter followed by a digit. Find the number of possible variable names.
Solution: Use the sum and product rules: 26 + 26 10 = 286.

Assignment One: (submission date is one week after you take the assignment)
1) (A login password) The minimum password length is 6 and the maximum is 8. The
password can consist of either an uppercase letter or a digit. There must be at least one digit
in the password. How many different passwords are there?

2). (Telephone Numbering Plan) The Ethiopian numbering plan (ENP) specifies that a
telephone number consists of 10 digits, that is a 3-digit area code, a 3-digit office code, and a
4-digit station code. There are some restrictions on the digits.
 Let X denote a digit from 0 through 9, i.e., 10 digits in total.
 Let N denote a digit from 2 through9, i.e., 8 digits in total.
 Let Y denote a digit that is 0 or 1, i.e., 2 digits in total.
 In the old plan (in use in the 1980s) the format was NYX-NNX-XXXX
 In the new plan, the format is NXX-NXX-XXXX
How many different phone numbers are possible under the old plan and the new plan?
Why we need the new plan, justify?
3) How many mobile phone numbers are there starting with 0914 in Ethiopia?

The principle of inclusion-exclusion

For any finite sets A and B (not necessarily disjoint), A B  A  B  A B

|A| + |B| over counts (twice) exactly those elements in .


This is called the inclusion-exclusion principle for two finite sets.
Consider three finite sets, A, B, and C. Then

This is called the inclusion-exclusion principle for three finite sets.

Prepared by: Getachew.M Page 4/10


Discrete Mathematics and Combinatory 2016

Elements that are in A


and B but not inC

Elements that
A B are in A,B,and
C

Elements that
are in A and
C but not in Elements that are
B C in B and C but
not in A

Figure: Venn diagram

Example: How many bit strings of length 8 either start with a 1 bit or end with the two bits 00?

Solution: Let A is number of bit strings of length 8 that start with 1: | | = 2 = 128.
Let B is number of bit strings of length 8 that end with 00: | | = 2 = 64.
Number of bit strings of length 8 that start with 1 and end with 00: | ∩ | = 2 = 32.
Then A  B  A  B  A  B  128  64  32  160
Example: How many positive integers not exceeding 1000 are divisible by 7 or 11 ?
Solution: Let A be the set of positive integers not exceeding 1000 that are divisible by 7, and let B
be the set of positive integers not exceeding 1000 that are divisible by 11.
Then A  B is the set of integers not exceeding 1000 that are divisible
by either 7 or 11, and A  B is the set of integers not exceeding 1000
that are divisible by both 7 and 11. Since
A  1000 / 7  142 , B  1000 / 11  90 , A  B  1000 /(7.11)  12
Consequently, there are
A  B  A  B  A  B  142  90  12  220
positive integers not exceeding 1000 that are divisible by either 7 or 11

Tree diagrams

Counting problems can be solved using tree diagrams. A tree consists of a root, a number of
branches leaving the root, and possible additional branches leaving the endpoints of other
branches. To use trees in counting, we use a branch to represent each possible choice. We
represent the possible outcomes by the leaves, which are the endpoints of branches not having
other branches starting at them.

Prepared by: Getachew.M Page 5/10


Discrete Mathematics and Combinatory 2016

Tree: is a structure that consists of a root, branches and leaves. Can be useful to represent a
counting problem and record the choices we made for alternatives. The count appears on the leaf
nodes.
Example: What is the number of bit strings of length 4 that do not have two consecutive ones?
Solution: The tree diagram in following figure displays all bit strings of length four without two
consecutive 1s. We see that there are eight bit strings of length four without two consecutive 1s.

Empty string
1 0

1 0
0
0
1 0 1
0
0
0 1 1 1
0 0
0
The number of bit strings of length 4 that do not have two consecutive ones form the above tree
diagram are 1010,1001,1000,0101,0100,0000,0010,0001 they are 8which are length 4 bit
strings.

Permutation and Combination

Any linear arrangement of n distinct objects. What is the difference?

Before we discuss permutations we are going to have a look at what the words combination
means and permutation. A fruit salad is a mix of among other things grapes, apples and bananas,
it doesn't matter in what order we add our ingredients We don’t care what order the fruits are in,
they could also be bananas, grapes and apples or apples, grapes, and bananas. It’s the same fruit
salad. But if we have a combination to our password that is 4-5-6 then the order is extremely
important here the combination 5-4-6 does not work.

If the order doesn't matter then we have a combination, if the order do matter then we have a
permutation. One could say that a permutation is an ordered combination.
Example: Suppose we have to form a number consisting of three digits using the digits 1,2,3,4, To
form this number the digits have to be arranged. Different numbers will get formed depending
upon the order in which we arrange the digits. This is an example of Permutation.

Now suppose that we have to make a team of 11 player out of 20 players, This is an example of
combination, because the order of players in the team will not result in a change in the team. No
matter in which order we list out the players the team will remain the same! For a different team
to be formed at least one player will have to be changed

So, in Mathematics we use more precise language:

Prepared by: Getachew.M Page 6/10


Discrete Mathematics and Combinatory 2016

 If the order doesn’t matter, it is a Combination

 If the order does matter it is a Permutation

Permutation: Permutation means arrangement of things. The word arrangement is used, if the
order of things is considered. Seating arrangement is an example of permutation.
Notation: The number of permutations of n objects taken r at a time where 1 ≤ ≤ is
!
determined by the following formula ( , )=
( )!
Read as ‘The number of permutations of n things taken r at a time’
Note that the factorial notation
! = ( − 1)( − 2) … (3)(2)(1) and 0! = 1 , ( , ) = ! , ( , 0) = 1
Examples: In how many ways can first and second place be awarded to 10 peoples?
! ! !
Ans: (10,2) = = = = 10 9 = 90
( )! ! !

Example: A class has 10 students A,B,C … I, J then 5 students are to be chosen and seated in a row
for a picture like BCEFI. How many such linear arrangement is possible?

Ans: here order matters and we are selecting 5 students out of 10 at a time

10! 10!
(10,3) = = = 30240
(10 − 5)! 5!

Combination: Combination means selection of things. The word selection is used, when the order
of things has no importance.

Notation: If we have distinct objects then the number of combination of size where 0 ≤ ≤
is given by
!
( , )=
( − )! !
Read as ‘The number of combinations of n things taken r at a time’

Example: suppose we want to select 4 students for a representation from a class of 20 students.
In how many ways can you perform the selection?

Solution: here order does not matters and we are selecting 4 students out of 20 at a time, hence
we use combination.

20! 20! 20 ∗ 19 ∗ 18 ∗ 17 ∗ 16!


(20,4) = = = = 4,845
(20 − 4)! ∗ 4! 16! ∗ 4! 16! ∗ (4 ∗ 3 ∗ 2 ∗ 1)

Prepared by: Getachew.M Page 7/10


Discrete Mathematics and Combinatory 2016

THE PIGEONHOLE PRINCIPLE

Suppose that a flock of pigeons flies into a set of pigeonholes to roost. The pigeonhole principle
states that if there are more pigeons than pigeonholes, then there must be at least one
pigeonhole with at least two pigeons in it. Of course, this principle applies to other objects
besides pigeons and pigeonholes.

Theorem: If k + 1 or more objects are placed into k boxes, then there is at least one box
containing two or more of the objects.
Proof: Suppose that none of the k boxes contains more than one object. Then the total number of
objects would be at most k. This is a contradiction, since there are at least
+ 1 objects.
Example: Among any group of 367 people, there must be at least two with same birthday,
because there are only 365 possible birthdays.
Example: Among any 102 students there must be at least two students receive the same score on
the final exam, if the exam is graded on a scale from 0 to 100 points

Theorem: (THE GENERALIZED PIGEONHOLE PRINCIPLE)


If N objects are placed into boxes, then there is at least one box containing at least N / K 
objects.
Remark: A common type of problem asks for the minimum number of objects so that at least r of
those objects must be in one of boxes when these objects are distributed among the boxes.
Example: Among 100 people there at least 100 / 12  9 who were born in the same month.
Example: What is the minimum number of students required in a discrete mathematics class to
be sure that at least seven will receive the same grade, if there are five possible grades A, B, C, D,
and F?
Solution: The minimum number of students needed to ensure that at least seven students receive
the same grade is the smallest integer N such that N / 5  7 .
The smallest such integer is N = 5·(7−1)+1 = 31.

Prepared by: Getachew.M Page 8/10


Discrete Mathematics and Combinatory 2016

Example (application)
There are two San Franciscans with the exact same number of hairs on their heads. Indeed,
according to P&G Hair Facts, the average person’s head has about 100,000 hairs, while “some
people have as many as 150,000.” So it seems safe to bet that every San Franciscan has at most
700,000 hairs on his or her head. On the other hand, the year 2000 US Census counted 776,733
San Francisco residents. The pigeonhole principle implies that at least two of them have exactly
same number of hairs.

Binomial Coefficients

 The expression + is a binomial expression as it is the sum of two terms.


 The expression ( + ) is called a binomial expression of order n.

( + ) = + + + ⋯+ +
0 1 2 −1

Pascal’s Triangle
The number C(n, r) can be obtained by constructing a triangular array.
 The row 0, i.e., the first row of the triangle, contains the single entry 1. The row 1, i.e., the
second row, contains a pair of entries each equal to 1.
 Calculate the nth row of the triangle from the preceding row by the following rules:

Prepared by: Getachew.M Page 9/10


Discrete Mathematics and Combinatory 2016

Example: compute the expression ( + 2 )

Solution: ( + 2 ) =

(2 ) + (2 ) + (2 ) + (2 ) + (2 ) + (2 )

= + 10 + 40 + 80 + 80 + 32

Exercise: 1) find the constant term in the expression (3 + 2)

2) What is the coefficient of in the expression −3

Prepared by: Getachew.M Page 10/10


Discrete Mathematics and combinatory

Chapter- two

Recurrence Relations

INTRODUCTION

A wide variety of recurrence relations occur in models. Some of these recurrence relations
can be solved using iteration or some other techniques. However, one important class of
recurrence relations can be explicitly solved in a systematic way. These are recurrence
relations that express the terms of a sequence as linear combinations of previous terms. A
recursive algorithm is one in which objects are defined in terms of other objects of the
same type. Discrete Mathematics
Goals : To solve linear recurrence relations with constant coefficients.
Advantages:
 Simplicity of code
 Easy to understand
Disadvantages:
 Memory
 Speed
 Possibly redundant work
Tail recursion offers a solution to the memory problem, but really, do we need recursion?
Specifically, we study how to define & solve recurrence relations.

Definition:
A recurrence relation for a sequence { } is an equation that expresses an in terms of one
or more of the previous terms in the sequence, , , . . . , for all integers ≥ where
is a nonnegative integer. A sequence is called a solution of a recurrence relation if its
terms satisfy the recurrence relation.
Example:
Consider the recurrence relation an = 2an-1 – an-2 for = 2, 3, 4, …
-Is the sequence {an} with = 3 a solution of this recurrence relation?
let us see for n  2 we see that
2an-1 – an-2 = 2(3(n – 1)) – 3(n – 2) = 3n = an.
Therefore, {an} with an=3n is a solution of the recurrence relation.
-Is the sequence {an} with an=5 a solution of the same recurrence relation?
For n  2 we see that
2an-1 – an-2 = 25 - 5 = 5 = an.
Therefore, {an} with an=5 is also a solution of the recurrence relation.

Note : Initial conditions + recurrence relation uniquely determine the sequence.


Let us consider the following application examples
Example 1: The number of bacteria in a colony triples every hour. If a colony begins with
10 bacteria, how many will be present after n hours?.

Prepared By: Getachew.M Page 1/9


Discrete Mathematics and combinatory

Solution: We let a n denote the number of bacteria at the end of n hours. Hence a n  3a n 1 ,
where n is a positive integer. This equation, called the recurrence relation, together with
the initial condition a 0  10 , uniquely determines the sequence a n , for all nonnegative
integers n. The sequence of a recurrence relation is called a solution of the recurrence
relation.
Example 2:
Someone deposits $10,000 in a savings account at a bank yielding 5% per year with
interest compounded annually. How much money will be in the account after 30 years?
Solution:
Let Pn denote the amount in the account after n years. How can we determine Pn on the
basis of Pn-1? We can derive the following recurrence relation:
Pn = Pn-1 + 0.05Pn-1 = 1.05Pn-1.
The initial condition is P0 = 10,000.
Then we have:
= .
= . = ( . )

= . = ( . )
…..

= . = ( . )

= . = , is the recurrence relation for the above question.


We now have a formula to calculate Pn for any natural number n and can avoid the
iteration.
Let us use this formula to find P30 under the initial condition P0 = 10,000:
P30 = (1.05)3010,000 = 43,219.42
After 30 years, the account contains $43,219.42

Example 3: (Rabbits and the Fibonacci numbers)


A pair of rabbits does not breed until they are 2 months old. After they are 2 months old,
each pair produces another pair each month. Starting with a pair of rabbits, find a
recurrence relation for the number of pairs of rabbits after n months, assuming that no
rabbit ever dies.
Solution:
At the end of the first month, the number of pairs of rabbits is a 1  1
At the end of the second month, the number of pairs of rabbits is a 2  1
To find the number of pairs at the end of n months, add the number in the previous month,
a n 1 , and the number of newborn pairs, a n2 , since each newborn comes from a pair at least
two months old. Hence,
a n  a n 1  a n 2 , n  3 , with a 1  1 and a 2  1
is the desired recurrence relation.

Prepared By: Getachew.M Page 2/9


Discrete Mathematics and combinatory

Example 4:
a) Find a recurrence relation for the number of ways to climb stairs if the person
climbing the stairs can take one stair or two stairs at a time.
b) What are the initial conditions?
c) In how many ways can this person climb a flight of eight stairs?

Solution:
Let denote the number of ways of climbing the stairs.
a) Let ≥ 3. The last step either was a single step, for which there are possibilities,
or a double step, for which there are possibilities.
The recurrence is = + ≥ 3.
b) We have = 1 = 2. You can take two stairs either directly or by taking stair
at a time.
c) The recurrence gives the Fibonacci sequence 1, 2, 3, 5, 8, 13, 21, 34, 55, …
Hence there are = ways to climb a flight of eight stairs

Example 5:
The Fibonacci numbers are defined by the recurrence,
= + where = 1 , =1
how do we find its solution? We will back to this later.

Example 6:
The game of Hanoi Tower is to play with a set of disks of graduated size with holes in their
centers and a playing board having three spokes for holding the disks.

The object of the game is to transfer all the disks from spoke A to spoke C by moving one
disk at a time without placing a larger disk on top of a smaller one. What is the minimal
number of moves required when there are n disks?

Solution:
Let be the minimum number of moves to transfer n disks from one spoke to another. In
order to move n disks from spoke A to spoke C, one must move the first − 1 disks from
spoke A to spoke B by moves, then move the last (also the largest) disk from spoke A
to spoke C by one move, and then remove the − 1 disks again from spoke B to spoke C by
moves. Thus the total number of moves should be
an  an1  1  an1  2an1  1
This means that the sequence { | ≥ 1} satisfies the recurrence relation
an  2a n1  1 with a1  1

Prepared By: Getachew.M Page 3/9


Discrete Mathematics and combinatory

Applying the recurrence relation again and again, we have

We will see later in the non-homogeneous recurrence relation how to find solutions of
recurrence relation of the above type.
Given a recurrence relation for a sequence with initial conditions. Solving the recurrence
relation means to find a formula to express the general term of the sequence.

Solving Linear Recurrence Relations

Definition: a linear homogeneous recurrent relation (LHRR) of order


k with constant coefficients is a recurrence relation of the form

= + +··· +

where , ,· · · , are real numbers, and ≠ 0.


Linear homogeneous recurrence relations are studied for two reasons:

 First, they often occur in modeling of problems.


 Second, they can be systematically solved.

The recurrence relation in the definition is linear since the right-hand side is a sum of
multiples of the previous terms of the sequence.
• The recurrence relation is homogeneous since no terms occur that are not multiples of
the ′ .
• The coefficients of the terms of the sequence are all constants, rather than functions that
depend on n.
• The order is k because is expressed in terms of the previous k terms of the sequence.

Example:
The recurrence relation = 1.11 is a linear homogeneous recurrence relation of
order one.

Prepared By: Getachew.M Page 4/9


Discrete Mathematics and combinatory

• The recurrence relation = + is a linear homogeneous recurrence relation


of order two.
• The recurrence relation = + is not linear.
• The recurrence relation = 2 + 1 is not homogeneous.
• The recurrence relation = does not have constant coefficients.

SOLVING LHRR WITH CONSTANT COEFFICIENTS

The basic approach for solving LHRR is to look for solutions of the form = , where r
is a constant. Note that = is a solution of the recurrence relation
= + +··· +

if and only if
= + +··· +

When both sides of late equation are divided by and the right-hand side is subtracted
from the left, we obtain the equivalent equation

− − −··· − =0

which is called the characteristic equation of the recurrence relation. The solutions of this
equation are called the characteristic roots of the recurrence relation. We will first develop
results that deal with LHRR with constant coefficients of degree two. Then corresponding
general results when the degree may be greater than two will be stated.

Theorem:
Let be real numbers. Suppose that − − = 0
has two distinct roots . Then the sequence { a n } is a solution of the recurrence
relation = + if and only if = +

for = 0, 1, 2,· · ·, where and are constants.

Example 1: Find an explicit formula for the Fibonacci numbers.

Solution: Recall that the sequence of Fibonacci numbers satisfies the recurrence relation
= + and also satisfies the initial conditions = 0 = 1.
The characteristic equation is − − 1 = 0, and the solutions are
= (1 + √5)⁄2 and = (1 − √5)⁄2
Therefore, from the above theorem it follows that the Fibonacci numbers are given by
= (1 + √5)⁄2 + (1 − √5)⁄2 for some constants

The initial conditions = 0 and = 1 can be used to find these constants. We have
= (1 + √5)⁄2 + (1 − √5)⁄2 = + =0
= (1 + √5)⁄2 + (1 − √5)⁄2 = (1 + √5)⁄2 + (1 − √5)⁄2 = 1

Prepared By: Getachew.M Page 5/9


Discrete Mathematics and combinatory

The solution to these simultaneous equations is

= , = Consequently, the Fibonacci numbers are given by


√ √
1 −1
= (1 + √5)⁄2(1 − √5)⁄2
+
√5 √5
Remark: The Fibonacci sequence is an integer sequence, but it “looks like" a sequence of
irrational numbers from its general formula above.

Example 2: What is the solution of the recurrence relation

an = an-1 + 2an-2 with a0 = 2 and a1 = 7 ?

Solution:
The characteristic equation of the recurrence relation is r2 – r – 2 = 0.
Its roots are r = 2 and r = -1.
Hence, the sequence {an} is a solution to the recurrence relation if and only if:
an = 12n + 2(-1)n for some constants 1 and 2.
Given the equation an = 12n + 2(-1)n and the initial conditions a0 = 2 and a1 = 7, it follows
that
a0 = 2 = 1 + 2 and a1 = 7 = 12 + 2 (-1)
Solving these two equations gives us 1 = 3 and 2 = -1.
Therefore, the solution to the recurrence relation and initial conditions is the sequence {an}
with
an = 32n – (-1)n.

The above theorem does not apply when there is one characteristic root of multiplicity two.
This case can be handled using the following theorem.

Theorem :
Let and be real numbers with ≠ 0. Suppose that − − = 0 has only one
root . A sequence { } is a solution of the recurrence relation = +
if and only if
= +

For = 0, 1, 2,· · ·, where and are constants.

Example 3: What is the solution of the recurrence relation


= 6 –9 with a0 = 1 and a1 = 6? And find
Solution: The only root of r2 – 6r + 9 = 0 is r0 = 3. Hence, the solution to the recurrence
relation is an = 13n + 2n3n for some constants 1 and 2.
To match the initial condition, we need
a0 = 1 = 1
a1 = 6 = 13 + 23

Prepared By: Getachew.M Page 6/9


Discrete Mathematics and combinatory

Solving these equations yields 1 = 1 and 2 = 1. Consequently, the overall solution is given
by an = 3n + n3n.
And by putting = 50 = 3 + 50(3)

Exercise:
What is the solution to the recurrence relation = 8 − 16
with initial conditions = 1, = 7?

Assignment two:

1). Assume that the population of the world in 2010 is 6.2 billion and is growing at the
rate of 1.3% a year.
a) Set up a recurrence relation for the population of the world n years after 2002.
b) Find an explicit formula(solution) for the population of the world n years after 2002.
c) What will the population of the world be in 2018?

2). Find the solution of the following recurrence relation


a) = + ℎ =0 =1
b) =4 −3 ℎ =5 =7 ?

Summary

Our general technique for solving LHRR with constant coefficients are two-step process.
 Step 1: Find the roots of the characteristic polynomial and use them to develop the
general solution.
How do I find roots of polynomials?
 Step 2: Use the initial conditions to make and solve a system of linear equations that
determine the arbitrary constants in the general solution to get the particular
solution.
How do I solve systems of linear equations?

Linear Non-homogeneous Recurrences

For recursive algorithms, cost functions are often not homogenous because there is usually
a non-recursive cost depending on the input size. Such a recurrence relation is called a
linear non-homogeneous recurrence relation. Such functions are of the form
= + +··· + + ( )

Here, ( ) represents a non-recursive cost. If we chop it off, we are left with

= + +··· +
which is the associated homogenous recurrence relation. Every solution of a linear non-
homogeneous recurrence relation is the sum of a particular solution and a solution to the
associated linear homogeneous recurrence relation.

Prepared By: Getachew.M Page 7/9


Discrete Mathematics and combinatory

Theorem :

( )
If { } is a particular solution of the non-homogeneous linear recurrence relation with
constant coefficients
= + +··· + + ( )

( ) ( ) ( )
then every solution is of the form{ + } where { } a solution of the associated
homogenous recurrence relation
= + +··· +

There is no general method for solving such relations. However, we can solve them for
special cases. In particular, if f(n) is a polynomial or exponential function (or more
precisely, when f(n) is the product of a polynomial and exponential function), then there is
a general solution. To solve the above non homogeneous recurrence relation it remains to
( ) ( )
find a particular solution . Let us one method to find the particular solution

The method of undetermined coefficients:

The basic trial forms are given in the table below (c denotes a constant in the expression of
f(n)
and A (with or without subscripts) denotes a constant to be determined):

( ) ( ) ( ) ( )
Trial or gauss of Trial or gauss of
( ∈ )
+ ( ) +
+ + ( ) +

Example: Solve the recurrence relation given

The corresponding linear homogeneous recurrence relation of the above equation


is . It’s general solution is for some constant to be determined
( ) ( )
later. As such, = 2 . Right now, we need to determine which should be in the
form of since is a quadratic function.

( )
Now, is supposed to satisfy the recurrence relation. As such, we have:

By rearranging and comparing coefficients, we obtain the following system of equations:

Prepared By: Getachew.M Page 8/9


Discrete Mathematics and combinatory

Solving the above system, we obtain and . This makes it clear that

( )
= + 4 + 3 and hence . By plugging the value of , we
finally obtain . Hence the final answer is

= −2 + +4 +3.

Exercise :

What is the solution of the recurrence relation


= 2 − + 2 ≥ 2, with =1 =2

Prepared By: Getachew.M Page 9/9


CHAPTER-3

GRAPH THEORY

INTRODUCTION

There are many concrete, practical problems that can be simplified and solved by looking at them from a
different point of view. The Konigsberg Bridge Problem, which we will soon describe, was a long-
standing problem until it was imaginatively solved in 1736 by the great Swiss mathematician LUonhard
Euler (1707-1783). Beginning his scientific career shortly after the death of Sir Isaac Newton, Euler spent
the last 17 years of his life blind, but still very active. Some of his mathematical contributions were to the
theory of convergent sequences and to the calculus of variations. Much of what is taught today about
quadratic equations, conic sections, and quadrics in Euclidean space is just as Euler himself laid out.
Perhaps less known is that Euler was a superb designer of algorithms; he had the uncanny ability of
making order out of chaos, of seeing simple routes through the most complicated situations. It is because
of his imaginative solution to the Konigsberg Bridge Problem that Euler is generally considered to be the
father of
modern-day graph theory. In the eighteenth century, Kinigsberg was the capital of East Prussia.' The
Pregel River flowed through town and split into two branches around Kneiphof island, which is labeled A
in Fig 9.1. Seven bridges crossed the river, providing links among the four land masses labeled A, B, C, D
in the figure. People wondered if it were possible to start on one of the land masses, walk over each of the
seven bridges exactly once, and return to the starting point (without getting wet).To find an abstract
mathematical model of a concrete problem can be a difficult task requiring both ingenuity and experience.
The primary aim of this chapter is to
provide the reader with some of this experience by presenting several real-world

Fig. The bridges of Konigsberg.

Problems and showing how they can be formulated in mathematical terms. This process of translation into
mathematics forces us to sift through all the details of the problem, deciding which ones are important and
which are extraneous. (Those aspects of a "real" problem which make it interesting are sometimes quite
irrelevant and serve primarily to create confusion!) Because the language of mathematics is precise and
without ambiguity, problems which seem complicated when expressed in ordinary language often have
surprisingly straightforward mathematical translations.

A graphical representation of the


Kdnigsberg Bridge Problem

For the Konigsberg Bridge Problem, Euler's idea was to realize that the physical layout of land, water, and
bridges could be modeled by the graph shown in the above figure. The land masses are represented by
small circles (or vertices) and the bridges by lines (or edges) which can be straight or curved. By means of
this graph, the physical problem is transformed into this mathematical one: Given the graph in is it
possible to choose a vertex, then to proceed along the edges one after the other and return to the chosen
vertex covering every edge exactly once? Euler was able to show that this was not possible. Can you?
The Three Houses-Three Utilities Problem is another physical situation which can be modeled by means
of a graph. There are three houses, each of which is to be connected to each of three utilities-water,
electricity, and telephone by means of underground pipes. Is it possible to make these connections without
any
Crossovers? Figure below shows how to describe this problem with a graph. The houses and the utilities
are represented by vertices and the pipes are the lines drawn between the vertices.

The Three Houses-


Three Utilities
Problem.

Terminology of Graph

Graphs
A graph G is a discrete structure consisting of nodes (called vertices) and lines joining the nodes
(called edges). Two vertices are adjacent to each other if they are joint by an edge. The edge joining the
two vertices is said to be an edge incident with them. We use V (G)and E(G) to
denote the set of vertices and edges of G respectively.

For any graph the vertex set V is always non-empty but the edge set E(G) can be empty { if ( ) = ∅
then the graph G is called a null graph} and a vertex is isolated (An isolated vertex is a vertex whose
degree is 0) if it has no edges incident to it.

Example:

u and v are adjacent vertices; e is an edge incident with u and v. e can also be denoted by uv or vu.

Loops and Multiple Edges:


An edges that joins vertex to itself is called a loop. If there are more than one edge joining u and v of
G,then all edges joining u and v form a multiple edge of G.

Simple Graph:
A simple graph is a graph containing no loops and multiple edges.
Degrees of Vertices:
The degree of a vertex 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) or d(v).
Example:

d(u) = 5 , d(v) = 3

and d(w) = 2

Exercise:
Find the degree of every vertex of the following graph. When two lines cross, but there isn’t a dot, that
does not count as a vertex, so this graph has only 6 vertices.

Theorem: [The handshaking theorem] Let G be a graph with e edges. Then

Note: The number of vertices of odd degree in a graph G is even.

Complete Graphs:
The complete graph on n vertices, denoted by is the simple graph in which any pair of vertices are
adjacent.

Example:

Subgraphs:
A sub-graph of a graph G is a graph H where V (H)⊆V (G) and E(H)⊆ E(G).
Example:

Complete graph is simple graph in which every pair of its distinct vertices are adjacent. A complete graph
with n vertices is denoted as . The first four complete graphs are
given as examples:
Matrix representation of graphs
(Please read how to add and multiply matrices first)

Adjacency Matrices:
Definition: Given a graph G with vertex set = { , , … } and edge set E, we define the adjacency
matrix of G as follows: Let G be an graph. Suppose , , … are the vertices of G. Then the adjacent
matrix with respect to this ordering of V (G) is the n× n matrix = , where
1 , when vi and v j are adjacent
mij  
0 , otherwise

Example:

= the number of edges connecting and in G

Note that an adjacency matrix of a graph is based on the ordering chosen for the vertices. Hence, there are
as many as n! different adjacency matrices for a graph with n vertices, because there are n! different
orderings of n vertices. The adjacency matrices of a simple graph is symmetric
because if vi is adjacent to vj , then vj is adjacent to vi and if vi is not adjacent to vj , then vj is not adjacent
to vi . Since a simple graph can not have a loop. For the following graph its adjacency matrix given below.

Note: arrow with all zeros represents an isolated vertex

Paths: (way of getting from one vertex to another via edges)


- sequence of vertices in which successive vertices are
joined by an edge that is, A path in a graph is a sequence
of edges that links together two vertices
 Ex. Path from vertex A to vertex C (e2,e5 or e2, e7, e6) Etc.
 A path may have repeated edges (e2,e3,e1,e2,e5).
 The length of a path is determined by the number of edges in that path
 The degree of a vertex is the number of edges touching the vertex.
(loops count twice)

A simple path: is a path in which no vertex is repeated (e2, e7, e6, e4)

A closed path: is a path in which the first and last vertices are the same (e2, e7, e6, e4, e1)
A graph is connected if every pair of vertices is joined by a path.

A circuit is a closed path in which no edges are repeated (e2, e7, e6, e4, e1).

A simple circuit is a circuit with no repeated vertices except for the first and the last (e2, e7, e6, e4,
e1).

Any path that traces the graph by going across each edge exactly once but each vertex atleast once and
starts and ends at the same vertex is called an Euler circuit.
Euler’s Theorem: A graph contains a Euler Circuit if:
1. Graph is Connected
2. Every vertex is of even degree

If a graph has a vertex with odd degree

Then the graph can not have an Euler


circuit. For example this graph has no Euler
circuit

Exercise: Explain why find an answer to the Bridges of Koenigsburg problem is the same as finding an
Euler circuit on the graph shown. (The vertices are like the land masses, and the bridges are represented
by the edges. So finding a solution to the problem is like crossing every edge once, which is the same as
an Euler circuit)
Euler showed that if there is any vertex of the graph that has odd degree, then the graph does not have an
Euler circuit. He also showed that if all of the vertices of the edges have an even degree, then the graph
does have an Euler circuit.

This graph has an Euler circuit, because all of


the vertices have even degree. You can find
the circuit by traveling
along the graph in this order:
A → B →D →C →B →A.
(Notice that vertex B is used twice. This is fine in an Euler circuit.)

Does the graph showing the Koenigsburg bridges have an Euler circuit? Why or why not?
(ANS: It does NOT because it has vertices with odd degree.)
For each of the graphs shown below, decide if they have an Euler circuit. If they do, find an Euler circuit.
If it doesn’t have an Euler circuit, explain why not

Another problem that can be studied through graph theory is what is called the “traveling salesman
problem.” One example from that problem is shown below. It shows 4 cities that a sales representative
would visit, and the distances (in miles) between the cities. The problem is to find the best order for the
sales representative to visit the cities, and return to the starting point, so that the shortest distance possible
is travelled.

Write down some possibilities for paths the sales representative could take, starting in Denver. Which one
is the shortest? Write all of the possibilities that you tested in your math journal. Shortest is 444 miles,
and the route is Denver→Limon→Lamar→Pueblo→Denver. (The reverse route is also correct.)

You might also like