0% found this document useful (0 votes)
39 views354 pages

Softwareengineerng (Discrete2024 2025) MJ

Uploaded by

mulatumuler82
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)
39 views354 pages

Softwareengineerng (Discrete2024 2025) MJ

Uploaded by

mulatumuler82
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/ 354

Discrete Mathematics and Combinatory (Software Engineering)

By: Fikrie Melkamu (MSc)


Department of Mathematics

Sep, 2024

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 1 / 354
Chapter 1
Introductory Logic
Definition
A proposition (or statement) is a declarative sentence which has a truth value (either
True or False but not both).

Example
Identify the following sentences which are statement or not.
(a) 2 is an even number.
(b) A triangle has four sides.
(c) Athlete Haile G/silassie weighed 45 kg when he was 20 years old.
(d) May God bless you!
(e) Give me that book.
(f) What is your name?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 2 / 354
III Cont’d
Logical Connectives
(1) Conjunction: When two propositions are joined with the connective “and”, the
proposition formed is a logical conjunction.“and” is denoted by “∧”.
So, the logical conjunction of two propositions, p and q, is written: p ∧ q, read as “p
and q,” or “p conjunction q”. p and q are called the components of the conjunction.
Rule: p ∧ q is true if and only if p is true and q is true.

(2) Disjunction: When two propositions are joined with the connective “or”, the
proposition formed is called a logical disjunction. or is denoted by ∨.
So, the logical disjunction of two propositions, p and q, is written: p ∨ q read as “p
or q” or “p disjunction q.”
Rule: p ∨ q is false if and only if both p and q are false.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 3 / 354
III Cont’d
The truth table for conjunction and disjunction is given as follows:
p q p∧q p∨q
T T T T
T F F T
F T F T
F F F F

Example
Write the following propositions with the given statement and find the truth values for the
compound statement.
p: 3 is an odd number. (True) q: 27 is a prime number. (False)
r: Addis Ababa is the capital city of Ethiopia. (True)

(a) p ∨ q : ? and p ∨ q ≡? (b) p ∧ r :? and p ∧ r ≡?


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 4 / 354
III Cont’d

(3) Implication: When two propositions are joined with the connective “implies”, the
proposition formed is called a logical implication. “implies” is denoted by “ =⇒ ”.
So, the logical implication of two propositions, p and q, is written: p =⇒ q read as “p
implies q.” The function of the connective “implies” between two propositions is the
same as the use of “If · · · , then”. Thus, p =⇒ q can be read as if p, then q.
Rule: p =⇒ q is false if and only if p is true and q is false.

(4) Bi-implication: When two propositions are joined with the connective
bi-implication, the proposition formed is called a logical bi-implication or a
logical equivalence. A bi-implication is denoted by “ ⇐⇒ ”. So, the logical
bi-implication of two propositions, p and q, is written: p ⇐⇒ q.
Rule: p ⇐⇒ q is false if and only if p and q have different truth values.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 5 / 354
III Cont’d
The truth table for implication and bi-implication is given by:
p q p =⇒ q p ⇐⇒ q
T T T T
T F F F
F T T F
F F T T

Example
Let p: 2 is greater than 3. (False)
q: 5 is greater than 4. (True)
Then find the truth value and write the statements using the given words for the following
compound proposition.
a) p =⇒ q b) p ⇐⇒ q c) q =⇒ p
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 6 / 354
III Cont’d

(5) Negation: Given any proposition p, we can form the proposition ¬p called the
negation of p.
Rule: The truth value of ¬p is F if p is T and T if p is F.

We can describe the relation between p and ¬p as follows.


p ¬p
T F
F T

Example
Let p: Addis Ababa is the capital city of Ethiopia. (True)
¬p: Addis Ababa is not the capital city of Ethiopia. (False)

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 7 / 354
III Cont’d
Tautology, Contradiction and Logical Equivalence

Definition (Compound/Complex Proposition)


The proposition formed by joining two or more proposition by connective(s) is called a
compound/complex statement.

Definition (Tautology/Contradiction)
A compound proposition is a tautology if it is always true regardless of the truth values of
its component propositions. On the other hand, a compound proposition is always false
regardless of its component propositions, we say that such a proposition is a
contradiction.
Remark
A proposition that is neither a tautology nor a contradiction is called a contingency.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 8 / 354
III Cont’d
Definition
Two compound propositions P and Q are said to be equivalent if they have the same
truth value for all possible combinations of truth values for the component propositions
occurring in both P and Q. In this case, we write P ≡ Q.

Example
Let P : p =⇒ q
S : ¬p =⇒ ¬q
Q : ¬q =⇒ ¬p, then show that the pairs

(i) P and Q,

(ii) P and S,

(iii) Q and S are logically equivalent or not.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 9 / 354
III Cont’d
Quantified Propositions

Definition (Open Proposition)


An open statement (also called a predicate) is a sentence that contains one or more
variables and whose truth value depends on the values assigned for the variables. We
represent an open statement by a capital letter followed by the variable(s) in parenthesis,
e.g., P (x), Q(x), R(x, y), · · · etc.

Example
Here are some examples of open propositions:

(a) P (x) : x is the day before Sunday. (c) P (x, y) : x is greater than y.
(b) Q(y) : y is a city in Africa. (d) P (x) : x + 4 = −9.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 10 / 354
III Cont’d
Remark
The collection of all allowable values for the variable in an open sentence is called the
universal set (the universe of discourse) and denoted by U.

Quantifiers
(a) The phrase “for every x” is called universal quantifier. We regard “for every x”,
“for all x” and “for each x ” as having the same meaning and symbolize each by ∀x.
If P (x) is an open proposition with universe U, then (∀x)P (x) is a quantified
proposition and is read as every x ∈ U has the property P.

(b) The phrase “there exists an x” is called an existential quantifier. We regard “there
exists an x”, “for some x” and “for at least one x” as having the same meaning, and
symbolize each by (∃x). If P (x) is an open proposition with universe U, then (∃x)P (x)
is a quantified proposition and is read as there exists x ∈ U with the property P.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 11 / 354
III Cont’d

Remark
(1) To show that (∀x)P (x) is F, it is sufficient to find at least one a ∈ U such that P (a)
is F.

(2) (∃x)P (x) is F if we cannot find any a ∈ U having the property P.

Example
Write the following statements using quantifiers and find their truth values.
(a) For each real number x > 0, x2 + x − 6 = 0.
(b) There is a real number x > 0 such that x2 + x − 6 = 0.
(c) The square of any real number is nonnegative.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 12 / 354
III Cont’d
If P (x) is a formula in x, We might translate these into words as follows.
(∀x)P (x), everything has property P.
(∃x)P (x), something has property P.
(∀x)¬P (x), nothing has property P.
(∃x)¬P (x), something does not have property P.
Relationship between the existential and universal quantifiers:
¬(∀x)P (x) ≡ (∃x)¬P (x).

Exercise
Let U = the set of integers. Let P (x) : x is a prime number; Q(x) : x is an even number;
R(x) : x an odd number. Then find the truth value of the following.

(a) (∃x) [P (x) =⇒ Q(x)] (c) (∀x) [R(x) ∧ P (x) =⇒ Q(x)]


(b) (∀x) [P (x) =⇒ Q(x)] (d) (∀x) [R(x) ∧ P (x)]
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 13 / 354
III Cont’d

Quantifiers Occurring in Combinations

Let P (x, y) be an open proposition. The following are the simplest forms of
combinations of the two quantifiers:

1 (∀x)(∀y)P (x, y), for all x and for all y the relation P (x, y) holds.

2 (∃x)(∃y)P (x, y), there is an x and there is a y for which P (x, y) holds.

3 (∀x)(∃y)P (x, y), for every x and there exists a y for which P (x, y) holds. Here, the
choice of y is allowed to depend on x.

4 (∃y)(∀x)P (x, y), there is an x which stands to every y in the relation P (x, y) holds. The
y must work for all x, that is, y is independent of x.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 14 / 354
III Cont’d

Argument and Validity

Definition
An argument (logical deduction) is an assertion that a given set of statements
p1 , p2 , p3 , · · · , pn , called hypotheses or premises, yield another statement Q, called the
conclusion. Such a logical deduction is denoted by:

p1 , p2 , p3 , · · · , pn ` Q

Example
Consider the following argument:
If you study hard, then you will pass the exam; You did not pass the exam; Therefore, you
did not study hard.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 15 / 354
III Cont’d

Let p: you study hard.


q: you will pass the exam.

The argument form can be written as:


p =⇒ q, ¬q ` ¬p
or

p =⇒ q
¬q
¬p

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 16 / 354
III Cont’d
Definition
An argument form p1 , p2 , p3 , · · · , pn ` Q is said to be valid if Q is true whenever all the
premises p1 , p2 , p3 , · · · , pn are true; otherwise it is invalid.

Example
Investigate the validity of the following argument:
(a) p ⇒ q, ¬q ` ¬p.
(b) p ⇒ q, ¬q ⇒ r ` p.
(c) If it rains, crops will be good. It did not rain. Therefore, crops were not good.

Remark
The argument form p1 , p2 , p3 , · · · , pn ` Q iff (p1 ∧ p2 ∧ p3 ∧ · · · ∧ pn ) =⇒ Q is a tautology.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 17 / 354
III Cont’d

Rules of Inference

Below we list certain valid deductions called rules of inferences.

(1) Modes Ponens

p
p⇒q
q
(2) Modes Tollens

¬q
p⇒q
¬p
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 18 / 354
III Cont’d
(3) Principle of Syllogism
p⇒q
q⇒r
p⇒r
(4) Principle of Adjunction
i. p
q
p∧q
q
ii.
p∨q
(5) Principle of Detachment
p∧q
p, q
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 19 / 354
III Cont’d
(7) Modes Ponendo Tollens
¬(p ∧ q)
p
¬q
(8) Constructive Dilemma
(p ⇒ q) ∧ (r ⇒ s)
p∨r
q∨s
(9) Principle of Equivalence
p⇔q
p
q
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 20 / 354
III Cont’d
(10) Principle of Conditionalization
p
q⇒p

Example
Show that p ⇒ ¬q, q ` ¬p is valid.
Solution:

1. q is true premise
2. p ⇒ ¬q is true premise
3. q ⇒ ¬p is true contrapositive of (2)
4. ¬p is true Modes Ponens using (1) and (3)

Therefore, the argument p ⇒ ¬q, q ` ¬p is valid.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 21 / 354
III Cont’d
Methods of proof

Definition
A proof is a sequence of logical statements, one implying another, which gives an
explanation of why a given statement is true.

Direct Proofs
Direct proof assumes a given hypothesis, or any other known statement, and then logically
deduces a conclusion.

Example (Give a direct proof of the following statements)


(1) If n is an odd integer, then n2 is odd.
(2) If m and n are both perfect squares, then nm is also a perfect square.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 22 / 354
III Cont’d
Indirect Proofs (Proof by Contraposition)

Proofs that are not direct proofs, that is, that do not start with the premises and end
with the conclusion, are called indirect proofs.
An extremely useful type of indirect proof is known as proof by contraposition.

Example
Prove that if n is an integer and 3n + 2 is odd, then n is odd.

Proof.
Contrapositive: If n is even, then 3n + 2 is even.
Assume n is even: By definition, if n is even, we can express n = 2k for some k ∈ Z.
Claim: we want to show that 3n + 2 is even.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 23 / 354
III Cont’d
Now,
3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1).
This shows that 6k + 2 = 2(3k + 1) is even because it is expressed as 2× (an integer).
Since, we have shown that if n is even, then 3n + 2 is also even, we have proven the
contrapositive statement.
Thus, by proving the contrapositive, we conclude that if 3n + 2 is odd, then n must
be odd.
Exercise
Let n and m be integers. Then prove that
(a) if n and m are both even, then n + m is even.
(b) if n and m are both odd, then n + m is even.
(c) if one of n or m is even and the other is odd, then n + m is odd.
(d) if n2 is odd, then n is odd.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 24 / 354
III Cont’d
Proofs by Contradiction

Proof by Contradiction is a logical method of proving a statement by assuming


the negation of what you want to prove and showing that this assumption leads to a
contradiction.

Example
Give a proof by contradiction that “If 3n + 2 is odd, then n is odd.”

Proof.
To use proof by contradiction, we assume the negation of what we want to prove.
Thus, we assume: 3n + 2 is odd (this is our hypothesis) and n is even.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 25 / 354
III Cont’d

Since n is even, we can write:


n = 2k, for some k ∈ Z.
Now,
3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1).
This shows that 6k + 2 = 2(3k + 1) is even since it is a multiple of 2.

We have derived that 3n + 2 = 6k + 2 is even. However, our initial assumption states


that 3n + 2 is odd. This creates a contradiction because an integer cannot be both
odd and even at the same time.
Since our assumption that n is even leads to a contradiction, we conclude that our
assumption must be false. Therefore, if 3n + 2 is odd, it must be the case that n is
odd.
Thus, we have proven that “If 3n + 2 is odd, then n is odd.”
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 26 / 354
III Cont’d

Mathematical Induction

I One of the most powerful techniques in proving theorems or solving problems that
involves integers is the principle of mathematical induction.

Theorem (First Principle of Mathematical Induction)

If P (n) is an open statement on the set of positive integers such that

(a) p(1) is true.

(b) p(k) ⇒ p(k + 1). Then p(n) is true for every natural number n.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 27 / 354
III Cont’d
Example
Using mathematical induction to show that

n(2n + 1)(n + 1)
12 + 2 2 + 3 2 + · · · + n2 = , n ∈ N.
6

n(2n + 1)(n + 1)
Solution: p(n) : 12 + 22 + 32 + · · · + n2 =
6
1(2 + 1)(1 + 1)
(i) p(1) : 12 = = 1 ⇒ p(1) is true.
6
k(2k + 1)(k + 1)
(ii) Assume n = k ∈ N is true, that is, 12 + 22 + 32 + · · · + k 2 = .
6
We want to show that it is also true for n = k + 1, that is,
k(2k + 1)(k + 1)
12 + 22 + 32 + · · · + k 2 + (k + 1)2 = + (k + 1)2
6
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 28 / 354
III Cont’d

k(2k + 1)(k + 1) + 6(k + 1)2


=
6
(k + 1)[k(2k + 1) + 6(k + 1)]
=
6
(k + 1)(2k 2 + 7k + 6)
=
6
(k + 1)(2k 2 + 4k + 3k + 6)
=
6
(k + 1)(2k(k + 2) + 3(k + 2))
=
6
(k + 1)(2k + 3)(k + 2)
=
6
(k + 1)(2(k + 1) + 1)((k + 1) + 1)
=
6
which is also true for n = k + 1. Hence, it is true ∀n ∈ N.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 29 / 354
III Cont’d

Theorem (The Second Principle of Mathematical Induction)


Let S be a subset of N. If ∀n ∈ N, Sn ⊆ S ⇒ n ∈ S, then S = N.
I From this theorem, if S is a subset of N such that
(a) 1 ∈ S (b) ∀k ∈ N, k ∈ S ⇒ k + 1 ∈ S. Then S = N.

Example
Let S1 = 1, S2 = 3 and Sn+2 = 3Sn+1 − 2Sn . Show that Sn = 2n − 1.
Solution: Let S = {n : n ∈ N and Sn = 2n − 1}. We need to show that S = N.
Assume that, for each m < k, m ∈ S; that is, Sm = 2m − 1 for each m < k.
Then Sk = 3Sk−1 − 2Sk−2 = 3(2k−1 − 1) − 2(2k−2 − 1) = 2k − 1.
Thus, k ∈ S and N ⊆ S and S ⊆ N and the second principle of mathematical induction
implies that S = N.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 30 / 354
III Cont’d
Example
Let S1 = 1 and Sn+1 = Sn + (n + 1), ∀n ∈ N.
n(n+1)
Then, show that Sn = 2 , ∀n ∈N
Solution: Let S = {n : n ∈ N and Sn = n(n+1) 2 }. We need to show that S = N.
Assume that , for each m < k, m ∈ S, that is, Sm = m(m+1)
2 , m < k.
(k+1)(k+2) k(k+1)
Then Sk = Sk+1 − (k + 1) = 2 − (k + 1) = 2 .
Thus, k ∈ S ⇒ N ⊆ S and by second principle of mathematical induction S = N.

Exercise
For a fixed number a and r, r 6= 1 and any natural number n show that
1 − rn+1
 
Pn i
i=0 ar = a .
1−r
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 31 / 354
Chapter 2
Set Theory
Definition
A set is an unordered collection of objects, called elements or members of the set.
A set is said to contain its elements and we write a ∈ A to denote that a is an
element of the set A.

The notation a ∈
/ A denotes that a is not an element of the set A.

Description of Sets

Sets are described or characterized by one of the following four different ways.
(1) Verbal Method: In this method, an ordinary English statement with minimum
mathematical symbolization of the property of the elements is used to describe a set.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 32 / 354
III Cont’d
Example
(a) The set of counting numbers less than ten.
(b) The set of letters in the word “Addis Ababa.”
(c) The set of all countries in Africa.

(2) Roster(Complete Listing) Method: If the elements of a set can all be listed, we
list them all between a pair of braces without repetition separating by commas, and
without concern about the order of their appearance. Such a method of describing a
set is called the roster(complete listing) method.

Example
(a) The set of vowels in English alphabet described as S = {a, e, i, o, u}.
(b) The set of positive factors of 24 is described as S = {1, 2, 3, 4, 6, 8, 12, 24}.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 33 / 354
III Cont’d

(3) Partial Listing Method: In many occasions, the number of elements of a set may
be too large to list them all; and in other occasions there may not be an end to the
list. In such cases we describe the set by partially listing the first few elements, then
with in a pair of braces, we list these few elements followed (or preceded) by exactly
three dotes and possibly by one last element.
Example
(a) The set of all counting numbers is N = {1, 2, 3, 4, · · · }.

(b) The set of non-positive integers is B = {· · · , −4, −3, −2, −1, 0}.

(c) The set of multiples of 5 is A = {· · · , −15, −10, −5, 0, 5, 10, 15, · · · }

(d) The set of odd integers less than 100 is C = {· · · , −3, −1, 1, 3, 5, · · · , 99}.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 34 / 354
III Cont’d

(4) Set Builder Method: When all the elements satisfy a common property P, we
express the situation as an open proposition P (x) and describe the set using a method
called the Set-builder Method as follows: A = {x|P (x)} or A = {x : P (x)}.

Example
The following sets are described using the set-builder method.
(a) A = {x|x is a vowel in the English alphabet}.
(b) B = {t|t is an even integer}.
(c) C = {n|n is a natural number and 2n − 15 is negative}.
(d) D = {y|y 2 − y − 6 = 0}.
(e) E = {x|x is an integer and x − 1 < 0 ∧ x2 − 4 > 0}.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 35 / 354
III Cont’d

Definition
(1) The set which has no element is called the empty (or null) set and is denoted by ∅.

(2) Set B is said to be a subset of set A (or is contained in A), denoted by B ⊆ A, if


every element of B is an element of A, that is, (∀x)(x ∈ B =⇒ x ∈ A).

Example
If A = {a, b}, B = {a, b, c} and C = {a, b, d}, then A ⊆ B and A ⊆ C. On the other hand,
it is clear that, B * A, B * C and C * B.

Definition
Sets A and B are said to be equal if they contain exactly the same elements. In this case,
we write A = B. That is, (∀x)(x ∈ A ⇐⇒ x ∈ B) or A = B ⇐⇒ (A ⊆ B) ∧ (B ⊆ A).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 36 / 354
III Cont’d
Example
The sets {1, 2, 3}, {2, 1, 3}, {1, 3, 2} are all equal.

Definition
(1) Set A is said to be a proper subset of set B if every element of A is also an element
of B, but B has at least one element that is not in A. In this case, we write A ⊂ B. It
is clear that, A ⊂ B ⇐⇒ (∀x)(x ∈ A =⇒ x ∈ B) ∧ (A 6= B).
(2) Let A be a set. The power set of A, denoted by P(A), is the set whose elements are
all subsets of A. That is, P (A) = {B : B ⊆ A}.

Example
Let A = {x, y, z}. All possible subsets of A are: ∅, {x}, {y}, {z},{x, y}, {x, z}, {y, z} & A.
Therefore, P (A) = {∅, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, A}.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 37 / 354
III Cont’d
Set Operations

Definition
Let U be a universal set and A, B ⊆ U , we define the following:
(a) The union of A and B, A ∪ B = {x : x ∈ A ∨ x ∈ B}.
(b) The intersection of A and B, A ∩ B = {x : x ∈ A ∧ x ∈ B}.
(c) The symmetric difference of A and B,
A∆B = {x : (x ∈ A ∨ x ∈ B) ∧ x ∈
/ A ∩ B} = {x : x ∈ A ∪ B ∧ x ∈
/ A ∩ B}.
That is, A∆B = (A − B) ∪ (B − A).
(d) The difference (relative complement) of B in A, A − B = {x : x ∈ A ∧ x ∈
/ B}.
(e) The complement of A, Ac = A0 = A = {x : x ∈ U ∧ x ∈
/ A} = U − A.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 38 / 354
III Cont’d

Theorem
For any universe U and any sets A, B ⊆ U , each of the following holds.

(1) (A0 )0 = A.

(2) A0 = U − A.

(3) A − B = A ∩ B 0 .

(4) (A ∪ B)0 = A0 ∩ B 0 .

(5) (A ∩ B)0 = A0 ∪ B 0 .

(6) A ⊆ B ⇐⇒ B 0 ⊆ A0 .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 39 / 354
III Cont’d

Relations and Functions

Definition
For sets A, B ∈ U , the cartesian (cross) product of A and B is denoted by A × B and
A × B = {(a, b) : a ∈ A, b ∈ B}.

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 40 / 354
III Cont’d

Remark
In general, for finite sets A, B with |A| = m and |B| = n, there are 2mn relations
from A to B, including the empty relation as well as the relation A × B.

Example

Exercise
Let A = {1, 2, 3} and B = {w, x, y, z}. How many relations are there from A to B?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 41 / 354
III Cont’d

Equality of Ordered Pairs


Two ordered pairs (a, b) and (c, d) are equal if and only if and a = c and b = d.

Example
Let the order pairs (1, 2) and (x + y, y − x) are equal. Then, find the values of x and y.

Definition (Relation)
If A and B are sets, any subset < of A × B is called a relation from A into B.

Exercise
Let A = {1, 2, 3} and B = {2, 3}. Then, find any relation from A to B.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 42 / 354
III Cont’d
Definition
Let < be a relation from A into B. Then
(a) The domain of < , denoted by Dom(<) and Dom(<) = {a : a ∈ A ∧ (a, b) ∈ <}.
(b) The range of < , denoted by Range(<) and Range(<) = {b : b ∈ B ∧ (a, b) ∈ <}.

Definition (Function)
A function is a relation in which each element of the domain corresponds to exactly one
element of the range.
In other words, a relation < such that < : A → B is said to be a function if
(i) Dom(<) = A,
(ii) if (x, y) ∈ < and (x, z) ∈ <, then y = z. B is the co-domain of <, Range(<) ⊆ B.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 43 / 354
III Cont’d
Definition
One of the functions encountered in the study of data structures and the analysis of
algorithms is the greatest integer (or floor) function. This function f : R → Z, is given by

f (x) = bxc = the greatest integer less than or equal to x.

Consequently, f (x) = x if x ∈ Z and when x ∈ R − Z, f (x) is the integer to the immediate


left of x on the real number line.

Example
For this function, we find that

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 44 / 354
III Cont’d

Definition
The least (or ceiling) function, g : R → Z, is given by

g(x) = dxe = the least integer greater than or equal to x.

So, g(x) = x when x ∈ Z, but when x ∈ R − Z, then g(x) is the integer to the immediate
right of x on the real number line. In dealing with the ceiling function one finds that

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 45 / 354
III Cont’d

The function trunc (for truncation) is an integer-valued function defined on R. This


function deletes the fractional part of a real number.
Example
trunc(3.78)=3, trunc(5)= 5, trunc(7.22)= 7.

In storing a matrix in a one-dimensional array, the row major implementation.


Here, if A = (aij )n × n is an n × n matrix, the first row of A is stored in locations
1, 2, 3, · · · , n of the array if we start with a11 in the location 1.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 46 / 354
III Cont’d

The entry a21 is then found in position n + 1, while entry a34 occupies position 2n + 4
in the array.

In order to determine the location of any entry aij from A, where 1 ≤ i, j ≤ n, one
defines the access function f from the entries of A to the positions 1, 2, 3 · · · , n2 of
the array.

A formula for the access function f here is


f (aij ) = (i − 1)n + j.

The access function f for a matrix stored in a one-dimensional array in column


major implementation is
f (aij ) = (j − 1)m + i.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 47 / 354
III Cont’d
Example
Determine the access function f (aij ), for a matrix A = (aij )m × n stored in a
one-dimensional array in row major order, where
(a) m = 12, n = 12. Ans. f (aij ) = 12(i − 1) + j
(b) m = 7, n = 10. Ans. f (aij ) = 10(i − 1) + j
(c) m = 10, n = 7. Ans. f (aij ) = 7(i − 1) + j

For the general case, let A and B nonempty sets with |A| = m and |B| = n.
Consequently, if A = {a1 , a2 , · · · , am } and B = {b1 , b2 , · · · , bn }, then a typical
function f : A → B can be described by {(a1 , x1 ), (a2 , x2 ), · · · , (am , xm )}.
We can select any of the n elements of B for x1 and then do the same for x2 . We can
select any element of B for x2 so that the same element of B may be selected for both
x1 and x2 .
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 48 / 354
III Cont’d

We continue this selection process until one of the n elements of B is finally selected
for xm . In this way, using the rule of product, there are nm = |B||A| functions from A
to B.

Exercise
Let A = {1, 2, 3} and B = {w, x, y, z}. How many functions are there from A to B?

Remark
In general, we do not expect |A||B| to equal |B||A| . Unlike the situation for relations, we
cannot always obtain a function from B to A by simply interchanging the components in
the ordered pairs of a function from A to B.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 49 / 354
III Cont’d

Definition
A function f : A → B is called one-to-one (or injective), if each element of B appears at
most once as the image of an element of A.

If f : A → B is one-to-one, A, B finite, we must have |A| ≤ |B|. For arbitrary sets


A, B, if f : A → B is one-to-one, then for a1 , a2 ∈ A, f (a1 ) = f (a2 ) =⇒ a1 = a2 .

Exercise
(1) Consider the function f : R → R where f (x) = 3x + 7 for all x ∈ R. Determine
whether f is one-to-one or not?
(2) Suppose that g : R → R is the function defined by g(x) = x4 − x for each real number
x. Is g one-to-one?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 50 / 354
III Cont’d

Example

For this example, there are 215 relations from A to B and 53 of these are functions
from A to B. How many one-to-one functions are there?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 51 / 354
III Cont’d
With A = {a1 , a2 , · · · , am }, B = {b1 , b2 , · · · , bn }, and m ≤ n, a one-to-one function
f : A → B has the form {(a1 , x1 ), (a2 , x2 ), · · · , (am , xm )}, where there are n choices
for x1 (that is, any element of B), n − 1 choices for x2 (that is, any element of B
except the one chosen for x1 ), n − 2 choices for x3 , and so on, finishing with
n − (m − 1) = n − m + 1 choices for xm .
By the rule of product, the number of one-to-one functions from A to B is
n!
n(n − 1)(n − 2) · · · (n − m + 1) = = P (n, m) = P (|B|, |A|).
(n − m)!

Definition

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 52 / 354
III Cont’d

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 53 / 354
III Cont’d

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 54 / 354
III Cont’d
Theorem
Let f : A → B, with A1 , A2 ⊆ A. Then
(a) f (A1 ∪ A2 ) = f (A1 ) ∪ f (A2 ).
(b) f (A1 ∩ A2 ) ⊆ f (A1 ) ∩ f (A2 ).
(c) f (A1 ∩ A2 ) = f (A1 ) ∩ f (A2 ) when f is injective.

Proof.
(a) To show that f (A1 ∪ A2 ) = f (A1 ) ∪ f (A2 ) , we will prove this by showing that each
side is a subset of the other.
Step 1: Show that f (A1 ∪ A2 ) ⊆ f (A1 ) ∪ f (A2 ).
Let y ∈ f (A1 ∪ A2 ) . By the definition of the image of a set under a function f , there
exists some x ∈ A1 ∪ A2 such that f (x) = y .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 55 / 354
III Cont’d

Since x is in A1 ∪ A2 , it must be in either A1 or A2 (or both).


If x ∈ A1 , then f (x) ∈ f (A1 ). If x ∈ A2 , then f (x) ∈ f (A2 ).

In either case, we conclude that y = f (x) is in f (A1 ) ∪ f (A2 ).


Therefore, we have shown that:

f (A1 ∪ A2 ) ⊆ f (A1 ) ∪ f (A2 ). · · · · · · · · · · · · · · · · · · [1] .

Step 2: Show that f (A1 ) ∪ f (A2 ) ⊆ f (A1 ∪ A2 ). Now, let y ∈ f (A1 ) ∪ f (A2 ).

This means that either y ∈ f (A1 ) or y ∈ f (A2 ).

If y ∈ f (A1 ), then there exists some x1 ∈ A1 such that f (x1 ) = y.


Since x1 ∈ A1 ⊆ A1 ∪ A2 , it follows that y = f (x1 ) ∈ f (A1 ∪ A2 ).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 56 / 354
III Cont’d

If y ∈ f (A2 ), then there exists some x2 ∈ A2 such that f (x2 ) = y.

Similarly, since x2 ∈ A2 ⊆ A1 ∪ A2 , it follows that y = f (x2 ) ∈ f (A1 ∪ A2 ).

In either case, we conclude that:

f (A1 ) ∪ f (A2 ) ⊆ f (A1 ∪ A2 ). · · · · · · · · · · · · · · · · · · [2]

Combining both inclusions [1] and [2], we have:

f (A1 ∪ A2 ) = f (A1 ) ∪ f (A2 ).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 57 / 354
III Cont’d

(b) Let y ∈ f (A1 ∩ A2 ). By the definition of the image of a set under a function f , if
y ∈ f (A1 ∩ A2 ), then there exists some x ∈ A1 ∩ A2 such that f (x) = y.

Since x ∈ A1 ∩ A2 , it follows that x ∈ A1 and x ∈ A2 . From the fact that x ∈ A1 ,


we have: f (x) ∈ f (A1 ).

Similarly, since x ∈ A2 , we have: f (x) ∈ f (A2 ). Since f (x) = y, we can conclude that:
y ∈ f (A1 ) and y ∈ f (A2 ). This means that: y ∈ f (A1 ) ∩ f (A2 ).

Since our choice of y in f (A1 ∩ A2 ) was arbitrary, we have shown that every element
of f (A1 ∩ A2 ) is also in f (A1 ) ∩ f (A2 ).

Therefore, we conclude:
f (A1 ∩ A2 ) ⊆ f (A1 ) ∩ f (A2 ).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 58 / 354
III Cont’d

(c) To show that f (A1 ∩ A2 ) = f (A1 ) ∩ f (A2 ) when f is injective, we will prove this by
showing that each side is a subset of the other.

Step 1: Show that f (A1 ∩ A2 ) ⊆ f (A1 ) ∩ f (A2 ).

Let y ∈ f (A1 ∩ A2 ). By the definition of the image of a set under a function f , this
means there exists some x ∈ A1 ∩ A2 such that f (x) = y.

Since x ∈ A1 ∩ A2 , it follows that x ∈ A1 and x ∈ A2 . Therefore, Since x ∈ A1 , we


have f (x) ∈ f (A1 ) and x ∈ A2 , we have f (x) ∈ f (A2 ).

Thus, we conclude that y = f (x) ∈ f (A1 ) ∩ f (A2 ).

Therefore,
f (A1 ∩ A2 ) ⊆ f (A1 ) ∩ f (A2 ). · · · · · · · · · · · · · · · · · · [1]
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 59 / 354
III Cont’d

Step 2: Show that f (A1 ) ∩ f (A2 ) ⊆ f (A1 ∩ A2 ). Now, let y ∈ f (A1 ) ∩ f (A2 ).
This means that: There exists some x1 ∈ A1 such that f (x1 ) = y and x2 ∈ A2 such
that f (x2 ) = y. Since both x1 and x2 map to the same value y, and since f is
injective, it follows that x1 = x2 .
Let us denote this common value as x, so we have x = x1 = x2 . Since x ∈ A1 and
x ∈ A2 , it follows that x ∈ A1 ∩ A2 . Thus, we have shown that there exists some
x ∈ A1 ∩ A2 such that f (x) = y. Therefore, y = f (x) ∈ f (A1 ∩ A2 ).
This leads us to conclude that:
f (A1 ) ∩ f (A2 ) ⊆ f (A1 ∩ A2 ). · · · · · · · · · · · · · · · · · · [2]
Combining both inclusions [1] and [2], we have:
f (A1 ∩ A2 ) = f (A1 ) ∩ f (A2 ).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 60 / 354
III Cont’d
Definition

Definition

Example
For A = {1, 2, 3, 4, 5}, let f : A → R be defined by f = {(1, 10), (2, 13), (3, 16), (4, 19),
(5, 22)}. Let g : Q → R where g(q) = 3q + 7 for all q ∈ Q. Finally, let h : R → R with
h(r) = 3r + 7 for all r ∈ R.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 61 / 354
III Cont’d

I Then

(i) g is a extension of f (from A) to Q; (iv) f is the restriction of h (from R) to A;

(ii) f is the restriction of g (from Q) to A; (v) h is a extension of g (from Q) to R;

(iii) h is a extension of f (from A) to R; (vi) g is the restriction of h (from R) to Q.

Example
Let A = {w, x, y, z}, B = {1, 2, 3, 4, 5}, and A1 = {w, y, z}. Let f : A → B, g : A1 → B be
represented by the diagrams given below. Then g = f |A1 and f is an extension of g from
A1 to A. We note that for the given function g : A1 → B, there are five ways to extend g
from A1 to A.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 62 / 354
III Cont’d

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 63 / 354
III Cont’d

Definition
A function f : A → B is called onto (or surjective), if f (A) = B, that is, if for all b ∈ B
there is at least one a ∈ A with f (a) = b.

Example
Consider the function f : Z → Z where f (x) = 3x + 1 for any x ∈ Z. Here the range of
f = {· · · , −8, −5, −2, 1, 4, 7, · · · } ⊂ Z, so f is not an onto function.

We find that the integer 8, for example, is not in the range of f even though the equation
7
3x + 1 = 8 =⇒ x = 3 6= Z.

So, there is no x in the domain Z with f (x) = 8.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 64 / 354
III Cont’d

Example

For finite sets A, B with |A| = m and |B| = n, there are


m m n−2
n m n n n
2m + (−1)n−1 n
1m
    
n n − n−1 (n − 1) + n−2 (n − 2) − · · · + (−1) 2 1

= n−1 k n m
P 
k=0 (−1) n−k (n − k)

= nk=0 (−1)k n−kn


(n − k)m
P 

onto functions from A to B.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 65 / 354
III Cont’d

Example

Exercise
If |A| = m ≥ 2 and |B| = 2, then how many onto functions are there from A to B?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 66 / 354
III Cont’d

Special Functions

Definition

Definition

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 67 / 354
III Cont’d
Example

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 68 / 354
III Cont’d
Definition

Example
Define the closed binary operation f : Z × Z by f (a, b) = a + b − 3ab. Since both the
addition and the multiplication of integers are commutative binary operations, it follows
that

f (a, b) = a + b − 3ab = b + a − 3ba = f (b, a). So, f is commutative.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 69 / 354
III Cont’d

To determine whether f is associative, consider a, b, c ∈ Z. Then

Since f (f (a, b), c) = f (a, f (b, c)) for all a, b, c ∈ Z, the closed binary operation f is
associative as well as commutative.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 70 / 354
III Cont’d

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 71 / 354
III Cont’d
Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 72 / 354
III Cont’d

Definition

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 73 / 354
III Cont’d

Example

This binary operation is commutative and associative, and for any a ∈ A, we have
g(a, 7) = min{a, 7} = a = min{7, a} = g{7, a}. So, 7 is an identity element for g.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 74 / 354
III Cont’d

Theorem

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 75 / 354
III Cont’d
Remark

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 76 / 354
III Cont’d

Definition
For sets A and B, if D ⊆ A × B, then πA : D → A, defined by πA (a, b) = a, is called
the projection on the first coordinate.

The function πB : D → B defined by πB (a, b) = b, is called the projection on the


second coordinate.

Example
For A = B = Z, let D = {(x, y) : y = |x|}. Then D ⊆ A × B and D contains the origin
(0, 0) together with all points on the line y = x, where x, y ∈ Z and x > 0, and all points
on the line y = −x, where x, y ∈ Z and x < 0. A portion of the graph for D is shown in
part (a) of figure given below. Here, we find that
πA (D) = {· · · , −4, −3, −2, −1, 0, 1, 2, 3, 4, · · · } = Z and πB (D) = {0, 1, 2, 3, · · · } = N.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 77 / 354
III Cont’d

Next consider E = {(−4, 4), (−2, 2), (0, 0), (1, 1), (2, 3)}. Here, E ⊂ D ⊆ A × B; the
entire graph for E is shown in part (b) of the figure given below.
Now, we find that
πA (E) = {πA (−4, 4), πA (−2, 2), πA (0, 0), πA (1, 1), πA (2, 2)} = {−4, −2, 0, 1, 2}, and
πB (E) = {0, 1, 2, 4}.
Here, |πA (E)| = 5, while |πB (E)| = 4 because πB (−2, 2) = 2 = πB (2, 2).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 78 / 354
III Cont’d
Example

Example
Let A = B = R and consider the set D ⊆ A × B where = {(x, y}|y = x2 ). Then D
represents the subset of the Euclidean plane that contains the points on the parabola
y = x2 . Among the infinite number of points in D we find the point (3, 9). Here,
πA (3, 9) = 3, the x coordinate of (3, 9), whereas πB (3, 9) = 9, the y coordinate of the point.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 79 / 354
III Cont’d
For this example, πA (D) = R = A, so πA is onto. (The projection πA is also
one-to-one.) However, πB (D) = [0, ∞] ⊂ R, so πB is not onto. [Nor is it one-to- one,
for example, πB (2, 4) = 4 = πB (−2, 4).]

Function Composition and Inverse Functions

Definition
If f : A → B, then f is said to be bijective, or to be a one-to-one correspondence, if f is
both one-to-one and onto.

Example
If A = {1, 2, 3, 4} and B = {w, x, y, z}, then f = {(1, w), (2, x), (3, y), (4, z)} is a one-to-
one correspondence from A (on)to B, and g = {(w, 1), (x, 2), (y, 3), (z, 4)} is a one- to-one
correspondence from B (on)to A.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 80 / 354
III Cont’d

Definition
The function 1A : A → A defined by 1A (a) = a for all a ∈ A, is called the identity function
for A.

Definition
If f, g : A → B, we say that f and g are equal and write f = g, if f (a) = g(a) ,∀a ∈ A.

A common pitfall in dealing with the equality of functions occurs when f, g are
functions with a common domain A and f (a) = g(a) for all a ∈ A.
It may not be the case that f = g. The pitfall results from not paying attention to
the co-domains of the functions.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 81 / 354
III Cont’d
Example
Let f : Z → Z, g : Z → Q where f (x) = x = g(x), for all x ∈ Z. Then f , g share the
common domain Z, have the same range Z, and act the same on every element of Z.
Yet f 6= g! Here f is a one-to-one correspondence, whereas g is one-to-one but not onto;
so the co-domains do make a difference.

Example
Consider the functions f, g : R → Z defined as follows:
(
x, if x ∈ Z
f (x) =
bxc + 1, if x ∈ R − Z, g(x) = dxe, ∀x ∈ R.

If x ∈ Z, then f (x) = x = dxe = g(x).


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 82 / 354
III Cont’d

For x ∈ R − Z, we write x = n + r where n ∈ Z and 0 < r < 1. For example, x = 2.3,


we write 2.3 = 2 + 0.3, with n = 2 and r = 0.3; for x = −7.3, we have
−7.3 = −8 + 0.7, with n = −8 and r = 0.7. Then

f (x) = bxc + 1 = n + 1 = dxe = g(x).

Consequently, even though the functions f , g are defined by different formulas, we


realize that they are the same function because they have the same domain and
codomain and f (x) = g(x) for all x in the domain R.

Definition
If f : A → B and g : B → C, we define the composite function, which is denoted
g ◦ f : A → C, by (g ◦ f )(a) = g(f (a)), for each a ∈ A.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 83 / 354
III Cont’d
Example

So, g ◦ f = {(1, x), (2, x), (3, y), (4, z)}.

Example
Let f : R → R, g : R → R be defined by f (x) = x2 , g(x) = x + 5. Then
(g ◦ f )(x) = g(f (x)) = g(x2 ) = x2 + 5,
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 84 / 354
III Cont’d
whereas
(f ◦ g)(x) = f (g(x)) = f (x + 5) = (x + 5)2 = x2 + 10x + 25.

Here g ◦ f : R → R and f ◦ g : R → R, but (g ◦ f )(1) = 6 6= 36 = (f ◦ g)(1), so even


though both composites f ◦ g and g ◦ f can be formed, we do not have f ◦ g = g ◦ f .
Consequently, the composition of functions is not, in general, a commutative
operation.

Remark
The definition and examples for composite functions required that the codomain of f =
domain of g. If range of f ⊆ domain of g, this will actually be enough to yield the
composite function g ◦ f : A → C. Also, for any f : A → B, we observe that
f ◦ 1A = f = 1B ◦ f.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 85 / 354
III Cont’d
Theorem
Let f : A → B and g : B → C.
(a) If f , g are one-to-one, then g ◦ f is one-to-one.
(b) If f , g are onto, then g ◦ f is onto.

Proof.
(a) To prove that g ◦ f : A → C is one-to-one, let a1 , a2 ∈ A with
(g ◦ f )(a1 ) = (g ◦ f )(a2 ). Then (g ◦ f )(a1 ) = (g ◦ f )(a2 ) =⇒ g(f (a1 )) = g(f (a2 ))
=⇒ f (a1 ) = f (a2 ), because g is one-to-one. Also, f (a1 ) = f (a2 ) =⇒ a1 = a2 , because
f is one-to-one. Consequently, g ◦ f is one-to-one.
(b) For g ◦ f : A → C, let z ∈ C. Since g is onto, there exists y ∈ B with g(y) = z. With
f onto, there exists x ∈ A with f (x) = y. Hence, z = g(y) = g(f (x) = (g ◦ f )(x), so
the range of g ◦ f = C = the codomain of g ◦ f , and g ◦ f is onto.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 86 / 354
III Cont’d
Theorem
If f : A → B, g : B → C, and h : C → D, then (h ◦ g) ◦ f = h ◦ (g ◦ f ).

Proof.
Using the definition of the composite function, we find that ((h ◦ g) ◦ f )(x) = (h ◦ g)(f (x))
= h(g(f (x))), whereas (h ◦ (g ◦ f ))(x) = h ◦ ((g ◦ f )(x)) = h(g(f (x))). Consequently, the
composition of functions is an associative operation.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 87 / 354
III Cont’d
Definition
If f : A → A, we define f 1 = f , and for n ∈ Z, f n+1 = f ◦ (f n ).

Example

Definition

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 88 / 354
III Cont’d

Definition

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 89 / 354
III Cont’d

Theorem
If a function f : A → B is invertible and a function g : B → A satisfies g ◦ f = 1A and
f ◦ g = 1B , then this function g is unique.

Proof.
If g is not unique, then there is another function h : B → A with h ◦ f = 1A and
f ◦ h = 1B . Consequently, h = h ◦ 1B = h ◦ (f ◦ g) = (h ◦ g) ◦ f = 1A ◦ g = g.

Theorem
A function f : A → B is invertible if and only if it is one-to-one and onto.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 90 / 354
III Cont’d
Proof.
(⇒) Assuming that f : A → B is invertible, we have a unique function g : B → A with
g ◦ f = 1A , f ◦ b = 1B . If a1 , a2 ∈ A with f (a1 ) = f (a2 ), then g(f (a1 )) = g(f (a2 )), or
(g ◦ f )(a1 ) = (g ◦ f )(a2 ). With g ◦ f = 1A it follows that a1 = a2 , so f is one-to-one.
For the onto property, let b ∈ B. Then g(b) ∈ A, so we can talk about f (g(b)). Since
f ◦ g = 1B , we have b = 1B (b) = (f ◦ g)(b) = f (g(b), so f is onto.

(⇐) Suppose f : A → B is bijective. Since f is onto, for each b ∈ B there is an a ∈ A with


f (a) = b. Consequently, we define the function g : B → A by g(b) = a, where
f (a) = b. This definition yields a unique function. The only problem that could arise
is if g(b) = a1 6= a2 = g(b) because f (a1 ) = b = f (a2 ). However, this situation cannot
arise because f is one-to-one. Our definition of g is such that g ◦ f = 1B , so we can
find that f is invertible, with g = f −1 .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 91 / 354
III Cont’d

Theorem
If f : A → B, g : B → C are invertible functions, then g ◦ f : A → C is invertible and
(g ◦ f )−1 = f −1 ◦ g −1 .

Example
For m.b ∈ R, m 6= 0, the function f : R → R defined by f − {(x, y)|y = mx + b} is an
invertible function, because it is one-to-one and onto. To get f −1 , we note that

f −1 = {(x, y)|y = mx + b}c = {(y, x)|y = mx + b}


1
= {(x, y)|x = my + b} = {(x, y)|y = m (x − b)}

So, f : R → R is defined by f (x) = mx + b, and f −1 : R → R is defined by


f −1 (x) = m
1
(x − b).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 92 / 354
III Cont’d

Exercise
Let f : R → R+ be defined by f (x) = ex . Show that f is bijective and find f −1 (x).

Definition
If f : A → B and B − 1 ⊆ B, then f −1 (B1 ) = {x ∈ A|f (x) ∈ B1 }. The set f −1 (B1 ) is
called the pre-image of B1 under f .

Example
Let f : R → R be defined by
(
3x − 5, if x > 0
f (x) =
−3x + 1, if x ≤ 0.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 93 / 354
III Cont’d
(a) Determine f (0), f (1), f (−1), f (5/3), f (−5/3), f (2) and f (−2).
(b) Find f −1 (0), f −1 (1), f −1 (−1), f −1 (2), f −1 (−2), f −1 (3), f −1 (−3) and f −1 (−6).
(c) What are f −1 ([−5, 5]) and f −1 ([−6, 5])?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 94 / 354
III Cont’d

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 95 / 354
III Cont’d

Equivalence Relations

Definition

(a) A relation < on a set A is called reflexive if (x, x) ∈ <, ∀x ∈ A.

(b) A relation < on a set A is called symmetric if (x, y) ∈ < ⇒ (y, x) ∈ <, ∀x, y ∈ A.

(c) A relation < on a set A is called transitive if (x, y), (y, z) ∈ < ⇒ (x, z) ∈ <,
∀x, y, z ∈ A.

(d) A relation < on a set A is called antisymmetric if (x, y) ∈ < and (y, x) ∈ <, then
x = y, for all x, y ∈ A.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 96 / 354
III Cont’d
Example

Example
If A = {1, 2, 3, 4)}, then <1 = {(1, 1), (2, 3), (3, 4), (2, 4)} is a transitive relation on A,
whereas <2 = {(1, 3), (3, 2)} is not transitive because (1, 3), (3, 2) ∈ <2 but (1, 2) 6∈ <2 .
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 97 / 354
III Cont’d

Exercise
Consider the relation on the set Z, where <1 = {(a, b)|ab ≥ 0, a, b ∈ Z} and
<2 = {(a, b)|a = b or a = −b}. Determine <1 and <2 are wether reflexive, symmetric,
transitive, antisymmetric or not.

Definition
A relation < on a set A is called an equivalence relation if it is reflexive, symmetric, and
transitive.

Example
Let < be the relation on the set of real numbers such that a<b if and only if a − b is an
integer. Is < an equivalence relation?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 98 / 354
III Cont’d

Solution: Because a − a = 0 is an integer for all real numbers a ∈ R, a<a for all real
numbers a. Hence, < is reflexive.

Now suppose that a<b. Then a − b is an integer, so b − a is also an integer. Hence,


b<a. It follows that < is symmetric.

If a<b and b<c, then a − b and b − c are integers. Therefore, a − c = (a − b) + (b − c)


is also an integer. Hence, a<c. Thus, < is transitive.

Consequently, < is an equivalence relation.

Example (Congruence Modulo m)


Let m be an integer with m > 1. Show that the relation < = {(a, b)|a ≡ b(mod m)} is an
equivalence relation on the set of integers.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 99 / 354
III Cont’d

Note that a ≡ b(mod m) if and only if m divides a − b.


Note that a − a = 0 is divisible by m, because 0 = 0.m. Hence, a ≡ a(mod m), so
congruence modulo m is reflexive.
Now suppose that a ≡ b(mod m). Then a − b is divisible by m, so a − b = km, where
k is an integer. It follows that b − a = (−k)m, so b ≡ a(mod m). Hence, congruence
modulo m is symmetric.
Next, suppose that a ≡ b(mod m) and b ≡ c(mod m). Then m divides both a − b and
b − c. Therefore, there are integers k and l with a − b = km and b − c = lm.
Adding these two equations shows that a − c = (a − b) + (b − c) = km + lm = (k + l)m.
Thus, a ≡ c(mod m). Therefore, congruence modulo m is transitive. It follows that
congruence modulo m is an equivalence relation.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 100 / 354
III Cont’d
Example

Exercise
Let A = {1, 2, 3, 4, 5, 6, 7}, B = {x, y, z}, and f : A → B be the onto function
f = {(1, x), (2, z), (3, x), (4, y), (5, z), (6, y), (7, x)}.
Define an equivalence relation < on A by a<b if f (a) = f (b).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 101 / 354
III Cont’d

Equivalence Classes and Partitions

Definition
Given a set A and an index set I, let ∅ =
6 Ai ⊆ A for each i ∈ I. Then {Ai }i∈I , is a
partition of A if
S
(a) A = i∈I Ai

(b) Ai ∩ Aj = ∅, for all i, j ∈ I, where i 6= j.

Each subset Ai is called a cell or block of the partition.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 102 / 354
III Cont’d
Example

Example
Let A = R, and for each i ∈ Z, let Ai = [i, i + 1]. Then {Ai }i∈Z is a partition of R.

Definition
Let < be an equivalence relation on a set A. For any x ∈ A, the equivalence class of x,
denoted [x], is defined by [x] = {y ∈ A | y<x}.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 103 / 354
III Cont’d

Example
Define the relation < on Z by x<y if 4 | (x − y). For this equivalence relation we find that

In addition, we have, for example, [6] = [2] = [−2] , [51] = [3], and [17] = [1]. Most
important, {[0] , [1] , [2] , [3]} provides a partition of Z.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 104 / 354
III Cont’d
Theorem
If < is an equivalence relation on a set A, and x, y ∈ A, then

(a) x ∈ [x]

(b) x<y if and only if [x] = [y]

(c) [x] = [y] or [x] ∩ [y] = ∅.

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 105 / 354
III Cont’d
Partially Ordered Sets

Definition
A relation < on a set S is called a partial ordering or partial order if it is reflexive,
antisymmetric, and transitive. A set S together with a partial ordering < is called a
partially ordered set, or poset, and is denoted by (S, <). Members of S are called elements
of the poset.

Example
Show that the “greater than or equal” relation (≥) is a partial ordering on the set of
integers.

Solution: Because a ≥ a for every integer a, ≥ is reflexive. If a ≥ b and b ≥ a, then


a = b. Hence, ≥ is antisymmetric.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 106 / 354
III Cont’d

Finally, ≥ is transitive because a ≥ b and b ≥ c ⇒ a ≥ c. It follows that ≥ is a partial


ordering on the set of integers and (Z, ≥) is a poset.

Definition
The elements a and b of a poset (S, ) are called comparable if either a  b or b  a.
When a and b are elements of S such that neither a  b nor b  a, a and b are called
incomparable.

Example
In the poset (Z+ , |), are the integers 3 and 9 comparable? Are 5 and 7 comparable?
Solution: The integers 3 and 9 are comparable, because 3 | 9. The integers 5 and 7 are
incomparable, because 5 - 7 and 7 - 5.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 107 / 354
III Cont’d

Definition
If (S, ) is a poset and every two elements of S are comparable, S is called a totally
ordered or linearly ordered set, and  is called a total order or a linear order. A totally
ordered set is also called a chain.

Example
(1) The poset (Z, ≤) is totally ordered, because a ≤ b or b ≤ a, for all a, b ∈ Z.
(2) The poset (Z+ , |) is not totally ordered because it contains elements that are
incomparable.

Definition
(S, ) is a well-ordered set if it is a poset such that  is a total ordering and every
nonempty subset of S has a least element.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 108 / 354
III Cont’d
Hasse Diagrams

To construct a Hasse diagram for a poset (S, ):


(1) Construct a digraph representation of the poset (S, ) so that all arcs point up
(except the loops).
(2) Eliminate all loops.
(3) Eliminate all arcs that are redundant because of transitivity.
(4) Eliminate the arrows on the arcs.

Example
(1) Draw the Hasse diagram representing the partial ordering {(a, b) | a divides b} on
S = {1, 2, 3, 4, 6, 8, 12}.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 109 / 354
III Cont’d

(2) Draw the Hasse diagram for the partial ordering {(A, B) | A ⊆ B} on the power set
P (S) where S = {a, b, c}.

Solution

(1) Begin with the digraph for this partial order, as shown in the figure (a). Remove all
loops, as shown in figure (b). Then delete all the edges implied by the transitive
property.

These are (1, 4), (1, 6), (1, 8), (1, 12), (2, 8), (2, 12), and (3, 12). Arrange all edges to
point upward, and delete all arrows to obtain the Hasse diagram. The resulting Hasse
diagram is shown in figure (c).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 110 / 354
III Cont’d

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 111 / 354
III Cont’d

Definition
If (A, ∼) is a poset, then an element x ∈ A is called a maximal element of A if for all
a ∈ A, a 6= x =⇒ x  a.

An element y ∈ A is called a minimal element of A if b ∈ A and b 6= y, then b  y.

Definition
If (A, ∼) is a poset, then an element x ∈ A is called a least element if x ∼ a ∀a ∈ A.

Element y ∈ A is called a greatest element if a ∼ y for all a ∈ A. If the poset (A, ∼) has
a greatest (least) element, then that element is unique.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 112 / 354
III Cont’d

Maximal and minimal elements are easy to spot using a Hasse diagram. They are the
“top” and “bottom” elements in the diagram.

Example
Which elements of the poset ({2, 4, 5, 10, 12, 20, 25}, |) are maximal, and which are
minimal?

Solution: The Hasse diagram for this poset shows that the maximal elements are 12, 20,
and 25, and the minimal elements are 2 and 5.
As this example shows, a poset can have more than one maximal element and more than
one minimal element.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 113 / 354
III Cont’d

Example
Draw the Hasse diagram for the partial ordering {(A, B) | A ⊆ B} on the power set P (S)
where S = {a, b, c}. Determine whether there is a greatest element and a least element in
the poset (P (S), ⊆).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 114 / 354
III Cont’d
Solution: The Hasse diagram for this partial ordering is obtained from the associated
digraph by deleting all the loops and all the edges that occur from transitivity, namely,
(∅, {a, b}), (∅, {a, c}), (∅, {b, c}), (∅, {a, b, c}), ({a}, {a, b, c}), ({b}, {a, b, c}), and
({c}, {a, b, c}). Finally all edges point upward, and arrows are deleted. The resulting
Hasse diagram is illustrated in the following figure.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 115 / 354
III Cont’d

The least element is the empty set, because ∅ ⊆ B for any subset B of S. The set S is the
greatest element in this poset, because A ⊆ S whenever A is a subset of S.

Definition

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 116 / 354
III Cont’d
Example

Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 117 / 354
III Cont’d

Definition
The poset (A, <) is called a lattice if for any x, y ∈ A the elements lub{x, y} and glb{x, y}
both exist in A.

Example
(1) For A = N and x, y ∈ N, define x<y by x ≤ y. Then lub{x, y} = max{x, y},
glb{x, y} = min{x, y} and (N, ≤) is a lattice.

(2) Let A = {2, 3, 5, 6, 7, 11, 12, 35, 385} and x, y ∈ A, define x<y by the “(exactly)
divides” relation. So, (A, |) is a poset. The Hasse diagram is given below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 118 / 354
III Cont’d

Here, we find, for example, that lub{2, 3} = 6, lub{3, 6} = 6, lub{5, 7} = 35,


lub{7, 11} = 385, lub{11, 35} = 385, & glb{3, 6} = 3, glb{2, 12} = 2, glb{35, 385} = 35.

However, even though lub{2, 3} exists, there is no glb for the elements 2 and 3. In
addition, we are also lacking (among other considerations) glb{5, 7}, glb{11, 35},
glb{3, 35}, and lub{3, 35}. Consequently, this partial order is not a lattice.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 119 / 354
III Cont’d
Introduction to Boolean Algebra

Boolean algebra provides the operations and the rules for working with the set B = {0, 1}.
Electronic and optical switches can be studied using this set and the rules of Boolean
algebra.
The three operations in Boolean algebra that we will use most are complementation, the
Boolean sum, and the Boolean product.
The complement of an element, denoted with a bar, is defined by 0 = 1 and 1 = 0. The
Boolean sum, denoted by “ + ” or by OR, has the following values:
1 + 1 = 1, 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0.
The Boolean product, denoted by “.” or by AND, has the following values:
1.1 = 1, 1.0 = 0, 0.1 = 0, 0.0 = 0.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 120 / 354
III Cont’d

When there is no danger of confusion, the symbol “.” can be deleted, just as in
writing algebraic products. Unless parentheses are used, the rules of precedence for
Boolean operators are: first, all complements are computed, followed by all Boolean
products, followed by all Boolean sums.

Example
Find the value of 1.0 + (0 + 1).

Solution: Using the definitions of complementation, the Boolean sum, and the Boolean
product, it follows that

1.0 + (0 + 1) = 0 + 1 = 0 + 0 = 0.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 121 / 354
III Cont’d

Remark
The complement, Boolean sum, and Boolean product correspond to the logical operators,
¬, ∨, and ∧, respectively, where 0 corresponds to F(false) and 1 corresponds to T(true).
Equalities in Boolean algebra can be directly translated into equivalences of compound
propositions. Conversely, equivalences of compound propositions can be translated into
equalities in Boolean algebra.

Example
Translate 1.0 + (0 + 1) = 0 into a logical equivalence.

Solution: We obtain a logical equivalence when we translate each 1 into a T, each 0 into
an F, each Boolean sum into a disjunction, each Boolean product into a conjunction, and
each complementation into a negation.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 122 / 354
III Cont’d

We obtain

(T ∧ F ) ∨ ¬(T ∨ F ) ≡ F .

Exercise
Translate the logical equivalence (T ∧ T ) ∨ ¬F ≡ T into an identity in Boolean algebra.

Boolean Expressions and Boolean Functions

Let B = {0, 1}. Then B n = {(x1 , x2 , · · · , xn ) | xi ∈ B for 1 ≤ i ≤ n} is the set of all


possible n-tuples of 0s and 1s. The variable x is called a Boolean variable if it assumes
values only from B, that is, if its only possible values are 0 and 1. A function f : B n → B
is called a Boolean function of degree n.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 123 / 354
III Cont’d

Example
The function F (x, y) = xy from the set of ordered pairs of Boolean variables to the set
B = {0, 1} is a Boolean function of degree 2 with F (1, 1) = 0, F (1, 0) = 1, F (0, 1) = 0, and
F (0, 0) = 0. We display these values of F in table form as follows.

Boolean functions can be represented using expressions made up from variables and
Boolean operations. The Boolean expressions in the variables x1 , x2 , · · · , xn are defined
recursively as 0, 1, x1 , x2 , · · · , xn are Boolean expressions.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 124 / 354
III Cont’d
If E1 and E2 are Boolean expressions, then E1 , (E1 E2 ), and (E1 + E2 ) are Boolean
expressions. Each Boolean expression represents a Boolean function. The values of this
function are obtained by substituting 0 and 1 for the variables in the expression.
Example
Find the values of the Boolean function represented by F (x, y, z) = xy + z.

Solution: The values of this function are displayed below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 125 / 354
III Cont’d

Definition
For n ∈ Z+ , n ≥ 2, let f, g : B n → B be two Boolean functions of the n Boolean variables.
We say that f and g are equal iff f (x1 , x2 , · · · , xn ) = g(x1 , x2 , · · · , xn ).

Definition
If f : B n → B, then the complement of f , denoted by f , is the Boolean function defined on
B n by

f (x1 , x2 , · · · , xn ) = f (x1 , x2 , · · · , xn ).

If g : B n → B, we define f + g, f.g : B n → B, the sum and product of f, g, respectively, by

(f + g)(x1 , x2 , · · · , xn ) = f (x1 , x2 , · · · , xn ) + g(x1 , x2 , · · · , xn )


(f g)(x1 , x2 , · · · , xn ) = f (x1 , x2 , · · · , xn ).g(x1 , x2 , · · · , xn ).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 126 / 354
III Cont’d

Boolean Identities

(1) f = f x=x Law of the double complement.


(2) f + f = f x+x=x Idempotent laws
f.f = f x.x = x
(3) f + 0 = f x+0=x Identity laws
f.1 = f x.1 = x
(4) f + 1 = 1 x+1=1 Domination laws
f.0 = 0 x.0 = 0
(5) f + g = g + f x+y =y+x Commutative laws
f g = gf xy = yx
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 127 / 354
III Cont’d

(6) f + (g + h) = (f + g) + h x + (y + z) = (x + y) + z Associative laws


f (gh) = (f g)h x(yz) = (xy)z

(7) f + gh = (f + g)(f + h) x + yz = (x + y)(x + z) Distributive laws


f (g + h) = f g + f h x(y + z) = xy + xz

(8) f + g = f g x+y =xy DeMorgan’s laws


fg = f + g xy = x + y

(9) f + f g = f x + xy = x Absorption laws


f (f + g) = f x(x + y) = x

(10) f + f = 1 x+x=1 Inverse laws


ff = 0 xx=0

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 128 / 354
III Cont’d

Example
Prove the absorption law x(x + y) = x. (This is called an absorption law because absorbing
x + y into x leaves x unchanged.)

Solution

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 129 / 354
III Cont’d

Duality

The dual of a Boolean expression is obtained by interchanging Boolean sums and Boolean
products and interchanging 0s and 1s.
Example
Find the duals of x(y + 0) and x.1 + (y + z).

Solution: Interchanging “.” signs and “+” signs and interchanging 0s and 1s in these
expressions produces their duals. The duals are x + (y.1) and (x + 0)(yz), respectively.

Exercise
Construct an identity from the absorption law x(x + y) = x by taking duals.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 130 / 354
III Cont’d

Definition
For any n ∈ Z, if f is a Boolean function on the n variables x1 , x2 , · · · , xn , we call

(a) each term xi or its complement xi , for 1 ≤ i ≤ n, a literal;

(b) a term of the form y1 y2 · · · yn , where each yi = xi , or yi = xi , for 1 ≤ i ≤ n, a


fundamental conjunction (minterm). Hence, a minterm is a product of n literals, with
one literal for each variable.

(c) a representation of f as a sum of fundamental conjunctions a disjunctive normal


form (d.n.f.) of f .

(d) a representation of f as a product of fundamental disjunction a conjunctive normal


form (c.n.f.) of f .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 131 / 354
III Cont’d
Example

Exercise
Find the d.n.f. for f : B 3 → B, where f (x, y, z) = xy + xz.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 132 / 354
III Cont’d
Example

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 133 / 354
III Cont’d
Logic Gates

Boolean algebra is used to model the circuitry of electronic devices. Each input and each
output of such a device can be thought of as a member of the set B = {0, 1}.
A computer, or other electronic device, is made up of a number of circuits. Each circuit
can be designed using the rules of Boolean algebra.
A NOT Gate (Inverter)
A NOT gate receives input x, where x is a bit (binary digit) and produces output x where
(
1, if x = 0
x=
0, if x = 1.

The output state is always the opposite of the input state. The output is sometimes called
the complement of the input.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 134 / 354
III Cont’d
An AND Gate

An AND gate receives inputs x and y, where x and y are bits and produces output
(x ∧ y), where (
1, if x = y = 1
(x ∧ y) =
0, otherwise.
An AND gate may have more inputs also but the output is always one.
An OR Gate
An OR gate receives inputs x and y, where x and y are bits, and produces output
(x ∨ y), where
(
1, if x = 1 or y = 1
(x ∨ y) =
0, otherwise.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 135 / 354
III Cont’d

An OR gate may have more inputs also but the output is always one.

Figure: Basic Types of Gates

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 136 / 354
III Cont’d
We will permit multiple inputs to AND and OR gates. The inputs to each of these
gates are shown on the left side entering the element, and the output is shown on the
right side.

Combinations of Gates
Combinational circuits can be constructed using a combination of inverters, OR
gates, and AND gates. When combinations of circuits are formed, some gates may
share inputs. This is shown in one of two ways in depictions of circuits. One method
is to use branchings that indicate all the gates that use a given input. The other
method is to indicate this input separately for each gate.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 137 / 354
III Cont’d

Example
Construct circuits that produce the following outputs:
(a) (x + y)x
(b) x (y + z)
(c) (x + y + z)(x y z).
Solution:

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 138 / 354
III Cont’d

Example
A committee of three individuals decides issues for an organization. Each individual votes
either yes or no for each proposal that arises. A proposal is passed if it receives at least
two yes votes. Design a circuit that determines whether a proposal passes.

Solution:
Let x = 1 if the first individual votes yes, and x = 0 if this individual votes no; let y = 1 if
the second individual votes yes, and y = 0 if this individual votes no; let z = 1 if the third
individual votes yes, and z = 0 if this individual votes no.
Then a circuit must be designed that produces the output 1 from the inputs x, y, and z
when two or more of x, y, and z are 1. One representation of the Boolean function that
has these output values is xy + xz + yz. The circuit that implements this function is
shown below.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 139 / 354
III Cont’d

Exercise
Sometimes light fixtures are controlled by more than one switch. Circuits need to be
designed so that flipping any one of the switches for the fixture turns the light on when it
is off and turns the light off when it is on. Design circuits that accomplish this when there
are two switches and when there are three switches.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 140 / 354
Chapter 3
Counting Methods
Introduction

Discrete mathematics is the study of mathematical structures that are fundamentally


discrete rather than continuous.
Combinatorics is a fascinating branch of discrete Mathematics, which deals with the
art of counting.
Combinatorics studies the way in which discrete structures can be combined or
arranged.
Enumerative combinatorics concentrates on counting the number of certain
combinatorial objects.
Graph theory, the study of graphs & networks is considered part of combinatorics.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 141 / 354
III Cont’d

Graphs are one of the prime objects of study in discrete mathematics.

Addition Principle
Let A and B be two mutually exclusive tasks. Suppose task A can be done in m ways and
task B in n ways. Then there are n + m ways to do one of these tasks.

Example
Suppose that either a member of the mathematics department or a student who is
mathematics major is chosen as a representative to a university committee.
How many different choices are there for this representative if there are 37 members of the
mathematics department and 83 mathematics majors?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 142 / 354
...Cont’d
Solution:
Let A be the task, choosing a member of the mathematics department, can be done
in 37 ways.
Let B be the task, choosing mathematics major, can be done in 83 ways.
From the sum (addition) rule, it follows that there are 37 + 83 = 120 possible ways to
pick this representative.
Let T1 , T2 , T3 , ..., Tn be n pair wise mutually exclusive tasks. Suppose task Ti can be
done in mi ways, where 1 ≤ i ≤ n.
Then task T1 , T2 , T3 , ..., Tn can be done in m1 + m2 + ... + mn ways.
Example
A student can choose a computer project from one of three lists. The three lists contain
23, 15 and 19 possible projects, respectively. How many possible projects are there to
choose from?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 143 / 354
...Cont’d
Solution: Let A, B and C be the first, second and third lists respectively and the list can
be done 23, 15 and 19 ways respectively.
Hence, there are 23 + 15 + 19 = 57 projects to choose from.
The sum can be phrased in terms of sets as: if A1 , A2 , ..., An are disjoint sets, then
the number of elements in the union of these sets is the sum of the number of
elements in them.
To relate this to our statement of the sum rule, let Ti be the task of choosing an
element from Ai for i = 1, 2, ..., n.
There are |Ai |(|Ai | is the notation for the cardinality of 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, which is the number of
elements in the union is
|A1 ∪ A2 ∪ ... ∪ An | = |A1 | + |A2 | + ... + |An |.
This equality applies only when the sets in question are disjoint.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 144 / 354
...Cont’d

The Inclusion-Exclusion Principle


When two tasks can be done at the same time, we can not use the sum (addition)
rule to count the number of ways to do one of the two tasks.
Adding the number of ways to do each task leads to an over count, since the ways to
do both tasks are counted twice.

Theorem (Inclusion-Exclusion Principle)


Suppose a task A can be done in m ways, task B in n ways and both can be accomplished
in k different ways. Then task A or B can be done in m + n − k.
We can phrase this counting principle in terms of sets.
Let A and B be two finite sets. Then
|A ∪ B| = |A| + |B| − |A ∩ B|.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 145 / 354
...Cont’d
Definition
(a) The floor function assigns to the real number x the largest integer that is less than or
equal to x.
The value of the floor function at x is denoted by [x] or bxc.
(b) The ceiling function assigns to the real number x the smallest integer that is greater
than or equal to x.
The value of the ceiling function at x is denoted by dxe.

Example
(1) Data stored on a computer disk or transmitted over a data network are usually
represented as a string of bytes. Each byte is made up of 8 bits. How many bytes are
required to encode 100 bits of data?
(2) Find the number of positive integers ≤ 300 and divisible by 2 or 3.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 146 / 354
...Cont’d

(3) Find the number of positive integers ≤ 3000 & not divisible by 7 or 8.
Solution:
(1) To determine the number of bytes needed, we determine the smallest integer that is at
least as large as the quotient when 100 is divided by 8, the number of bits in a byte.
Consequently, d100/8e = d12.5e = 13 bytes are required.
(2) Let A = {x ∈ Z+ : x ≤ 300 & divisible by 2}.
B = {x ∈ Z+ : x ≤ 300 & divisible by 3}.
Then, A ∩ B consists of positive integers ≤ 300 that are divisible by 2 and 3.
That is, divisible by 6. Thus, A = {2, 4, · · · , 300}, B = {3, 6, · · · , 300} and
A ∩ B = {6, 12, · · · , 300}.
|A ∪ B| = |A| + |B| − |A ∩ B| = b300/2c + b300/3c − b300/2 ∗ 3c
= 150 + 100 − 50 = 200.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 147 / 354
...Cont’d
Thus, there are 200 positive integers ≤ 300 and divisible by 2 or 3.
(3) Let A = {x ∈ Z+ : x ≤ 3000 & divisible by 7}
B = {x ∈ Z+ : x ≤ 3000 & divisible by 8}.
We need to find |Ac ∩ B c |
Now,
|Ac ∩ B c | = |(A ∪ B)c | = |U | − |A ∪ B| , U= universal set.
= |U | − |A| − |B| + |A ∩ B|
= 3000 − b3000/7c − b3000/8c + b3000/56c
= 3000 − 428 − 375 + 53 = 2250.
Corollary
Let A, B and C be three finite sets. Then,
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 148 / 354
...Cont’d
Proof.
|A ∪ B ∪ C| = |A ∪ (B ∪ C)|

= |A| + |B ∪ C| − |A ∩ (B ∪ C)|

= |A| + [|B| + |C| − |B ∩ C|] − [|(A ∩ B) ∪ (A ∩ C)|]

= |A| + |B| + |C| − |B ∩ C| − [|A ∩ B| + |A ∩ C| − |(A ∩ B) ∩ (A ∩ C)|]

= |A| + |B| + |C| − |B ∩ C| − |A ∩ B| − |A ∩ C| + |A ∩ B ∩ C|.

Exercise
(1) Find the number of positive integers ≤ 2076 & divisible by 3, 5 or 7.
(2) How many bit strings of length eight that either start with a 1 bit or end with the two
bits 11?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 149 / 354
...Cont’d
Multiplication Principle

If an experiment consisting of k independent steps, in such away that:


,→ The first step has n1 possible outcome
,→ Any outcome of the first can be followed by n2 outcome of the 2nd step
,→ Any one of the first and the second step can be followed n3 outcome of the 3rd step
and continues up to k th step.
Then the total number of outcomes is given by n1 ∗ n2 ∗ ... ∗ nk .
Theorem (Multiplication Principle)
Suppose a task T is made up of two subtasks. Subtask T1 followed by subtask T2 . If
subtask T1 can be done in m1 ways and subtask T2 in m2 different way for each way
subtask T1 can be done, then task T can be done in m1 ∗ m2 ways.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 150 / 354
...Cont’d

Example
(1) How many distinct phone numbers are there if we assume that
a phone number is made of 6 digits with the first digit begin different from 0 and 1?

(2) In how many ways can the letters of the word “CAR” be reordered to produce
distinct words?

(3) Find the number of two letter words that begin with a vowel.

(4) Show that a set S with n elements has 2n subset.

(5) How many one to one functions are there from a set with m elements to a set with n
elements?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 151 / 354
...Cont’d
Solution:
(4) Every subset of S can be uniquely identified by an n-bit words. The task of forming
an n-bit word can be broken down to n subtasks. Selecting a bit for each of the
n-positions. Each position in the word has two choices 0 or 1.
Consider the one-to-one correspondence between subsets of S and bit strings of length
|S|. A subset of S is associated with the bit string with a 1 in the ith position if the
ith element in the list is in the subset. By the multiplication rule, there are 2|s| bit
strings of length |S|. Therefore, |P (S)| = 2|S| = 2n .

So, by the multiplication principle, the total number of n-bit words that can be
formed is 2.2.2 . . . 2 = 2n .
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 152 / 354
...Cont’d

(5) First note when m > n there is no one to one functions from a set with m elements to
a set with n elements.
Now let m ≤ n. Suppose the elements in the domain are a1 , a2 , ..., am . There are n
ways to choose the value of the function at a1 . Since the function is one to one, the
value of the function at a2 can be picked in (n − 1) ways (since the value used for a1
can not be used again).
In general, the value of the function at ak can be chosen in n − k + 1 ways. By the
multiplication principle, there are
n(n − 1)(n − 2)...(n − m + 1)
one to one functions from a set with m elements to one with n element.
For instance, there are 5 ∗ 4 ∗ 3 = 60 one to one functions from a set with three
elements to a set with five elements.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 153 / 354
...Cont’d
The Pigeonhole Principle

Theorem (The Pigeonhole Principle)


If k is a positive integer and k + 1 or more objects are placed into k boxes, then there is at
least one box containing two or more of the objects.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 154 / 354
...Cont’d
Other principles related to the pigeonhole principle:
,→ If n objects are put into n boxes and no box is empty, then each box contains
exactly one object.
,→ If n objects are put into n boxes and no box gets more than one object, then each
box has an object.
F In problem solving, the pigeons are often numbers or objects, and the
pigeonholes are properties that the numbers/objects might possess.

Theorem (The Generalized Pigeonhole Principle)


lmm
If m objects are placed into k boxes, then there is at least one box containing at least
k
objects.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 155 / 354
...Cont’d

Remark
The smallest integer N with N/k > r − 1, namely, N = k(r − 1) + 1, is the smallest
integer satisfying the inequality dN/ke ≥ r.

Example
(a) Among any group of 25 people, at least four were born on the same day of the week.
This follows from the generalized pigeonhole principle with m = 25 and k = 7,
yielding dm/ke = d25/7e = 4.
(b) Suppose a department contains 13 professors. Then, two of the professors (pigeons)
were born in the same month (pigeonholes).
(c) Say 30 buses are to transport 2000 FASIL FC fans to Addis Ababa. Each bus has 80
seats.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 156 / 354
...Cont’d
Show that
(i) one of the buses will have at least 14 empty seats.
(ii) one of the buses will carry at least 67 passengers.
(d) What is the minimum number of students required in a discrete mathematics class to
be sure that at least six will receive the same grade, if there are five possible grades,
A, B, C, D, and F?
Solution (c)
(i) The total number of seats is (30)(80) = 2400 seats. Thus, there will be
2400 − 2000 = 400 empty seats in total.
By the generalized pigeonhole principle, with 400 empty seats among 30 buses, one
bus will have at least d400/30e = 14 empty seats.
(ii) by the generalized pigeonhole principle, seating 2000 passengers among 30 buses, one
will have at least d2000/30e = 67 passengers.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 157 / 354
...Cont’d
Solution (d): The minimum number of students (pigeons) needed to ensure that at least
six students receive the same grade (pigeonhole) is the smallest integer N such that
dN/5e = 6. The smallest such integer is N = 5(6 − 1) + 1 = 26.
Thus, 26 is the minimum number of students needed to ensure that at least six students
will receive the same grade.
Permutations

Definition
Permutation is the arrangement or selection of objects in a specified order.

Permutation rule 1
The arrangement of n distinct objects taking all together in specified order is
n! = n(n − 1)(n − 2)...(2)(1) and 0! = 1! = 1.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 158 / 354
...Cont’d
Example
(i) In how many ways can 6 persons be seat in a row?
Ans. 6! = 720.

(ii) Suppose a photographer must arrange 4 persons in a row for a photograph. In how
many different ways can the arrangement be done?
Ans. 4! = 24.

Permutation rule 2
The arrangement of n distinct objects in specified order using r objects at a time is a
permutation of n objects taking r objects at a time, that is, nPr = P (n, r), where
n!
P (n, r) = , 0 ≤ r ≤ n.
(n − r)!
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 159 / 354
...Cont’d

Example
(a) In how many ways can 9 books be arranged on a shelf having 4 places?
9!
Ans. 9P4 = P (9, 4) = = 9 × 8 × 7 × 6 = 3024.
(9 − 4)!
(b) How many 5 letter words can be formed from the letters in the word DISCOVER?
8!
Ans. 8P5 = P (8, 5) = = 8 × 7 × 6 × 5 × 4 = 6720.
(8 − 5)!

Permutation rule 3
The arrangement of n objects in which n1 are alike, n2 are alike, ... , nr are alike is given
n!
by P (n, n1 , n2 , · · · , nr ) = , where n1 + n2 ... + nr = n.
n1 ! × n2 ! × ... × nr !

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 160 / 354
...Cont’d

Example
How many different arrangements can be made from the letters in the word
10!
(i) STATISTICS Ans.
3! × 3! × 1! × 2! × 1!
11!
(ii) MISSISSIPPI Ans. .
1! × 4! × 4! × 2!
9!
(iii) EXERCISES Ans. .
3! × 1! × 1! × 1! × 1! × 2!

Exercise
(1) Eight runners take part in a race. How many different ways of allocating medals
(gold, silver and bronze) are there?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 161 / 354
...Cont’d

(2) How many strings of n length can be formed from the English alphabet?

Theorem
The number of r-permutation of a set of n objects with repetition allowed is nr .

Combinations

Definition
An r-combination of elements of a set is an unordered selection of r-objects from the set.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 162 / 354
...Cont’d
Theorem
The number of r-combinations of a set with n elements, where n is a nonnegative integer
with 0 ≤ r ≤ n is  
n n!
C(n, r) = = .
r (n − r)!r!

Corollary
n n
 
Let n and k be non-negative integers with k ≤ n, then k = n−k .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 163 / 354
...Cont’d
Proof.

Indeed, we have

n
 n!
n−k =
(n − k)!(n − (n − k))!

n!
=
(n − k)!(n − n + k)!

n!
=
(n − k)!k!

= nk


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 164 / 354
...Cont’d

Example
(1) A class contains 10 students with 6 male and 4 female. Find the number of ways to
(i) Select a 4 member committee from the students.
(ii) Select a 4 member committee with 2 male and 2 female.
(iii) Select a president, vice president, and treasurer.

(2) A box contains 8 blue socks and 6 red socks. Find the number of ways two socks can
be drawn from the box if
(a) They can be any color.

(b) They must be the same color.

(3) Find the number of bytes contain exactly three 0’s.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 165 / 354
...Cont’d
Solution: 
(1) (i) 10
4 = 10!/4!(10 − 4)! = 10!/4!6! = (10987)/(4321) = 210 ways.
6
 4
(ii) 2 2 = (6 ∗ 5/2 ∗ 1) ∗ (4 ∗ 3/2 ∗ 1) = 15 ∗ 6 = 90 ways.
(iii) This concerns permutations, not combinations.
10!
Thus, P (10, 3) = 1098 = 720 ways.
(10 − 3)!
(2) (a) There are 14 choose2 ways to select 2 of the 14 socks.
Thus, C(14, 2) = 14

2 = 14!/2! ∗ 12! = (14 ∗ 13)/(2 ∗ 1) = 91.
(b) There are C(8, 2) = 28 ways to choose 2 of the 8 blue socks, and C(6, 2) = 15 ways to
choose 2 of the 6 red socks.
By the sum rule, we have 28 + 15 = 43 ways.
(3) (number of bytes containing exactly three 0’s)=(number of bytes containing three 0’s
and five 1’s) =(number of permutations of eight symbols of which three are like (0’ s)
and five are alike (1’s)) = 83 = 8!/3!5! = 56.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 166 / 354
...Cont’d
Theorem
n+r−1

There are r r-combinations from a set with n elements when repetition of elements
is allowed.

Example
There are 30 varieties of donuts from which we wish to buy a dozen. How many possible
ways to place your order are there?
Solution: Here n = 30 and we wish to choose r = 12. Order does not matter and
repetitions
 are41possible, so we apply the above theorem to get that there are
30+12−1

12 = 12 possible orders.
F Suppose that a cookie shop has four different kinds of cooking. How many different
ways can six cookies be chosen? Assume that only the types of cookie are not the
individual cookies or the order in which they are chosen matter.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 167 / 354
...Cont’d

Theorem (The Binomial Theorem)


If n is a nonnegative integer and x and y be a real variable, then
n  
n
X n n−r r
(x + y) = x y .
r
r=0

Example
(1) Find the binomial expansion of (2a − 3b)4 .
Solution: Here, x = 2a and y = −3b and n = 4. Using the binomial theorem
(2a − 3b)4 = (2a + (−3b))4 = 4r=0 4r (2a)4−r (−3b)r
P 

= 40 (2a)4 + 41 (2a)3 (−3b) + 42 (2a)2 (−3b)2 + 43 (2a)(−3b)3 + 44 (−3b)4


    

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 168 / 354
...Cont’d
= (2a)4 + 4(2a)3 (−3b) + 6(2a)2 (−3b)2 + 4(2a)(−3b)3 + (−3b)4
= 16a4 − 96a3 b + 216a2 b2 − 216ab3 + 81b4 .
(2) What is the coefficient of x12 y 13 in the expansion of (2x − 3y)25 .
Solution: (2x − 3y)25 = (2x + (−3y))25 = 25 25 25−r (−3y)r .
P 
r=0 r (2x)

Consequently, the coefficient of x12 y 13 in the expansion is obtained when r = 13.


25 25−13 (−3y)13 = 25 (2x)12 (−3y)13
 
13 (2x)
 13 12 12
= 25 13 13 = 25 (2)12 (−3)13 x12 y 13

12 (2) x (−3) y 12
25! 12
Thus, the coefficient of x12 y 13 is 2 (−3)13 .
13!12!
Exercise
Expand (1 − x + x2 )4 . (Hint:put y = 1 − x)
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 169 / 354
...Cont’d

The P th term from the end


The P th term from the end in the expansion of (x + y)n is (n − p + 2)th term from the
beginning.

Middle terms
The middle term depends upon the value of n.

(a) If n is even, then the total number of terms in the expansion of


n
(x + y)n is n + 1 (odd). Hence, ( + 1)th term is the middle term.
2
(b) If n is odd, then the total number of terms in the expansion of (x + y)n is n + 1 (even).
n + 1 th n + 3 th
So there are two middle terms i.e., ( ) and ( ) are two middle terms.
2 2
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 170 / 354
...Cont’d

Example
1
(1) Find the rth term in the expansion of (x + )2r .
x
Solution: We have
1
Tr = 2rCr−1 (x)2r−r+1 ( )r−1
x
(2r)!
Tr = x2 .
(r + 1)!(r − 1)!

x3 2
(2) Find the 4th term from the end in the expansion of ( − 2 )9 .
2 x
Solution: Since rth term from the end in the expansion of (a + b)n is
(n − r + 2)th term from the beginning.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 171 / 354
...Cont’d
Therefore, 4th term from the end is 9 − 4 + 2, i.e., 7th term from the beginning, which is
3 672
given by T7 = 9C6 ( x2 )3 ( −2
x2
)6 = 3 .
x
(3) Find the coefficient of x11 in the expansion of (x3 − 2/x2 )12 .
Solution: Let the general term, i.e., (r + 1)th contain x11 .

Tr+1 = 12Cr (x3 )12−r (−2/x2 )r


= 12Cr x36−3r−2r (−1)r 2r
= 12Cr (−1)r 2r x36−5r
Now, for this to contain x11 , we observe that 36 − 5r = 11, i.e., r = 5. Thus, the
coefficient of x11 is 12C5 (−1)5 25 = −25344.

Exercise
Determine whether the expansion of (x2 − 2/x)18 will contain a term containing x10 ?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 172 / 354
...Cont’d
Example
√ √ √
(1) Find the term independent of x in the expansion of ( x/ 3 + 3/2x2 )10 .
Solution: Let (r + 1)th term be independent of x which is given by

Tr+1 = 10Cr ( x3 )10−r ( 3/2x2 )r
p

= 10Cr (x/3)(10−r/2) .3r/2 .1/2r x2r )


= 10Cr 3r/2−(10−r)/2 2−r x(10−r)/2−2r .
Since the term is independent of x, we have (10 − r)/2 − 2r = 0 ⇒ r = 2. Hence, the
3rd term is independent of x and its value is given by T3 = 10C2 (3−3 /4) = 5/12.
(2) Find the middle term(s) in the expansion of
(a) (2ax − b/x2 )12
(b) (p/x + x/p)9 .

(3) If the term free from x in the expansion of ( x − k/x2 )10 is 405. Find the value(s) of
k.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 173 / 354
...Cont’d
Solution:
(2) (a) Since the power of binomial is even, it has one middle term which
12
is the ( + 1)th term and it is given by
2
T7 = 12C6 (2ax)6 (−b/x2 )6
= 12C6 (26 a6 (−b)6 )/x6
= (59136a6 b6 )/x6 .
(b) Since the power of binomial is odd. Therefore, we have two
9 + 1 th 9 + 3 th
middle terms which are ( ) = 5th and ( ) = 6th terms.
2 2
These are given by T5 = 9C4 (p/x)5 (x/p)4 = 126p/x and
T6 = 9C5 (p/x)4 (x/p)5 = 126x/p.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 174 / 354
III Cont’d
Generating Functions

Definition
Let a1 , a2 , · · · be a sequence of real numbers. The function

X
2
f (x) = a0 + a1 x + a2 x + · · · = ak xk
k=0

is called the generating function for the given sequence.

Example
For n ∈ Z+ , (1 + x)n = n n n
x2 + · · · +
xn , n
   
0 + 1 x+ 2 n
So, (1 + x)n is the generating function for the sequence n0 , n n n
   
1 , 2 ,··· , n , 0, 0, 0, · · ·
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 175 / 354
III Cont’d
Example
(1) What is the generating function for the sequence 1, 1, 1, 1, 1, 1?
Solution: The generating function of 1, 1, 1, 1, 1, 1 is 1 + x + x2 + x3 + x4 + x5 .

1 X
(2) With = 1 + x + x2 + x3 + · · · = xk , taking the derivative of each side yields
1−x
k=0
 
d 1 1 d
= 2
= (1 + x + x2 + x3 + · · · ) = 1 + 2x + 3x2 + 4x3 + · · ·
dx 1−x (1 − x) dx
1
Consequently, is the generating function for the sequence 1, 2, 3, 4, · · · , while
(1 − x)2
x
= 0 + x + 2x2 + 3x3 + 4x4 + · · · is the generating function for the sequence
(1 − x)2
0, 1, 2, 3, 4, · · ·
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 176 / 354
III Cont’d

Definition
Let u be a realnumber and k a nonnegative integer. Then the extended binomial
u
coefficient is defined by
k

   u(u − 1) · · · (u − k + 1)
u , if k > 0
= k!
k 1, if k = 0.

Example
   
−2 1/2
Find the values of the extended binomial coefficients and .
3 3

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 177 / 354
III Cont’d
Solution:  
−2 (−2)(−3)(−4)
Taking u = −2 and k = 3 gives us, = = −4.
3 3!
 
1/2 (1/2)(1/2 − 1)(1/2 − 2)
Taking u = 1/2 and k = 3 gives us, = = 1/16.
3 3!

Remark
With n, r ∈ Z+ and n ≥ r > 0, we have
 
n n! [n(n − 1)(n − 2) · · · (n − r + 1)]
= =
r [r!(n − r)!] r!
 
[n(n − 1)(n − 2) · · · (n − r + 1)] n
If n ∈ R, we use as the definition of . Then
r! r
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 178 / 354
III Cont’d
 
−n [(−n)(−n − 1)(−n − 2) · · · (−n − r + 1)]
=
r r!
(−1)r (n)(n + 1)(n + 2) · · · (n + r − 1)
=
r!
(−1)r (n + r − 1)(n + r − 2) · · · (n)
=
r!
(−1)r (n + r − 1)!
 
r n+r−1
= = (−1) .
r!(n − 1)! r

Theorem (The Extended Binomial Theorem)


Let x be be a real number with | x |< 1 and let u be a real number. Then
∞  
u
X u k
(1 + x) = x .
k
k=0

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 179 / 354
III Cont’d

Example
For n ∈ Z+ , the Maclaurin series expansion for (1 + x)−n is given by

∞  
−n
X −n
(1 + x) = xk
k
k=0
∞  
X
kn+k−1 k
= (−1) x
k
k=0

     ∞  
−n −n −n −n 2 X −n k
Hence, (1 + x) = + x+ x + ··· = x . This shows that
0 1 2 k
k=0
     
−n −n −n −n
(1 + x) is the generating function for the sequence , , ,··· .
0 1 2
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 180 / 354
Chapter 4
Advanced Counting Methods
Introduction

Many counting problems cannot be solved easily using elementary counting priciples.
One such problem is: how many bit strings of length n + 1 do not contain two
consecutive zeros?
To solve this problem, let an be the number of such strings of length n + 1. An
argument can be given that shows an+2 = an+1 + an .
This equation, called recurrence relation, and the initial conditions a0 = 2 and
a1 = 3 determine the sequence {an }∞
n=0 .

Moreover, the explicate formula can be found for an from the equation relating the
terms of the sequence.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 181 / 354
...Cont’d

Definition
A recurrence relation (RR) for a sequence {an }∞ n=0 is an equation that expresses an in
terms of one or more preceding terms a0 , a1 , . . . , an−1 . Moreover, the sequence is called
the solution to the recurrence relation if it satisfies the recurrence relation.

Example
(a) an = 2an−1 + 1, n ≥ 1.
(b) an = 5an−1 − 6an−2 , n ≥ 2.

For (a) we would need one initial value to nd a particular or single an . For example,
if a0 = 1, then a1 = 3 and a2 = 7.
For (b) we would need two initial values to nd a particular or single an . For example,
if a0 = 1 and a1 = 5 then a2 = 19 and a3 = 65.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 182 / 354
...Cont’d

Example
Verify that the solution of the recurrence relation an = 2an−1 + 1, n ≥ 2 with a0 = 0 is
an = 2n − 1.
Solution: We have to do two things:
(a) Check that the given formula gives the correct initial value.
(b) Check that the given formula solves the recurrence relation.

Putting n = 0 in an = 2n − 1 gives a0 = 1 − 1 = 0 as required.


To do (b) we evaluate 2an−1 + 1 using the given formula & show that it is equal to an .
Now, an−1 = 2n−1 − 1. so 2an−1 + 1 = 2(2n−1 − 1) + 1 = 2n − 1.

Recurrence relations have many applications. Suppose that you put $100 into a
savings account yielding 4% compounded annually.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 183 / 354
...Cont’d

Let an be the amount (in dollars) in the account after n years.


Then an is equal to the amount in the account after n − 1 years plus the interest for
the nth year.
For example, a1 is equal to 100 plus the interest which is 4. Hence, a1 = 104.
In general, an = an−1 + (0.04)an−1 so that an = (1.04)an−1 , n ≥ 1 with a0 = 100.
Solving this, we obtain
a1 = 100(1.04)
a2 = (1.04)a1 = 100(1.04)2
a3 = (1.04)a2 = 100(1.04)3
and the general solution, an = 100(1.04)n .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 184 / 354
Linear RR with Constant Coefficient

Definition
A linear recurrence relation with constant coefficient of order k is a recurrence relation of
the form
an + c1 an−1 + c2 an−2 + · · · + ck an−k = f (n). ..................(1)
where c1 , c2 , · · · , ck are constants and ck 6= 0. If f (n) is identically zero (f (n) = 0) in the
recurrence relation (1), then the recurrence relation (1) is called homogeneous,
otherwise it is called nonhomogeneous.

Example
(a) an + 6an−1 = 0 is linear homo. recurrence relation with constant coefficient of order 1.
(b) an − 5an−1 + 6an−2 = 0 is linear homo. recurrence relation with constant coefficient
of order 2.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 185 / 354
...Cont’d
(c) an + 4an−1 + 4an−2 = −5n2 + n is linear non-homogeneous recurrence relation with
constant coefficient of order 2.
(d) an − 5an−1 + 6an−2 − an−3 = 4n is linear non-homogeneous recurrence relation with
constant coefficient of order 3.
(e) n2 an+2 + 5an+4 − 10an−5 − 8n + 23 = 0.

Solution of Linear Recurrence Relation with Constant Coefficients

Solving LHRR with Constant Coefficients


The basic approach for solving linear homogeneous recurrence relations is to look for the
solutions of the form an = rn , where r is constant.
Note that an = rn is the solution of the recurrence relation
an + c1 an−1 + c2 an−2 + · · · + ck an−k = 0 ...........(2)
if and only if rn + c1 rn−1 + c2 rn−2 + · · · + ck rn−k = 0.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 186 / 354
...Cont’d
When both side of the equation is divided by rn−k , we obtain the equation
rk + c1 rk−1 + c2 rk−2 + ... + ck−1 r + ck = 0. ................(3)
Consequently, the sequence {an }∞ n
n=0 with an = r is the solution if and only if r is the
solution of the last equation (3), which is called the characteristic equation of the
recurrence relation (2).
The solutions of the characteristic equation (3) are called characteristic roots of
the recurrence relation (2).
As we will see, these characteristic roots can be used to give an explicit formula for
all the solutions of the recurrence relation (2).
All the possible solutions (or general solution) to a LHRR with constant coefficient
of order 1,
an + can−1 = 0, n ≥ 1 is an = p(−c)n , where p is a constant.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 187 / 354
...Cont’d
Example
Find the solution of the recurrence relation an − 5an−1 = 0 with initial condition a0 = 7.
Solution:
The general solution is an = p(5n ). Since a0 = 7 ⇒ a0 = p(50 ) = 7.
Thus, p = 7 and hence the solution is an = 7(5n ) .

Theorem
Consider a linear homogeneous recurrence relation with constant coefficients of order 2:

an + c1 an−1 + c2 an−2 = 0, n ≥ 2.....................(4)

where c1 and c2 are constants, and consider its characteristic equation

r2 + c1 r + c2 = 0..............................................(5)
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 188 / 354
...Cont’d

Let r1 , r2 be the two (can be complex) roots of the characteristic equation


r2 − c1 r − c2 = 0.
We distinguish three cases:
(1) Distinct Real Roots: In this case the general solution of the recurrence relation is
an = α1 r1n + α2 r2n , where α1 , α2 are arbitrary constants.
(2) Double Real Root: If r1 = r2 = r, then the general solution of the recurrence relation
is an = α1 rn + α2 nrn , where α1 , α2 are arbitrary constants.
(3) Complex Roots: In this case the solution could be expressed in the same way as in the
case of distinct real roots, but in order to avoid the use of complex numbers we write
r1 = α + iβ, r2 = α − iβ, then the general solution is given by
an = c1 r1n + c2 r2n = Rn (k1 cos(nθ) + k2 sin(nθ)).
Euler’s Formula: eiθ = cosθ + isinθ.
p
De Moivers Theorem: (α ± iβ)n = Rn [cos(nθ) ± i sin(nθ)], R = α2 + β 2 .
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 189 / 354
...Cont’d
Example
Solve the following recurrence relations.
(a) an − an−1 − 2an−2 = 0, for n ≥ 2.
(b) an = −7an−1 − 12an−2 , for n ≥ 2 with a0 = 0 and a1 = 5.
9
(c) an − 3an−1 + an−2 = 0, for n ≥ 2 with a0 = 1 and a1 = 10.
4

Theorem
Consider the linear homogeneous recurrence relation with constant coefficients of order k
an + c1 an−1 + c2 an−2 + ... + ck an−k = 0 ...............(6 )
and consider its characteristic equation
rk + c1 rk−1 + c2 rk−2 + ... + ck−1 r + ck = 0. ..........(7 )
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 190 / 354
...Cont’d

(i) If the characteristic equation (7) has k distinct roots r1 , r2 , · · · , rk , then the sequence
{an }∞
n=0 is the solution of the recurrence relation (6) if and only if

an = d1 r1n + d2 r2n + · · · + dk rkn . ..........(8), where d1 , d2 , · · · , dk are constants.

(ii) If the characteristic equation (7) has t distinct roots r1 , r2 , · · · , rt with multiplicity
m1 , m2 , · · · , mt respectively, so that mi ≥ 1, for i = 1, 2, · · · , t and
m1 + m2 + · · · + mt = k, then the sequence {an }∞
n=0 is the solution of the recurrence

relation (6) if and only if an = (α10 + α11 n + · · · + α1(m1 −1) n(m1 −1) )r1n + (α20 +
α21 n + · · · + α2(m2 −1) n(m2 −1) )r2n + · · · + (αt0 + αt1 n + · · · + αt(mt −1) n(mt −1) )rtn
...................... (9), where αij are constants for 0 ≤ i ≤ t and 0 ≤ j ≤ mi − 1.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 191 / 354
...Cont’d

Solving LNHRR with Constant Coefficients

A linear nonhomogeneous recurrence relations (LNHRR) with constant


coefficients, that is, a recurrence relation of the form

an + c1 an−1 + c2 an−2 + · · · + ck an−k = f (n)

where c1 , c2 , · · · , ck are constants and ck 6= 0 and f (n) is a function not identically


zero depending only on n.

The recurrence relation

an + c1 an−1 + c2 an−2 + · · · + ck an−k = 0

is called the associated homogenous recurrence relation.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 192 / 354
...Cont’d
Theorem
Consider the linear nonhomogeneous recurrence relations with constant coefficients of
order k

an + c1 an−1 + c2 an−2 + · · · + ck an−k = f (n).....................(10 )

and its associated homogenous recurrence relation

an + c1 an−1 + c2 an−2 + · · · + ck an−k = 0.........................(11 )

Then every solution of the recurrence relation (10) is of the form

{apn + ahn }∞
n=0 ,

where apn is the particular solution of the recurrence relation (10) and ahn is the solution of
the recurrence relation (11).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 193 / 354
...Cont’d
Proof.
Let apn be the particular solution of the nonhomogeneous recurrence relation.
Thus, apn + c1 apn−1 + · · · + ck apn−k = f (n) ...................................................................(12)
Now suppose that asn is any other solution of the nonhomogeneous recurrence relation.
Thus, asn + c1 asn−1 + · · · + ck asn−k = f (n). .................................................................(13)
Subtracting the equation (12) from equation (13)
[asn + c1 asn−1 + · · · + ck asn−k ] − [apn + c1 apn−1 + · · · + ck apn−k ] = 0
⇒ (asn − apn ) + c1 (asn−1 − apn−1 ) + · · · + ck (asn−k − apn−k ) = 0.
It follows that asn − apn is the solution of the associated homogeneous recurrence relation.
Let ahn = asn − apn . Thus, asn = ahn + apn .
Therefore, every solution of the recurrence relation (10) is of the form
{ahn + apn }∞
n=0 .
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 194 / 354
...Cont’d
How can we find or choose the particular solution apn for the linear nonhomogeneous
recurrence relation (10)?
f (n) Trial apn
C A
Cn A0 + A1 n
Cn2 A0 + A1 n + A2 n 2
m
Cn (m ∈ N) A0 + A1 n + · · · + Am n m
crn Arn
Csin(θn) A1 sin(θn) + A2 cos(θn)
Ccos(θn) A1 sin(θn) + A2 cos(θn)
crn cos(θn) rn (A1 sin(θn) + A2 cos(θn))
Crn cos(θn) rn (A1 sin(θn) + A2 cos(θn))
Crn nm rn (A0 + A1 n + · · · + Am nm )
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 195 / 354
...Cont’d
Rules
If f (n) is one of the terms on the left side of the table choose the particular solution
apn from the right side of the table and determine the undetermined coefficients by
using the original equation in (10).

If r is the root of the characteristic equation to the recurrence relation (11) with
multiplicity m, then multiply apn by nm .
That is, if r is the root of the characteristic equation to the recurrence relation (11)
with multiplicity m, choose the particular solution apn = Bnm (rn ) for the case
f (n) = crn and choose the particular solution

apn = nm (pm nm + pm−1 nm−1 + · · · + p1 n + p0 )rn

for the case f (n) = (qm nm + qm−1 nm−1 + · · · + q1 n + q0 )rn .


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 196 / 354
...Cont’d

Example
Solve the following recurrence relations
(a) an − 4an−1 = −15, for n ≥ 1.
(b) an = 6an−1 + 7an−2 + 7n , for n ≥ 2.

(c) an = an−1 + an−2 + 5n − 6, for n ≥ 2.


(d) an − 6an−1 + 9an−2 = 2(3n ), for n ≥ 2 with a0 = −1 and a1 = 5.
(e) an − 10an−1 + 25an−2 = (n2 + n − 1)5n , for n ≥ 2.
(f) an − 6an−1 + 9an−2 = 2(3n ), for n ≥ 2.

Solution:
(b) The given recurrence relation is of the form an − 6an−1 − 7an−2 = 7n .
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 197 / 354
...Cont’d
The associated homogeneous recurrence relation to the given recurrence relation is
an − 6an−1 − 7an−2 = 0. Let an = rn be a solution.
an−1 = rn−1 , an−2 = rn−2 . Substitute these into the associated HLRR , we get
rn − 6rn−1 − 7rn−2 = 0.
Divide both sides of the equation by rn−2 yields
r2 − 6r − 7 = 0p(characteristic equation).
6 ± (−6)2 − 4(1)(−7) 6±8
Thus, r = = .
2(1) 2
So, r1 = 7 and r2 = −1.
Hence, the general solution to the associated homogeneous recurrence relation is
ahn = c1 r1n + c2 r2n = c1 (7n ) + c2 (−1)n .
f (n) = 7n , and r1 = 7 is the root of the characteristic equation with multiplicity 1.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 198 / 354
...Cont’d
Thus, we choose particular solution apn = qn(7n ) , where q is a constant.
Then, we have to find q by substituting apn into the given recurrence relation, that is,
apn − 6apn−1 − 7apn−2 = 7n .
Observe that
apn = qn(7n ), apn−1 = q(n − 1)(7n−1 ), apn−2 = q(n − 2)(7n−2 ).
Now, we have
[qn(7n )] − 6[q(n − 1)(7n−1 )] − 7[q(n − 2)(7n−2 )] = 7n
qn(7n ) − 6qn7n−1 + 6q7n−1 − 7qn7n−2 + 14q7n−2 = 7n
qn(7n ) − 6/7qn(7n ) + 6/7q(7n ) − 1/7qn(7n ) + 2/7q7n = 7n
8/7q(7n ) = 7n ⇒ 8/7q = 1 ⇒ q = 7/8.
Hence, apn = 7/8n(7n ) is the particular solution of the recurrence relation.
The general solution is an = ahn + apn = c1 (7n ) + c2 (−1)n + 7/8n(7n ).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 199 / 354
...Cont’d
(d) We are given a recurrence relation an − 6an−1 + 9an−2 = 2(3n ).

The associated homogeneous recurrence relation to the given recurrence relation is


an − 6an−1 + 9an−2 = 0.
Let an = rn be a solution. an−1 = rn−1 , an−2 = rn−2 . Substitute these into the
associated HLR , we get rn − 6rn−1 + 9rn−2 = 0.
Divide both sides of the equation by rn−2 yields
r2 − 6r + 9 = 0 .
⇒ (r − 3)2 = 0.
So, the characteristic equation has double real root and r = 3.
Hence, the general solution to the associated homogeneous recurrence relation is
ahn = d1 (3)n + d2 n(3)n , where d1 and d2 are constants.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 200 / 354
...Cont’d
f (n) = 2(3n ), and r = 3 is the root of the characteristic equation with multiplicity 2,
so we choose the particular solution to the given nonhomogeneous recurrence relation
to be apn = qn2 (3n ) , where q is constant to be determined by substituting apn in to
the given recurrence relation.
That is, apn − 6apn−1 + 9apn−2 = 2(3n ).
But,
apn = qn2 (3n ), apn−1 = q(n − 1)2 (3n−1 ), apn−2 = q(n − 2)2 (3n−2 ).
Thus, apn − 6apn−1 + 9apn−2 = 2(3n )
[qn2 (3n )] − 6[q(n − 1)2 (3n−1 )] + 9[q(n − 2)2 (3n−2 )] = 2(3n )
qn2 (3n ) − 6[q(n2 − 2n + 1)(3n−1 )] + 9[q(n2 − 4n + 4)(3n−2 )] = 2(3n )
qn2 (3n )−6qn2 (3n−1 )+12qn(3n−1 )−6q(3n−1 )+9qn2 (3n−2 )−36qn(3n−2 )+36q(3n−2 ) =
2(3n )
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 201 / 354
...Cont’d
qn2 (3n ) − 2qn2 (3n ) + 4qn(3n ) − 2q(3n ) + qn2 (3n ) − 4qn(3n ) + 4q(3n ) = 2(3n )
⇒ 2q3n = 2(3n ) ⇒ q = 1.
Hence, the particular solution to the given nonhomogeneous recurrence relation is
apn = n2 (3n ).

The general solution to the nonhomogeneous recurrence relation is


an = ahh + apn = d1 (3n ) + d2 n(3n ) + n2 (3n ) where d1 and d2 are constants.

Then, putting n = 0 and n = 1 in an = d1 (3n ) + d2 n(3n ) + n2 (3n ) gives,


a0 = d1 (30 ) + d2 (0)(30 ) + 02 (30 ) and a1 = d1 (3) + d2 (3) + 3 d1 = −1 and
3d1 + 3d2 + 3 = 5.
That is, d1 = −1 and 3d1 + 3d2 = 2. Solving these gives, d1 = −1 and d2 = 5/3.
Hence, an = −(3n ) + 5/3n(3n ) + n2 (3n ) is the definite solution of the given linear
nonhomogeneous recurrence relation.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 202 / 354
III Cont’d

The Method of Generating Functions

Example
Solve the recurrence relation an − 3an−1 = n, n ≥ 1, a0 = 0.

Solution:

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 203 / 354
III Cont’d

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 204 / 354
III Cont’d

Before we can proceed, we need the generating function for the sequence 0, 1, 2, 3, · · ·
Recall that

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 205 / 354
III Cont’d

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 206 / 354
III Cont’d

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 207 / 354
III Cont’d

of xnis given by
and the coefficient   
−2 n n 2+n−1
(−1/2) (−1) = (−1/2)(−1) (−1)n = (−1/2)(n + 1).
n n
7 1 3
Therefore, an = ( )3n − ( )n − , n ≥ 0.
4 2 4
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 208 / 354
Chapter 5
Introduction to Graph Theory

Basic Terminologies

Definition
A graph G consists of a finite non-empty set V(G) of elements called vertices together with
a finite set E(G) of unordered pairs of (not necessarily distinct) vertices called edges.
A vertex on which no edges are incident is called isolated vertex.

The following are examples of graphs with vertices V(G) and edges E(G).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 209 / 354
...Cont’d
(i) Consider the graph G

V = {v1 , v2 , v3 , v4 , v5 }, E = {v1 v2 , v1 v3 , v2 v3 , v2 v4 , v3 v4 , v3 v5 }.
(ii) Consider the graph G

V = {v1 , v2 , v3 , v4 , v5 }, E = {v1 v2 , v2 v2 , v2 v3 , v2 v4 , v3 v4 (twice), v4 v5 }.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 210 / 354
...Cont’d

(iii) Consider the graph G

V = {v1 , v2 , v3 , v4 , v5 , v6 , v7 }, E = {v1 v2 , v2 v3 , v2 v4 , v3 v4 , v5 v6 } and v7 is an isolated vertex.


Definition
In a graph, two or more edges joining the same pair of vertices are called multiple(parallel)
edges. In a graph G, an edge which joins a vertex to itself is called a loop. A graph with
no multiple edges or loops is called a simple graph.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 211 / 354
...Cont’d
♠ Thus, the graphs in the above example (i) and (iii) are simple graph, but (ii) is not, it is
a non-simple graph.
♠ The first and second graphs are not simple graphs but the third graph is simple graph.

F There are two distinct notions of multiple edges.


Edges without own identity: The identity of an edge is defined solely by the two
nodes it connects. In this case, the term ”multiple edges” means that the same edge
can occur several times between these two nodes.
Edges with own identity: Edges are primitive entities just like nodes. When
multiple edges connect two nodes, these are different edges.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 212 / 354
...Cont’d
Definition
A graph G is known as a multi-graph if it contains parallel edges. It is to be noted that
every simple graph is a multi-graph but the converse is not true.
A graph G is known as pseudo graph if we allow both parallel edges and loops. It is to be
noted that every simple graph and multi-graph are pseudo graph but the converse is not
true. Consider the graph G as

♠ Here, the edges e1 and e5 are parallel edges. It is also pseudo graph.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 213 / 354
...Cont’d
The following graph represents a pseudo graph.

Definition
Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in G if u
and v are end points of an edge e of G. Such an edge e is called incident with the vertices
u and v (or u and v are incident with the edge e) and e is said to connect u and v.
Similarly, two edges are adjacent if they have a vertex in common. A vertex that is an end
point of a loop is said to be adjacent to itself.

♠ v1 and v2 are adjacent in the following graph, each being incident with edge e1 . We call
v1 and v2 the end-vertices of e1 .
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 214 / 354
...Cont’d
Also edges e1 and e2 are adjacent edges.

Example
In the graph below, the vertices u and x are adjacent, vertex w, is incident with edges 2, 3,
4 and 5, and edge 6 is incident with the vertex x.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 215 / 354
...Cont’d

Definition
The set of all neighbors of a vertex v of G(V, E), denoted by N (v), is called the
neighborhood of v. If A is a subset of V , we denote by N (A)
S the set of all vertices in G
that are adjacent to at least one vertex in A. So, N (A) = v∈A N (v).

Definition
In a graph G, the degree of a vertex v is the number of edges incident with v and denoted
by deg(v). Each loop counted twice. Each loop contributes 2 to the degree of the
corresponding vertex because it has two ends joined to that vertex.
A vertex with a loop “sees” itself as an adjacent vertex from both ends of the edge. Thus,
adding two, not one, to the degree.
A leaf vertex (also pendant vertex) is a vertex with degree one.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 216 / 354
...Cont’d
Remark
♠ The degree of an isolated vertex is zero.

Example
What are the degrees and what are the neighborhoods of the vertices in the graphs G and H
displayed in figure below?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 217 / 354
...Cont’d
Solution:
In G
deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d) = 1, deg(e) = 3, deg(g) = 0.

The neighborhoods of these vertices are


N (a) = {b, f }, N (b) = {a, c, e, f }, N (c) = {b, d, e, f }, N (d) = {c},
N (e) = {b, c, f }, N (f ) = {a, b, c, e}, N (g) = ∅.
In H
deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, deg(d) = 5.

The neighborhoods of these vertices are


N (a) = {b, d, e}, N (b) = {a, b, c, d, e}, N (c) = {b}, N (d) = {a, b, e}, N (e) = {a, b, d}.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 218 / 354
...Cont’d
Example
Consider the graphs in (a) and (b) given below.

(a) deg(u)= 2, deg(v)= 1, deg(w)= 4, deg(x)= 3, deg(y)=0.

(b) deg(u)= 2, deg(v)= 5, deg(w)= 4, deg(x)= 5, deg(y)= 0.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 219 / 354
...Cont’d

Definition
The degree sequence of a graph G is the sequence obtained by listing the vertex degrees of
G in ascending order, with repeats as necessary.

Example
For the graphs in (a) and (b) given in the above example, we have the degree sequences 0,
1, 2, 3, 4 and 0, 2, 4, 5, 5 respectively.

Definition
The order of a graph G(V, E) is the number of vertices, |V |, where V is the set of vertices
and the number of edges is its size, denoted by |E|.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 220 / 354
...Cont’d

Example (Consider the following graph G)

The order of G is |V | = 4. The size of G is |E| = 8.

Theorem (Handshaking [ Degree Sum] Theorem)


For a graph with vertex set {v1 , v2 , · · · , vn } and m edges,
n
X
deg(vk ) = 2m. Note that this applies even if multiple edges and loops are present.
k=1

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 221 / 354
...Cont’d
Proof.
In any graph, each edge has two ends and hence it contributes exactly 2 to the sum of the
vertex degrees. Therefore, the result follows immediately.

Example
How many edges are there in a graph with 10 vertices each of degree six?
Solution:
The sum of the degrees of the vertices is 6 ∗ 10 = 60, it follows that 2m = 60, where m is
the number of edges. Therefore, m = 30.

Definition (Subgraphs)
A subgraph of a graph G is a graph all of whose vertices are vertices of G and all of whose
edges are edges of G.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 222 / 354
...Cont’d
Remark: A graph G is a subgraph of itself.
Example
The following graphs are all subgraphs of the graph G on the left, with vertices {u, v, w, x}
and edges {1, 2, 3, 4, 5}.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 223 / 354
...Cont’d
Suppose that G and H be two graphs with vertex sets V(G) and V(H). Let the edge
sets E(G) and E(H). Now H is said to be subgraph of G if V(H) ⊆ V(G) and E(H) ⊆
E(G).

Vertex deleted subgraph

Suppose G(V, E) be a graph. If we delete a subset U of the set V and all the edges,
which have a vertex in U as an end, then the resultant graph is termed as vertex
deleted subgraph of G. Consider the graph G as

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 224 / 354
...Cont’d
On deleting the vertex v1 , the vertex deleted subgraph H is given as

Edge deleted subgraph

Suppose G(V, E) be a graph. If a subset F from the set of edges E is deleted from the
graph G, then the resultant graph is edge deleted subgraph of G. Consider the graph
G as

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 225 / 354
...Cont’d
On deleting the edges e1 and e2 , the edge deleted subgraph is given as [G − {e1 , e2 }]

The idea of a subgraph can be extended to unlabelled graphs.


♠ The following graphs are all subgraphs of the unlabelled graph H on the left; the
configuration in graph (c) occurs at each corner of H.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 226 / 354
Matrix Representation of a Graph

Although drawings are a convenient means of specifying graphs, they are clearly not
suitable for storing graphs in computers, or for applying mathematical methods to
study their properties.

A matrix is a convenient way to represent a graph. A computer to analyze them can


use such a representation.

For these purposes, we consider two matrices associated with a graph, its adjacency
matrix and incidence matrix.

Adjacency Matrices

Let G be a graph with n vertices labeled by v1 , v2 , · · · , vn . The adjacency matrix A of


G is the n × n matrix given by
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 227 / 354
...Cont’d
 
a11 a12 · · · a1n
 a21 a22 · · · a2n 
A= .
 
.. .. .. 
 .. . . . 
an1 an2 · · · ann
(
k, if k be the number of edges from vi to vj
where aij =
0, otherwise.

Remark
In the adjacency matrix if the main diagonal elements are zero and the entries other
than the main diagonal are either 1 or 0, then the graph is said to be a simple graph.
Adjacency matrix of an undirected graph G is always symmetric.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 228 / 354
...Cont’d
Example
Use the adjacency matrix to represent the graphs shown below.

Solution: (a) We order the vertices as v1 , v2 , v3 , v4 . Since there are four vertices, the
adjacency matrix representing
 the graph will be a square matrix of order four.
0 1 1 1
1 0 1 0
A= 1 1 0 1.

1 0 1 0
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 229 / 354
...Cont’d
Similarly, for the graph given in (b), we order the vertices as v1 , v2 , v3 .
Since there are three vertices, the adjacency matrix representing the graph will be a
square matrix of order three and it is
 
0 1 0
given by A = 1 1 2.
0 2 0

Example
Draw the graph G corresponding to adjacency matrix A given by
 
1 2 0 0
2 0 1 1
A= 0 1 2 2

0 1 2 0
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 230 / 354
...Cont’d
Solution:

Since the given adjacency matrix A is square matrix of order 4, G has four vertices,
say v1 , v2 , v3 , v4 .

Draw n edges from vi to vj where aij = n. Moreover, draw n loops at vertex vi .


Thus, the required graph is given below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 231 / 354
...Cont’d
F Use an adjacency matrix to represent the pseudo graph shown below.

Incidence Matrices

Let G be a graph with n vertices


 and m edges. The
 incidence matrix I of G is the
a11 a12 · · · a1m
 a21 a22 · · · a2m 
n × m matrix given by I =  .
 
.. .. .. 
 .. . . . 
an1 an2 · · · anm
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 232 / 354
...Cont’d
(
1, if an edge ej is incident with vi
where aij =
0, otherwise.

Example
Find the incidence matrix which represents the graph given below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 233 / 354
...Cont’d
Solution: The incidence matrix is

F Represent the pseudograph shown below using an incidence matrix.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 234 / 354
Path and Connectivity of a Graph

Many applications of graphs involve getting from one vertex to another.

For example, you may wish to find the shortest route between one town and another;
the routing of a telephone call between one subscriber and another, the flow of
current between two terminals of an electrical network, and the tracing of a maze.

Definition
A walk of length k in a graph is a succession of k edges of the form uv, vw, wx, ..., yz.
This walk is denoted by uvwx...yz, and is referred to as a walk between u and z.
A closed walk in a graph is a succession of edges of the form uv, vw, wx, · · · , yz, zu, that
starts and ends at the same vertex and it is open otherwise.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 235 / 354
...Cont’d

We can think of such a walk as going from u to v, then from v to w, then from w to x,
and so on, until we arrive eventually at the vertex z. Since the edges are undirected,
we can also think of it as a walk from z to y and eventually, to x, w, v and u.

So we can equally well denote this walk by zy...xwvu, and refer to it as a walk
between z and u. Note that we do not require all the edges or vertices in a walk to
be different.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 236 / 354
...Cont’d

Example
In the following graph, uvwxywvzzy is a walk of length 9 between the vertices u and y,
which includes the edge vw twice and the vertices v, w, y and z twice.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 237 / 354
...Cont’d
Definition
A trail is a walk in which no edge has been traversed more than once (in either direction)
but repeated vertices are allowed.

A closed trail (circuit) is a closed walk in which all the edges are different and it is
open otherwise.

A path is a walk in which all the edges and all the vertices are different.
A simple circuit(cycle) is a closed walk in which all the edges and the intermediate
vertices are different.

In other words, if there is a path which starts from vertex v and terminates into the
same vertex v, then the path is known as a cycle.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 238 / 354
...Cont’d
Example
In the graph below,
acbdce is an open trail.
acbdcea is a closed trail.
acbdcbe is not a trail, since edge cb has been traversed twice, but it is a walk.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 239 / 354
...Cont’d
Path Matrix

( with n vertices. Then the n × n matrix


Suppose that G be a simple graph
1, if there is a path from vi to vj
P = [pij ]n×n defined by pij =
0, otherwise
is known as the path matrix or reachability matrix.
F Consider the Graph G as

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 240 / 354
...Cont’d
The path matrix P of the above graph G is relative to the ordering v1 , v2 , v3 , v4 , v5 is
given as  
0 1 0 1 1
1 0 0 1 1
 
P = 0 0 0 0 0
.
1 1 0 0 1
1 1 0 1 0

Definition
An undirected graph G is called connected if there is a path between every pair of distinct
vertices of the graph G and is disconnected otherwise.
An edge in a connected graph G is a bridge if its removal leaves a disconnected graph G.
Every disconnected graph G can be split up into a number of connected subgraphs, called
components.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 241 / 354
...Cont’d
In the graph below, the edge tz is a bridge since its removal leaves a disconnected
graph.

The graph below a disconnected graph and it has three components.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 242 / 354
...Cont’d
Theorem
Suppose that G be a graph with n vertices v1 , v2 , v3 , · · · , vn and let A be the adjacency
matrix of G. Let us define B = [bij ] such that

B = A + A2 + A3 + · · · + An−1 .

If for every pair of distinct indices i and j, bij 6= 0, then the graph is said to be connected.

Consider the graph G as

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 243 / 354
...Cont’d
Hence, the adjacency matrix A of G isgiven as 
0 1 1 0
1 0 1 0
A= 1 1 0 1.

0 0 1 0
Here, the number of vertices n = 4. Then, B = A + A2 + A3 .
   
2 1 1 1 2 3 4 1
1 2 1 1 3 3 2 4 1
Now, A2 =   2
1 1 3 0; A = AA = 4 4 2 3.
 

1 1 0 1 1 1 3 0
 
4 5 6 2
5 4 6 2
Therefore, B = A + A2 + A3 =  6 6 5 4 .

2 2 4 1
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 244 / 354
...Cont’d

Since, all bij 6= 0 for i 6= j; the graph G is connected. All elements except the main
diagonal elements must not be zero for a connected graph.

Disconnecting Sets [this involves edges]

Let G be a connected graph. By a disconnecting set we mean a set of edges whose


deletion results in a disconnected graph. A cut set is a disconnecting set, no proper
subset of which is a disconnecting set.
If a disconnecting set has only one edge e, then e is called a bridge (or cut-edge).
The edge connectivity of G is the size of the smallest disconnecting set of G, in other
words, it is the smallest number of edges whose deletion disconnects G. It is denoted
by λ(G).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 245 / 354
...Cont’d
Example
In graph G1 , {e2 , e3 , e4 } and {e1 , e2 } are disconnecting sets but {e3 , e5 } is not. In the
graph G1 , the edge connectivity of G1 is 2, i.e., λ(G1 ) = 2.

F In graph G2 , e is a cut edge.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 246 / 354
...Cont’d
Separating Sets [this involves vertices]

A separating set is a set of vertices whose removal disconnects G. When removing


vertices, we must also remove any incident edges.
In graph G3 , {u, v} is a separating set, but {u} is not.

If a separating set contains only one vertex v, then v is called a cut-vertex. The
vertex connectivity of a connected graph G is the size of the smallest separating set.
Or, it is the smallest number of vertices whose removal disconnects G. It is denoted
by k(G).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 247 / 354
...Cont’d
Null Graphs
These are graphs with no edges and are denoted by Nn . The null graph on 4 vertices is
given by

Cycles
A cycle Cn , n ≥ 3, consists of n vertices v1 , v2 , · · · , vn and edges
{v1 , v2 }, {v2 , v3 }, · · · , {vn−1 , vn }, and {vn , v1 }.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 248 / 354
...Cont’d
The cycles C3 , C4 , C5 , and C6 are displayed in figure below.

Complete Graphs
The complete graph on n vertices, denoted by Kn , is the simple graph in which every pair
of vertices is joined by an edge.
F The following graphs are complete graphs.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 249 / 354
...Cont’d
n(n − 1)
The number of edges of a complete graph with n vertices is given by m = .
2
Regular Graphs
A graph G is regular if all its vertices have the same degree. A regular graph G is r-
regular, or regular of degree r, if the degree of each vertex is r. For example, Kn is regular
of degree n − 1. Regular graphs of degree 3 are called cubic graphs.
F In the mathematical field of graph theory, the Petersen graph is an undirected
graph with 10 vertices and 15 edges. The following regular graph, called the Petersen
graph.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 250 / 354
...Cont’d
F The following graphs are all regular.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 251 / 354
...Cont’d
Theorem
nr
Let G be an r-regular graph with n vertices. Then G has m = edges.
2

Proof.
Let G be a graph with n vertices, each of degree r. Then the sum of the degrees of all the
vertices is nr. Hence, by the handshaking theorem, the number of edges is half of this
sum, which is m = nr2 .

Bipartite Graphs
A simple graph G is called bipartite if its vertex set V can be partitioned into two
disjoint sets V1 and V2 such that every edge in the graph connects a vertex in V1 and a
vertex in V2 (so that no edge in G connects either two vertices in V1 or two vertices in V2 ).
When this condition holds, we call the pair (V1 , V2 ) a bipartition of the vertex set V of G.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 252 / 354
...Cont’d

Consider the graph G as

Let V1 = {v1 , v3 , v5 , v7 } and V2 = {v4 , v2 , v6 , v8 }. Now, V1 ∩ V2 = ∅ and each edge of G


has one vertex in V1 and other vertex at V2 . So, G is said to be a bipartite graph.

Complete Bipartite Graphs


A complete bipartite graph Km,n is a graph that has its vertex set partitioned into two
subsets of m and n vertices, respectively with an edge between two vertices if and only if
one vertex is in the first subset and the other vertex is in the second subset.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 253 / 354
...Cont’d

Example
The complete bipartite graphs K1,5 , K2,2 , K2,4 , K3,3 are displayed in the figure below
and draw the graph with K3,5 , K2,6 , K2,3 and also compute the number of edges.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 254 / 354
Eulerian Graphs

Definition
A connected graph G is Eulerian if there is a closed trail containing every edge of G. We
call such a trail an Eulerian trail (G has an Euler circuit).

Theorem
A connected graph G is Eulerian if and only if every vertex has even degree. To find an
Eulerian trail in a given graph G, start in an arbitrary vertex and traverse along the edges,
ensuring all the edges are traversed before returning to the starting vertex.

If G is not Eulerian, but there is an open trail containing every edge of G, then G is
Semi-Eulerian ( G has an Euler path).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 255 / 354
...Cont’d

Theorem
A connected graph G is Semi-Eulerian if and only if precisely two of its vertices have
odd degree. To obtain a Semi-Eulerian trail in a given graph G, you must start at one of
the odd degree vertices and end in the other odd degree vertex.

F The following graphs are Eulerian (have an Euler circuit).

F In the first graph one Eulerian trail is given as bcgf egb.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 256 / 354
...Cont’d
F The following graph is Semi-Eulerian (has an Euler path).
Make the unlabelled graph G be labelled and try to find an Euler path.

The following graph is neither Eulerian nor Semi-Eulerian.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 257 / 354
Hamiltonian Graphs
Definition
A connected graph G is Hamiltonian if there is a simple circuit ( cycle) that passes
through every vertex of G. Such a cycle is a Hamiltonian cycle.

F If G is not Hamiltonian, but there is an open path which includes every vertex of G,
then G is semi-Hamiltonian (G has a Hamiltonian path).
F Consider the following unlabelled graphs.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 258 / 354
...Cont’d

Theorem (Ore’s Theorem)


Let G be a simple graph with n ≥ 3 vertices. If deg(u) + deg(v) ≥ n for each pair of
non-adjacent vertices u and v, then G has a Hamiltonian cycle.

Theorem (Dirac’s Theorem)


Let G be a simple graph with n ≥ 3 vertices. If deg(v) ≥ n/2 for every vertex v, then G
has a Hamiltonian cycle.

Both Ore’s and Dirac’s theorem provide sufficient conditions for a connected simple
graph to have a Hamilton cycle.

However, these theorems do not provide necessary conditions for the existence of a
Hamilton cycle.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 259 / 354
...Cont’d

For example, the graph C5 has a Hamilton cycle but does not satisfy the hypotheses
of either Ore’s or Dirac’s theorem.

Remark
The complete graphs Kn , n ≥ 3 are Hamiltonian.

Bipartite graphs can only be Hamiltonian if sets V1 and V2 of vertices have the same
number of vertices.
It follows that if the total number of vertices in a bipartite graph is odd, then it cannot
be Hamiltonian.

There is no known general criterion for testing whether a graph is semi-Hamiltonian


or not.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 260 / 354
...Cont’d

Example

F How many Hamiltonian cycles does Kn have?


If n = 2, there are no cycles, so we consider n ≥ 3. Suppose that the vertices of Kn
are 1, 2, · · · , n.

If we begin at vertex 1, there are n − 1 choices for the second vertex in a cycle, then
n − 2 choices for the third vertex and so on.
There are (n − 1)! Hamiltonian cycles.
(n − 1)!
Since a Hamiltonian cycle is an undirected cycle, there are different
2
Hamiltonian cycles in Kn .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 261 / 354
...Cont’d
Example

F Consider the following graphs:

(a) It is both Eulerian and Hamiltonian.


(b) It is Eulerian; an Eulerian trail is bcgf egb; it is not Hamiltonian;
(c) It is Hamiltonian; a Hamiltonian cycle is bcgef b; it is not Eulerian;
(d) It is neither Eulerian nor Hamiltonian.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 262 / 354
TREES

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

Theorem
An undirected graph G is a tree if and only if there is a unique simple path between any two
of its vertices. Any tree that has more than one vertex has at least one vertex of degree 1.

If G is a tree, then G is bipartite, i.e., all of its vertices can be labelled with either a
or b so that every edge is an ab edge (no aa or bb edges).

At each stage, the tree remains connected, so any two vertices must be connected by
at least one path.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 263 / 354
...Cont’d

However, they cannot be connected by more than one path, since any two such paths
would contain a cycle.

In particular, any two adjacent vertices are connected by exactly one path the edge
joining them. If this edge is removed, then there is no path between the two vertices.

It follows that the removal of any edge of a tree disconnects the tree. Moreover, any
two vertices v and w are connected by a path, and the addition of the edge vw
produces a cycle, the cycle consisting of the path and the added edge vw. So, joining
any two vertices of a tree by an edge creates a cycle.

Theorem
Let T be a tree with n vertices. Then the following statements are equivalent.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 264 / 354
...Cont’d

(i) T is connected and has no cycles.

(ii) T has n − 1 edges and has no cycles.

(iii) Any two vertices in T are connected by exactly one path.

(iv) T is connected and the removal of any edge disconnects T.

(v) T contains no cycle but the addition of any new edge to T creates exactly one cycle.

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

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 265 / 354
...Cont’d
F The following is an example of a forest.

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.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 266 / 354
...Cont’d

F A rooted tree has the following fundamental terminologies.

(a) Node: The main component of a tree is the node. This stores the actual data and
links to the other node.
(b) Child: Child of a node is the immediate successor of a node.
Child, which is at the left side, is called left child and the child, which is at the right
side, is called right child.
(c) Parent: Parent of a node is the immediate predecessor of a node.
(d) Root: A node that has no parent is termed as the root of the tree.
(e) Leaf: The node which is at the end and which doesn’t have any child is called leaf
node. Leaf node is also termed as terminal node and external node.
(f) Level: The level of a vertex v in a rooted tree is the length of the unique path from
the root to this vertex. The level of the root is defined to be zero.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 267 / 354
...Cont’d

(g) Height: The height h of a rooted tree is the maximum of the levels of vertices. In
other words, the height h of a rooted tree is the length of the longest path from the
root to any vertex.
F Consider the rooted tree (with root a) given below.

F Height of the rooted tree=maximum level=3.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 268 / 354
...Cont’d

(h) Sibling: The nodes, which have the same parent, are termed as siblings. In the
above figure h and i are siblings. Similarly, l and m are siblings.

(i) Ancestor: The ancestors of a vertex other than the root are the vertices in the path
from the root to this vertex, excluding the vertex itself and including the root (that
is, its parent, its parent’s parent, and so on, until the root is reached).

F The descendants of a vertex v are those vertices that have v as an ancestor.


Vertices that have children are called internal vertices.

F The root is an internal vertex unless it is the only vertex in the graph G, in
which case it is a leaf. If a is a vertex in a tree, the subtree with a as its root is the
subgraph of the tree consisting of a and its descendants and all edges incident to
these descendants.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 269 / 354
...Cont’d

Example
F In the rooted tree T (with root a) shown below, find the parent of c, the children of g,
the siblings of h, all ancestors of e, all descendants of b, all internal vertices, and all
leaves. What is the subtree rooted at g?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 270 / 354
...Cont’d
Solution: The parent of c is b. The children of g are h, i, and j. The siblings of h
are i and j. The ancestors of e are c, b, and a. The descendants of b are c, d, and e.
The internal vertices are a, b, c, g, h, and j. The leaves are d, e, f, i, k, l, and m.
The subtree rooted at g is given by

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 271 / 354
...Cont’d
Definition

A rooted tree is called an m-ary tree if every internal vertex has no more than m
children.
The tree is called a full m-ary tree if every internal vertex has exactly m children.
An m-ary tree with m = 2 is called a binary tree. A binary tree is a rooted tree in
which every parent has at most two children.
A complete m-ary tree is a full m-ary tree in which every leaf is at the same level.
A rooted m-ary tree of height h is balanced if all leaves are at levels h or h − 1.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 272 / 354
...Cont’d
Example
Are the rooted trees in the figure below full m-ary trees? m ∈ Z+ .

Solution: T1 is a full binary tree because each of its internal vertices has two children.
T2 is a full 3-ary tree because each of its internal vertices has three children. In T3 each
internal vertex has five children, so T3 is a full 5-ary tree. T4 is not a full m-ary tree for
any m because some of its internal vertices have two children and others have three
children.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 273 / 354
...Cont’d

Example
Which of the rooted trees shown below are balanced?

Solution: T1 is balanced, because all its leaves are at levels 3 and 4. However, T2 is not
balanced, because it has leaves at levels 2, 3, and 4. Finally, T3 is balanced, because all its
leaves are at level 3.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 274 / 354
...Cont’d

In a binary tree, if an internal vertex has two children, the first child is called the left
child and the second child is called the right child.

The tree rooted at the left child of a vertex is called the left subtree of this vertex, and
the tree rooted at the right child of a vertex is called the right subtree of the vertex.

Theorem
A tree with n vertices has e = n − 1 edges.

Theorem
If m is a positive integer and T is a full m-ary tree with k internal vertices, then T has a
total of n = mk + 1 vertices and has l = (m − 1)k + 1 terminal vertices (leaves).

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 275 / 354
...Cont’d

Proof.
Suppose k is a positive integer and T is a full m-ary tree with k internal vertices.
Observe that the set of all vertices of T can be partitioned into two disjoint subsets: the
set of all vertices that have a parent and the set of all vertices that do not have a parent.
Now there is just one vertex that does not have a parent, namely the root. Also, since
every internal vertex of a full m-ary tree has exactly m children, the number of vertices
that have a parent is m times the number of parents, or mk, since each parent is an
internal vertex.
Hence, [the total number of vertices of T]=[the number of vertices that have a
parent]+[the number of vertices that do not have a parent] = mk + 1.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 276 / 354
...Cont’d

But it is also true that the total number of vertices of T equals the number of internal
vertices plus the number of terminal vertices.

Thus, [the total number of vertices of T]=[the number of internal vertices]+[the


number of terminal vertices] = k + [the number of terminal vertices].

Now equate the two expressions for the total number of vertices of T:
mk + 1 = k+ [the number of terminal vertices].

Solving this equation gives, [the number of terminal vertices]


= (mk + 1) − k = (m − 1)k + 1.

Thus, the total number of vertices is n = mk + 1 and the number of terminal vertices
is l = (m − 1)k + 1.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 277 / 354
...Cont’d
Theorem
A full m-ary tree with
(i) n vertices has k = (n − 1)/m internal vertices and l = [(m − 1)n + 1]/m leaves.

(ii) k internal vertices has n = mk + 1 vertices and l = (m − 1)k + 1 leaves.

(iii) l leaves has n = (ml − 1)/(m − 1) vertices and k = (l − 1)/(m − 1) internal vertices.

Example
Suppose that someone starts a chain letter. Each person who receives the letter is asked to
send it on to four other people. Some people do this, but others do not send any letters.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 278 / 354
...Cont’d

How many people have seen the letter, including the first person, if no one receives
more than one letter and if the chain letter ends after there have been 100 people who
read it but did not send it out? How many people sent out the letter?

Solution: The chain letter can be represented using a 4-ary tree. The internal
vertices correspond to people who sent out the letter, and the leaves correspond to
people who did not send it out. Because 100 people did not send out the letter, the
number of leaves in this rooted tree is l = 100.

Hence, the number of people who have seen the letter is


n = (4 ∗ 100 − 1)/(4 − 1) = 133.
Also, the number of internal vertices is k = 133 − 100 = 33.
So, 33 people sent out the letter.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 279 / 354
...Cont’d
Theorem
There are at most mh leaves in an m-ary tree of height h.

Proof.
First, consider m-ary trees of height 1. These trees consist of a root with no more than m
children, each of which is a leaf. Hence, there are no more than m1 = m leaves in an
m-ary tree of height 1.
Assume that it is true for all m-ary trees of height less than h.
Let T be an m-ary tree of height h. The leaves of T are the leaves of the subtrees of T
obtained by deleting the edges from the root to each of the vertices at level 1.
Each of these subtrees has height less than or equal to h − 1. So, each of these rooted
trees has at most mh−1 leaves. Because there are at most m such subtrees, each with a
maximum of mh−1 leaves, there are at most m ∗ mh−1 = mh leaves in the rooted tree.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 280 / 354
...Cont’d

Corollary
 
If an m-ary tree of height h has l leaves, then
 h ≥ log m l . If the m-ary tree is full and
balanced, then h = logm l . (Recall that x is the smallest integer greater than or equal
to x.)

Proof.
We know that l ≤ mh . Taking
 logarithms
 to the base m shows that logm l ≤ h. Because h
is an integer, we have h ≥ logm l .
Now suppose that the tree is balanced. Then each leaf is at level h or h1, and because the
height is h, there is at least one leaf at level h. It follows that there must be more than
mh−1 leaves. Because l ≤ mh , we have mh−1 < l ≤ mh .Taking  logarithms to the base m
in this inequality gives h − 1 < logm l ≤ h. Hence, h = logm l .

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 281 / 354
...Cont’d

Definition
Let G be a connected graph. Then a spanning tree in G is a subgraph of G that includes
every vertex of G and is also a tree.

Example
The following diagram shows a graph G and three of its spanning trees.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 282 / 354
...Cont’d

Given a connected graph G, we can construct a spanning tree by using either of the
following two methods.

(i) Building-up method: Select edges of the graph G one at a time, in such a way that
no cycles are created; repeat this procedure until all vertices are included.

In the above graph G, we select the edges vz, wx, xy, yz, then no cycles are created.
We obtain the following spanning tree.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 283 / 354
...Cont’d

(ii) Cutting-down method: Choose any cycle and remove any one of its edges; repeat
this procedure until no cycles remain.
F From the above graph G, we remove the edges vy (destroying the cycle vwyv), yz
(destroying the cycle vwyzv), xy (destroying the cycle wxyw).

We obtain the following spanning tree.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 284 / 354
Planar Graphs
Definition
A graph G is called planar if it can be drawn in the plane without any edges crossing .
Such a drawing is called a planar representation of the graph G. A graph G is non-planar
if no plane drawing of G exists.

F A graph G may be planar even if it is usually drawn with crossings, because it may be
possible to draw it in a different way without crossings.
F Is K4 ( with two edges crossing) planar?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 285 / 354
...Cont’d
Solution: K4 is planar because it can be drawn without crossings, as shown below. Here
is a plane drawings.

F The graph K2,3 is planar.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 286 / 354
...Cont’d
Here is a plane drawing

F For some graphs, such as K3,3 , it is impossible to find a drawing that involves no
crossings, therefore, K3,3 is an example of non-planar graph.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 287 / 354
...Cont’d
F A planar representation of a graph splits the plane into regions, including an
unbounded region.
Definition
A plane graph divides the plane into regions called faces; one face is of infinite extent and
is the infinite face. If we denote the ith face by fi , then |fi | represents the number of edges
bordering fi .

Remark: The regions do not include the vertices and edges forming their boundaries.

Graph (i) has 4 faces and graph (ii) has 5 faces.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 288 / 354
...Cont’d
Theorem
Let G be a connected plane graph, and let n, m and f be the respective number of vertices,
Xf
edges and faces of G. Then |fi | = 2m.
i=1

Theorem (Euler’s Formula)


Let G be a connected planar simple graph with e edges and v vertices. Let r be the number
of faces in a planar representation of G. Then r = e − v + 2.

Example
Suppose that a connected planar simple graph has 20 vertices, each of degree 3. Into how
many regions (faces) does a representation of this planar graph split the plane?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 289 / 354
...Cont’d
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 ⇒ e = 30.
Consequently, from Eulers formula, the number of regions is
r = e − v + 2 = 30 − 20 + 2 = 12.

Corollary
(1) If G is a connected planar simple graph with e edges and v vertices, where v ≥ 3, then
e ≤ 3v − 6.

(2) If G is a connected planar simple graph, then G has a vertex of degree not exceeding
five.

(3) If a connected planar simple graph has e edges and v vertices with v ≥ 3 and no
circuits of length three, then e ≤ 2v − 4.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 290 / 354
Graph Coloring
Definition
A coloring of a simple graph G is the assignment of a color to each vertex of the graph G
so that no two adjacent vertices are assigned the same color and the graph G is said to be
k-colourable.

Definition
The chromatic number of a graph G is the least number of colors needed for a coloring of
this graph. The chromatic number of a graph G is denoted by χ(G).

Example
χ(G) = 1 iff G has no edges, that is, G is a null graph.
χ(G) = 2 iff G is bipartite and non-null.
χ(Kn ) = n, where Kn is a complete graph with n vertices.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 291 / 354
...Cont’d
χ(Ceven ) = 2 and χ(Codd ) = 3, where C is a cycle graph with even or odd number of
vertices.
Theorem (The Four Color Theorem)
The chromatic number of a planar graph G is no greater than four.

Example
What are the chromatic numbers of the graphs G and H shown in figure below?

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 292 / 354
...Cont’d

Solution:
χ(G) = 3 and χ(H) = 4.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 293 / 354
...Cont’d

Example (Scheduling Final Exams)


How can the final exams at a university be scheduled so that no student has two exams at
the same time?
Solution:
This scheduling problem can be solved using a graph model, with vertices representing
courses and with an edge between two vertices if there is a common student in the
courses they represent. Each time slot for a final exam is represented by a different
color. A scheduling of the exams corresponds to a coloring of the associated graph.

For instance, suppose there are seven finals to be scheduled. Suppose the courses are
numbered 1 through 7. Suppose that the following pairs of courses have common
students: 1 and 2, 1 and 3, 1 and 4, 1 and 7, 2 and 3, 2 and 4, 2 and 5, 2 and 7, 3 and
4, 3 and 6, 3 and 7, 4 and 5, 4 and 6, 5 and 6, 5 and 7, and 6 and 7.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 294 / 354
...Cont’d

The chromatic number of this graph is 4, four time slots are needed.

A coloring of the graph using four colors and the associated schedule are shown in
figure below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 295 / 354
...Cont’d
Exercise
Schedule the final exams for Math 115, Math 116, Math 185, Math 195, CS 101, CS 102,
CS 273, and CS 473, using the fewest number of different time slots, if there are no
students taking both Math 115 and CS 473, both Math 116 and CS 473, both Math 195
and CS 101, both Math 195 and CS 102, both Math 115 and Math 116, both Math 115 and
Math 185, and both Math 185 and Math 195, but there are students in every other pair of
courses.

Definition
An edge coloring of a graph is an assignment of colors to edges so that edges incident
with a common vertex are assigned different colors.
The edge chromatic number of a graph is the smallest number of colors that can be
used in an edge coloring of the graph. The edge chromatic number of a graph G is denoted
by χ0 (G).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 296 / 354
...Cont’d
Chromatic Polynomials
The chromatic polynomial is defined as the number of different colorings of a graph G using at
most k colors and denoted by ρG (k).

Example
Let H be the path on 3 vertices.

So, the chromatic polynomial is ρH (k) = k(k − 1)2 .


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 297 / 354
...Cont’d
Example
Null Graphs: If G = Nn is the null graph with n vertices, then
ρG (k) = k n .

Trees: If G = T is any tree with n vertices, then


ρG (k) = k(k − 1)n−1 .

Complete Graphs: If G = Kn is a complete graph with n vertices, then


ρG (k) = k(k − 1)(k − 2) . . . (k − n + 1).

Deletion-Contraction Theorem
G − e denotes the graph obtained from G by deleting edge e, and G\e denotes the graph
obtained by contracting e.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 298 / 354
...Cont’d
Theorem
Let e be an edge in a graph G, then ρG (k) = ρG−e (k) − ρG\e (k).

Example
Find the chromatic polynomial of G by applying the above result.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 299 / 354
...Cont’d
Solution:

ρG (k) = ρG−e (k) − ρG\e (k)


= k(k − 1)2 (k − 2)2 − k(k − 1)(k − 2)(k − 3)
= k(k − 1)(k − 2)[(k − 1)(k − 2) − (k − 3)]
= k(k − 1)(k − 2)(k 2 − 4k + 5)

Hence, ρG (1) = ρG (2) = 0, but ρG (3) = 12 . So, χG (k) = 3 and G has 12


three-colourings.

Note that the quadratic expression in ρG (k) cannot be factorized (unless complex
numbers are used), and that is why G could not be labelled in a conflict free manner.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 300 / 354
Chapter 6
Directed Graphs
Definition
A directed graph (digraph), consists of a set V of vertices(nodes) together with a set E of
ordered pairs of elements of V called edges(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 (arc) of the form (a, a) is represented using an arc from the vertex a back to
itself. Such an edge (arc) is called a loop.

Example
The directed graph with vertices {a, b, c, d} and edges
E = {(a, b), (a, d), (b, b), (b, d), (c, a), (c, b), (d, b)}
is displayed in figure below.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 301 / 354
...Cont’d

Exercise
(1) The directed graph of the relation
E = {(1, 1), (1, 3), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (4, 1)}
on the set of vertices {1, 2, 3, 4}. Sketch the digraph G.
(2) What are the ordered pairs in the relation R represented by the directed graph shown
in figure below?
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 302 / 354
...Cont’d

Definition
In a digraph D, two or more arcs joining the same pair of vertices in the same direction
are multiple arcs. A digraph G with no multiple arcs or loops is a simple digraph.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 303 / 354
...Cont’d
Example
A digraph (a) below has multiple arcs and digraph (b) has a loop, so neither is a simple
digraph. A digraph (c) has no multiple arcs or loops, and is therefore a simple digraph.

Definition
The vertices v and w of a digraph are adjacent vertices if they are joined (in either
direction) by an arc e. An arc e that joins v to w is incident from v and incident to w; v
is incident to e, and w is incident from e.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 304 / 354
...Cont’d

Example
In the digraph below, the vertices u and x are adjacent, vertex w is incident from arcs 2
and 5 and incident to arcs 3 and 4, and arc 6 is incident to (and from) the vertex x.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 305 / 354
...Cont’d
Definition
A sub digraph of a digraph D is a digraph all of whose vertices are vertices of D and all of
whose arcs are arcs of D. A digraph D is a sub digraph of itself.

Example
The following digraphs are all sub digraphs of the digraph D shown on the left with vertices
{u, v, w, x} and arcs {1, 2, 3, 4, 5, 6}.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 306 / 354
...Cont’d
Example
The following digraphs are all sub digraphs of the unlabelled digraph C on the left

Definition
The underlying graph of a digraph D is the graph obtained by replacing each arc of D by
the corresponding undirected edge.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 307 / 354
...Cont’d

Definition
In a digraph D, the in-degree of a vertex v, denoted by deg − (v), is the number of arcs
with v as their terminal vertex (incident to v). The out-degree of v, denoted by deg + (v),
is the number of arcs with v as their initial vertex (incident from v).

Remark
A loop at a vertex contributes 1 to both the in-degree and the out-degree of this vertex.

Example
Find the in-degree and out-degree of each vertex in the graph G with directed edges shown
in figure below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 308 / 354
...Cont’d

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 in G are:
deg + (a) = 4, deg + (b) = 1, deg + (c) = 2, deg + (d) = 2, deg + (e) = 3, and deg + (f ) = 0.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 309 / 354
...Cont’d
Exercise
Consider the digraph D given below and find the out-degree and in-degree of each
vertices of D.

Definition
The out-degree sequence of a digraph D is the sequence obtained by listing the out-degrees
of D in an increasing order, with repeats as necessary and the in-degree sequence of D is
defined analogously.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 310 / 354
...Cont’d

Theorem

Let D = (V, E) be a a digraph. Then

X X
deg − (v) = deg + (v) = |E|.
v∈V v∈V

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 311 / 354
Matrix Representation of Digraphs
Adjacency Matrix and Incidence Matrix

Definition
Let D be a digraph with n vertices labeled by v1 , v2 , v3 , . . . , vn . Then the adjacency matrix
A of D is an n × n matrix given by
 
a11 a12 . . . a1n
 a21 a22 . . . a2n 
A= .
 
.. .. .. 
 .. . . . 
an1 an2 . . . ann
(
k, if k be the number of arcs from vi to vj
where, aij =
0, otherwise.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 312 / 354
...Cont’d
Example
Find the adjacency matrix of the given directed multi-graph with respect to the vertices
listed in alphabetic order.

Solution:  
1 1 1 1
0 1 0 1
A=
1

0 1 0
1 1 1 1
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 313 / 354
...Cont’d
Exercise
Draw the digraph D corresponding to the adjacency matrix
 
0 0 1 1
0 0 1 0
A= 1 1 0

1
1 1 1 0

Definition
Let D be a digraph with n vertices
 and m arcs. Then
 the incidence matrix I of D is an
a11 a12 . . . a1m
 a21 a22 . . . a2m 
n × m matrix given by I =  .
 
. .. .. .. 
 . . . . 
an1 an2 . . . anm
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 314 / 354
...Cont’d

1,
 if arc j is incident from vertex i or arc j is outgoing
where, aij = −1, if arc j is incident to vertex i or arc j is incoming

0, otherwise.

Example
Find the incidence matrix which represents the digraph shown in figure below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 315 / 354
...Cont’d

Exercise
Draw the digraph represented by each of the following incidence matrices.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 316 / 354
Paths and Connectivity

Definition
A walk of length k in a digraph is a succession of k arcs of the form uv, vw, wx, . . . , yz.
This walk is denoted by uvwx . . . yz, and is referred to as a walk from u to z.
A trail is a walk in which all the arcs, but not necessarily all the vertices, are different.
A path is a walk in which all the arcs and all the vertices are different.

Example
In the following diagraph, the walk vwxyvwyzzu is a walk of length 9 from v to u, which
includes the arc vw twice and the vertices v, w, y and z twice. The walk uvwyvz is a trail
which is not a path, since the vertex v occurs twice, whereas the walk vwxyz has no
repeated vertices and is therefore a path.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 317 / 354
...Cont’d

Definition
A closed walk in a digraph is a succession of arcs of the form uv, vw, wx, . . . , yz, zu. A
closed trail is a closed walk in which all the arcs are different. A cycle is a closed trail
in which all the intermediate vertices are different.

In the digraph above, the closed walk uvwyvzu is a closed trail which is not a cycle
(since the vertex v occurs twice), whereas the closed trails zz, wxw, vwxyv and
uvwxyzu are all cycles.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 318 / 354
...Cont’d
Definition
A digraph is weakly connected (simply connected) if its underlying graph is a connected
graph, and is disconnected otherwise.
A digraph is strongly connected if for every pair of distinct vertices u and v in G,
there is a directed path from u to v and also from v to u.

Example (Consider the following digraphs)

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 319 / 354
...Cont’d

Digraph (a) is disconnected, since its underlying graph is a disconnected graph.

Digraph (b) is connected but is not strongly connected, since, there is no path from z
to y.

Digraph (c) is strongly connected, since there are paths joining all pairs of vertices.

Alternatively, you can think of driving around a one-way street system in a town. If
the town is strongly connected, then you can drive from any part of the town to any
other, following the directions of the one-way streets as you go.

If the town is merely connected, then you can still drive from any part of the town to
any other, but you may have to ignore the directions of the one-way streets.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 320 / 354
Eulerian and Hamiltonian Digraphs
Definition
A connected digraph is Eulerian if it contains a closed trail that includes every
arc; such a trail is an Eulerian trail.
A connected digraph is Hamiltonian if it contains a cycle that includes every
vertex; such a cycle is a Hamiltonian cycle.

Example
Consider the following four digraphs

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 321 / 354
...Cont’d

Digraph (a) is Eulerian, an Eulerian trail is abcdef gcegf a and Hamiltonian, a


Hamiltonian cycle is abcdegf a.

Digraph (b) is Eulerian, an Eulerian trail is bcgf egb, and it is not Han1iltonian.

Digraph (c) is Hamiltonian, a Hamiltonian cycle is bcdegf b, and it is not Eulerian.

Digraph (d) is neither Eulerian nor Hamiltonian.

Theorem
(1) A connected digraph is Eulerian if and only if, for each vertex, the out-degree equals
the in-degree.
(2) An Eulerian digraph can be split into cycles, no two of which have an arc in common.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 322 / 354
Chapter 7
Weighted Graphs and Their Applications
Definition
A weighted graph G is a graph in which each edge e has been assigned a nonnegative
number w(e) called the weight (or length) of e.

Example
The graph given below shows a weighted graph.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 323 / 354
...Cont’d
Definition
The weight (or length) of a path in a weighted graph G is defined to be the sum of the
weights of the edges in the path.
Remark
A weighted digraph is called a network.
Definition
A graph (or digraph) is known as a weighted graph (or digraph) if each edge of the graph
has some weights.
Example
Consider V = {1, 2, 3, 4, 5} & E = {e1 , e2 , e3 , e4 , e5 }, where e1 = (1, 2), e2 = (1, 3),
e3 = (2, 4), e4 = (3, 4), e5 = (4, 5) & w(e1 ) = 5, w(e2 ) = 6, w(e3 ) = 1, w(e4 ) = 6, w(e5 ) = 3.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 324 / 354
...Cont’d

Hence, the weighted graph G becomes

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 325 / 354
Application of Graphs

Minimal Spanning Trees

Definition
A minimal spanning tree in a connected weighted graph is a spanning tree that has
the smallest possible sum of weights of its edges.

Algorithms for Minimum Spanning Trees

(A) Kruskal’s Algorithm

To find a minimal spanning tree T of a connected weighted graph G where G has n


vertices (in which case T must have n − 1 edges).
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 326 / 354
...Cont’d

The procedures are: The input is a connected weighted graph G with n vertices.

Step 1: Arrange the edges in G in non-decreasing order of their weights.

Step 2: Choose an edge in G with the minimum weight.

Step 3: Add an edge of least weight to T if it does not form a cycle with the edges
already selected.

Step 4: Repeat step 3 until the number of edges selected is n − 1, where n denotes
the number of vertices in G.

Step 5: Exit

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 327 / 354
...Cont’d
Example
Using Kruskal’s Algorithm, find a minimal spanning tree for the following graph.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 328 / 354
...Cont’d
Solution:
Step 1: Arrange the edges in non-decreasing order of their weights.

Step 2: Choose edge (a, b) since it has the smallest weight, include it in T.

Step 3: An edge with the next smallest weight is (a, d). It does not form a cycle
with the edge in T, so include it in T.

Step 4: Edge (b, d) forms a cycle with the edges in T; discard it.

Step 5: Edge (b, e) does not produce a cycle with the edges in T; include it in T.

Step 6: Edge (a, e) creates a cycle; reject it.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 329 / 354
...Cont’d
Step 7: Edge (c, e) is selected.
Step 8: Edge (b, c), (c, d), (d, e) and (a, c) form a cycle, and rejected.

The weight of the minimal spanning tree is 7 + 10 + 11 + 12 = 40.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 330 / 354
...Cont’d
Exercise
Using Kruskal’s Algorithm, find a minimal spanning tree of the following weighted
graph.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 331 / 354
...Cont’d
(B) Prim’s Algorithm
Another method for finding a minimal spanning tree T, Prim’s Algorithm, was
discovered by the American engineer Robert Clay Prim in 1957.
F The following steps outline it.
Step 1: Arrange the edges in non-decreasing order of their weights.
Step 2: Choose an edge with the least weight.
Step 3: Include it in T.
Step 4: Select an edge of least weight that is incident with a vertex of an edge in T.
Step 5: If it does not create a cycle with the edges in T, then include it in T;
otherwise, discard it.
Step 6: Repeat steps 4 and 5 until T contains n − 1 edges.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 332 / 354
...Cont’d
Example
Using Prim’s Algorithm, construct a minimal spanning tree for the graph given below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 333 / 354
...Cont’d
Solution:
Step 1: Arrange the edges in non-decreasing order of weights.

Step 2: Choose an edge with the least weight: (a, b).


Step 3: Include it in T.
Step 4: Select a lightest edge incident with a or b. Edges (a, d) & (b, d) are two
candidates. Neither of them forms a cycle (a, b), so select one of them, say, (b, d).
Step 5: Adjoin it to T.
Step 6: Look for a lightest edge incident with a vertex in T; (a, d).
Step 7: Edge (a, d) creates a cycle in T; reject it.
Step 8: Edge (b, e) is the next candidate.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 334 / 354
...Cont’d
Step 9: Add it to T.
Step 10: Look for an edge incident with a vertex in T; (a, e) & (c, e) are two
possibilities.
Step 11: Edge (a, e) forms a cycle in T, so discard it.
Step 12: (c, e) does not produce a cycle, so include it in T.
T now contains 4 edges.
The weight of the minimal spanning tree is 7 + 10 + 11 + 12 = 40.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 335 / 354
...Cont’d
Remark
A connected weighted graph may have more than one minimal spanning tree. Nonetheless,
they weigh the same.

Shortest Path Problems

An algorithm discovered by the Dutch Mathematician Edsger Wybe Dijkstra in 1959.

Dijkstra’s Algorithm

F The basic steps of the algorithm are:


Step 1: To each vertex v of(G assign a label as follows:
0, if v = a(the initial vertex)
L(v) =
∞, if v 6= a.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 336 / 354
...Cont’d
F Define a set S − {a}
Step 2: Let v be a vertex of G which has most recently been added into S and
consider each vertex v not in S.
Then label v as follows.
(
L(u) + w(u, v), if L(u) + w(u, v) < L(v)
L(v) =
L(v), otherwise .

Step 3: Choose among the vertices not in S, a vertex v with the smallest label and
add it to S.
The choice could be also from vertices which are not in S but necessary adjacent to
the vertex u.
Step 4: Repeat step 2 and 3 until the destination vertex Z is added.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 337 / 354
...Cont’d
Example
What is the length of the shortest path between a to z in the weighted graph given below.

Solution:
Step 1: Initialization
L(a) = 0, L(v) = ∞, ∀v ∈ V (G) − {a}
S = {a}
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 338 / 354
...Cont’d

Step 2: The labeled vertices adjacent to a are b and c.

L(b) = min{∞, L(a) + W (a, b)}

L(b) = min{∞, 0 + 4}
L(b) = min{∞, 4}
L(b) = 4.
and
L(c) = min{∞, L(a) + W (a, c)}
L(c) = min{∞, 0 + 2}
L(c) = min{∞, 2}
L(c) = 2.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 339 / 354
...Cont’d
Step 3: vertex c is the one with the smallest label w/c is not yet in S.
Add c into S, i.e, S = {a, c}.
Vertices adjacent to c not in S are b, d and e.
L(b) = min{4, L(c) + W (c, b)}
L(b) = min{4, 2 + 1}
L(b) = min{4, 3}
L(b) = 3.
L(d) = min{∞, L(c) + W (c, d)}
L(d) = min{∞, 2 + 8}
L(d) = min{∞, 10}
L(d) = 10.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 340 / 354
...Cont’d

L(e) = min{∞, L(c) + W (c, e)}


L(e) = min{∞, 2 + 10}
L(e) = min{∞, 12}
L(e) = 12.

Step 4: vertex b is with minimum label which is not yet in S, add b into S, i.e,
S = {a, c, b}.
A vertex adjacent to b not an element of S is d.
L(d) = min{10, L(b) + W (b, d)}
L(d) = min{10, 3 + 5}
L(d) = min{10, 8} = 8.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 341 / 354
...Cont’d
Step 5: L(d) is updated (i.e, from 10 to 8).
Add d into S (i.e, S = {a, c, b, d})
Vertices adjacent to d not in S are e and z.
L(e) = min{12, L(d) + W (d, e)}
L(e) = min{12, 8 + 2}
L(e) = min{12, 10} = 10

L(z) = min{∞, L(d) + W (d, z)}


L(z) = min{∞, 8 + 6}
L(z) = min{∞, 14}
L(z) = 14.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 342 / 354
...Cont’d
Step 6: vertex e is the one with smallest label which is not yet in S.
Add e in to S (i.e, S = {a, c, b, d, e}.)
z is not yet in S (continues).
Vertex adjacent to e not in S is z.

L(z) = min{14, L(e) + W (e, z)}

L(z) = min{14, 10 + 3}
L(z) = min{14, 13}
L(z) = 13.
Now, z is the next selected vertex, i.e, S = {a, c, b, d, e, z}.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 343 / 354
...Cont’d
The shortest path from a to z is the unique path in the sub graph S, going a to z.
Its length or weight is L(z) = 13 and the shortest path is

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 344 / 354
...Cont’d
Critical Path Problems

Definition
The sequence of critical activities in a network is called the critical path. It is the
longest path from the starting event to the ending event in the network that defines the
minimum time required to complete the project.
This path identifies all the critical activities of the project and it is denoted by double
line in the network. For the activity (i, j) to lie on the critical path, the following
conditions must be satisfied:
(i) ESi = LFi
(ii) ESj = LFj
(iii) ESj − ESi = LFj − LFi = tij , where ESi & ESj are the earliest start and finish time
of event i and j; LFi and LFj are the latest start and finish time of event i and j.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 345 / 354
...Cont’d
F The procedure/method of finding the critical path in the network is called the critical
path method. The iterative procedure of determining the critical path is as follows:

Step 1: List all the jobs and then draw arrow (network) diagram. Each job is
included by an arrow with the direction of the arrow showing the sequence of jobs.
The length of the arrows has no significance. The arrows are placed based on the
predecessor, successor and concurrent relation within the job.
Step 2: Indicate the normal time (tij ) for each activity (i, j) above the arrow which
is deterministic.
Step 3: Calculate the earliest start time and earliest finish time for each event and
write the earliest time Ei for each event i.
Step 4: Tabulate the various times namely normal time, earliest time and latest time
on the arrow diagram.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 346 / 354
...Cont’d

Step 5: Determine the total float for each activity by taking the difference between
the earliest start and latest start time.

Step 6: Identify the critical activities and connect them with the beginning event
and the ending event in the network diagram by double line arrow, which gives the
critical path.

Step 7: Calculate the total project direction.

To find the earliest time we consider the tail event of the activity. Let the starting
time of the project, namely ES1 = 0.
Add the normal time with the starting time to get the earliest finish time. The
earliest starting time for the tail event of the next activity is given by the maximum
of the earliest time for the head event of the previous activity.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 347 / 354
...Cont’d

Similarly, to get the latest time, we consider the head event of the activity.
The latest finish time of the head event of final activity is given by the target time of
the project.
The latest start time can be obtained by subtracting normal time of that activity.

The latest finish time for the head event of the next activity is given by the minimum
of the latest start time for the tail event of the previous activity.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 348 / 354
...Cont’d
Example
Find the critical path for a project network shown below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 349 / 354
...Cont’d
Solution:

First we calculate the value of the earliest start time (ESi ) and the earliest finish
time (ESj ). The earliest time for the event ij’s calculated by Ej = max(ESi + tij ).
Thus, we have

E1 = ES1 = 0. This is obtained by letting ES1 = 0.

E2 = ES2 = ES1 + t12 = 0 + 4 = 4


E3 = ES3 = ES1 + t13 = 0 + 1 = 1
E4 = ES4 = max(ES2 + t24 , ES3 + t34 )
= max(4 + 1, 1 + 1) = max(5, 2) = 5
E5 = ES5 = ES3 + t35 = 1 + 6 = 7
E6 = ES6 = ES5 + t56 = 7 + 4 = 11
E7 = ES7 = ES5 + t57 = 7 + 8 = 15
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 350 / 354
...Cont’d
E8 = ES8 = max(ES6 + t68 , ES7 + t78 ) = max(11 + 1, 15 + 2)
= max(12, 17) = 17
E9 = ES9 = ES4 + t49 = 5 + 5 = 10
E10 = ES10 = max(ES9 + t9 10 , ES8 + t8 10 )
= max(10 + 7, 17 + 5) = max(17, 22) = 22.
Next we calculate the latest start time and the latest finish time.
The latest time Li for an event i is obtained by
Li = min(LFj − tij ),
where LFj is the latest finish time for the event j and tij is the normal time of the
activity.
Hence, we start with L10 = 22 and L9 = L10 − t9 10 = 22 − 7 = 15.
By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 351 / 354
...Cont’d

L8 = L10 − t8 10 = 22 − 5 = 17

L7 = L8 − t78 = 17 − 2 = 15

L6 = L8 − t68 = 17 − 1 = 16

L5 = min(L6 − t56 , L7 − t57 ) = min(16 − 4, 15 − 8) = 7

L4 = L9 − t49 = 15 − 5 = 10

L3 = min(L4 − t34 , L5 − t35 ) = min(10 − 1, 7 − 6) = 1

L2 = L4 − t24 = 10 − 1 = 9

L1 = min(L2 − t12 , L3 − t13 ) = min(9 − 4, 1 − 1) = 0.


By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 352 / 354
...Cont’d
Therefore, we obtain the critical path to be
1 → 3 → 5 → 7 → 8 → 10
as shown by double arrows in the following network with the total project duration of
22.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 353 / 354
...Cont’d

Exercise
Find the critical path for a project network shown below.

By:Fikrie Melkamu (MSc) Discrete Mathematics & Combinatory Sep, 2024 354 / 354

You might also like