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

Discrete Maths

Uploaded by

essilfieobed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Discrete Maths

Uploaded by

essilfieobed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 167

Institute of Distance Learning, KNUST

Template
For
Course Material

A 3-credit course outlay

2011
Updated

i
KWAME NKRUMAH UNIVERSITY OF SCIENCE AND
TECHNOLOGY, KUMASI

INSTITUTE OF DISTANCE LEARNING


(BSC COMPUTER SCIENCE, FIRST YEAR)

CSM 166: DISCRETE MATHEMATICS FOR COMPUTER


SCIENCE II
[Credit: 3]

YAO ELIKEM AYEKPLE

ii
Publisher’s I nform ation

© IDL, 2011

All rights reserved. No part of this book may be reproduced or utilized in any form or by any
means, electronic or mechanical, including photocopying, recording or by any information
storage and retrieval system, without the permission from the copyright holders.

For any information contact:

Dean
Institute of Distance Learning
New Library Building
Kwame Nkrumah University of Science and Technology
Kumasi, Ghana

Phone: +233-51-60013
+233-51-61287
+233-51-60023

Fax: +233-51-60014

E-mail: [email protected]
[email protected]
[email protected]
[email protected]

Web: www.idl-knust.edu.gh
www.kvcit.org

ISBN:

Editors:

iii
Publisher’s notes to the Learners:

1. Icons: - the following icons have been used to give readers a quick access to where similar
information may be found in the text of this course material. Writer may use them as and when
necessary in their writing. Facilitator and learners should take note of them.

Icon #1 Icon #2 Icon #3 Icon #4 Icon #5

Learning Objective Learning Activity Unit Assignments



Review

Summary
Icon #6 Icon #7 Icon #8 Icon #9 Icon #10


Time For Activity

Self Assessment

Group Discussion
 Read

New Terms
Icon #11 Icon #12 Icon #13 Icon #14 Icon #15


Answer Tips Note/Learning Tip

Pause
 
Online
Interactive CD

2. Guidelines for making use of learning support (virtual classroom, etc.)

This course material is also available online at the virtual classroom (v-classroom) Learning
Management System. You may access it at www.kvcit.org

iv
Course Writer

Course writer:

YAO ELIKEM AYEKPLE


MSc. MATHEMATICS
LECTURER
DEPARTMENT OF MATHEMATICS

Course developer:

YAO ELIKEM AYEKPLE


MSc. MATHEMATICS
LECTURER
DEPARTMENT OF MATHEMATICS

v
Acknowledgement
I want to thank the almighty God for the knowledge and power granted me to produce this piece.

I am also grateful to the following persons without whose effort this piece might not have been a reality.

1. Mr. Robert Acquah, demonstrator at the mathematics department, KNUST.


2. Mr. Moses Obiri Yeboah, a teaching assistant at the mathematics department,KNUST.

vi
Course Introduction
Discrete Mathematics is essentially that branch of mathematics that does not depend on
limits; in this sense, it is the anti-thesis of Calculus. As computers are discrete object
operating one jumpy, discontinuous step at a time, Discrete Mathematics is the right
framework for describing precisely Computer Science concepts. Elucidate

COURSE OVERVIEW
The course starts with combinatorial analysis. Combinatorial analysis deals with counting
techniques, an important concept in programming design. This is to establish several techniques
for counting large finite sets without actually listing their elements. We expatiate on the
techniques of counting as already treated under permutations and combinations and binomial
expansion which is very much linked with combinations. From binomial, we extend to
multinomial expansion and coefficients.

Often it is difficult to express the members of an object or numerical sequence explicitly. In


other to generate infinite set of numbers, we look at recurrence relation, or simply put
algorithm. We then add the study of the discrete analogue of differential equations. We will also
look into the basic mathematical logic behind language of computer usage. This will help ease
up complex structures in the complex language of the computer.

Since most students are familiar with mathematical relations such as “is a subset of”,” is less
than” and so on, one frequently want to compare or contrast various members of a set by
trying to arrange them in some appropriate order, or perhaps, to group together those with
similar properties. The mathematical framework to describe this kind of organization of sets is
the theory of relations. There are two kinds of relations, equivalence relations and order
relations which we will discuss.

We end the course with basic basic concepts related to graphs and trees which has use in car
navigation system, efficient database, build a boot to retrieve info off WWW, representing
computational models and many other applications.

vii
COURSE OBJECTIVES
1. Count large finite sets without listing them.
2. Have a recurrent relation that can generate infinite sets
3. Understand the mathematical logic behind the use of computer.
4. Use a mathematical framework to organise structures in computer.

COURSE OUTLINE

• Unit 1: FUNDAMENTALS OF COUNTING

• Unit 2: MULTINOMIAL EXPANSION AND COEFFICIENT

• Unit 3: RECURRENCE RELATION AND LINEAR DIFFERENCE METHOD

• Unit 4: BOOLEAN ALGEBRA AND LOGIC GATE

• Unit 5: RELATION AND ORDER IN SET

• Unit 6: ELEMENTS OF GRAPH THEORY

COURSE STUDY GUIDE


This provides a monthly/weekly schedule of progress of your learning.

Week # Unit/Session FFFS/Practical/Exam/Quiz


1 1/1.1,1.2 FFFS
2 2/2.1,2.2 FFFS
3 3/3.1,3.2 FFFS/Quiz
4 4/4.1,4.2 FFFS
5 5/5.1,5.3 FFFS
6 6/6.1,6.2 FFFS/Quiz

GRADING
Continuous assessment: 30%
End of semester examination: 70%

RESOURCES
Choose an item.

viii
You will require Click here to enter text.for this course.
To complete this course you would need to accomplish [theory], [number of
laboratory/workshop/ practical/ tutorial] and 3 credits

REFERENCES
1. Kenneth A. Ross and Charles R. B. Wright.(1985), Discrete Mathematics. First Edition,
Prentice – Hall, Inc, Englewood Cliffs, N.J. 07632
2. Seymour Lipschutz and Marc Lars Lipson.(1992), Discrete Mathematics. Second
Edition,McGraw – Hill Inc.
3. Marcel B. Finan, Arkansas Tech University
4. W W L CHEN(1982,2008), Imperial College, University of London.

ix
Table Of Contents

Publisher Information .................................................................................................................... iii


Course Writer.................................................................................................................................. v
Acknowledgement .......................................................................................................................... vi
Course Introduction ...................................................................................................................... vii
Table Of Contents ........................................................................................................................... x
List Of Tables .................................................................................Error! Bookmark not defined.
List Of Figures ...............................................................................Error! Bookmark not defined.
List Of Appendices .........................................................................Error! Bookmark not defined.

Unit 1 .............................................................................................................................................. 1
FUNDAMENTALS OF COUNTING ...........................................Error! Bookmark not defined.
SESSION 1-1: Elements of Counting ..................................................................................... 2
1-1.1 Sum Rule Principle .......................................................................................................... 2
1-1.2 Product Rule Principle ................................................................................................... 5
SESSION 2-1: Permutation and Combination ..................................................................... 8
2-1.1 Permutation .................................................................................................................... 8
2-1.2 Ordered Sample ............................................................................................................ 10
2-1.3 Combination .................................................................................................................. 12
2-1.4 Tree Diagram ................................................................................................................ 20

Unit 2 ............................................................................................................................................ 24
MULTINOMIAL EXPANSION AND COEFFICIENT .............................................................. 24
SESSION 1-2: Binomial Coefficients ................................................................................... 25
SESSION 2-2: Multinomial Coefficients................................................................................ 31

Unit 3 ............................................................................................................................................ 35
RECURRENCE RELATION AND LINEAR DIFFERENCE METHOD .................................. 35
SESSION 1-3: The Difference Operator .............................................................................. 36
SESSION 2-1: Recurrence Relations -Finite Difference Equations .............................. 42
2-3.1 Recursion...................................................................................................................... 42
2-3.2 Classification of Recurrence Relations ........................................................................ 54
2-3.3 The Homogeneous Case ............................................................................................... 61
2-3.4 The Non-Homogeneous Case....................................................................................... 73

Unit 4 ............................................................................................................................................ 85
BOOLEAN LOGIC ...................................................................................................................... 85
SESSION 1-4: Boolean Algebra and Function ...................................................................... 86
1-4.1 Basic Definitions and Theory....................................................................................... 86
1-4.2 Boolean Expressions and Functions............................................................................. 89
1-4.3 Duality .......................................................................................................................... 95
1-4.4 Representation of Boolean Functions .......................................................................... 98
SESSION 2-4: Logic Gates .................................................................................................... 107
2-4.1 Logic Gates Forms ..................................................................................................... 107

x
2-4.2 Combinations of Gates ............................................................................................... 109
2-4.3 Examples of Circuit.................................................................................................... 113

Unit 5 .......................................................................................................................................... 120


RELATION AND ORDER IN SET ........................................................................................... 120
SESSION 1-5: Relations ........................................................................................................ 121
1-5.1 Relations in a set ........................................................................................................ 121
1-5.2 Equivalence Relations ................................................................................................ 122
SESSION 2-5: Ordering of a set ........................................................................................... 126
2-5.1 Partial Ordering .......................................................................................................... 126
2-5.2 Subsets of Ordered Sets.............................................................................................. 129
2-5.3 First and Last Elements .............................................................................................. 130
2-5.4 Maximal and Minimal Elements ................................................................................ 131

Unit 6 .......................................................................................................................................... 138


ELEMENTS OF GRAPH THEORY .......................................................................................... 138
SESSION 1-6:Basics of Graphs ............................................................................................ 139
1-6.1 Definitions .................................................................................................................. 139
1-6.2 Complete Graph ......................................................................................................... 142
1-6.3 Degree ........................................................................................................................ 145
SESSION 2-6: Paths and Circuits ........................................................................................ 148
2-6.1 Paths ........................................................................................................................... 148
2-6.2 Connectivity ............................................................................................................... 150
2-6.3 Euler Path and Circuit ................................................................................................ 151
2-6.4 Hamiltonian Path and Circuit ..................................................................................... 151

xi
Unit 1
FUNDAMENTALS OF COUNTING

Introduction

Counting of large finite sets has been on the major hurdles in mathematics. The major goal of
this unit is to establish several techniques for counting large finite sets without actually listing
their elements. There are two basic counting principles used throughout. One involves addition
and the other multiplication.

Learning Objectives

After reading this unit you should be able to:

1. Count large finite sets without listing them


2. Arrange objects with or without replacement
3. Arrange objects in an orderly manner
4. Difference between the permutation and combination
5. Enumerate all the logical possibilities of a sequence of
events.

Unit content

Session 1-1: Elements of Counting


1-1.1 Sum Rule Principle
1-1.2 Product Rule Principle
Session 2-1: Permutation and Combination
2-1.1 Permutation
2-1.2 Ordered Sample
2-1.3 Combination
2-1.4 Tree Diagram

1
SESSION 1-1: ELEMENTS OF COUNTING

1-1.1 Sum Rule Principle


For a set X , X denotes the number of elements in X . It is easy to see that

for any two sets A and B we have the following result known as the
Inclusion- Exclusion Principle

A∪ B = A + B − A∩ B .

Indeed, A gives the number of elements in A including those that are common

to A and B . The same holds for B . Hence, A + B includes twice the

number of common elements. Hence, to get an accurate count of the elements


of A ∪ B , it is necessary to subtract A ∩ B from A + B .

Note that if A and B are disjoint then A ∩ B =


0 and consequently

A∪ B = A + B .

The first counting principle (Sum Rule Principle ): Suppose some event A can
occur in m ways and a second event B can occur in n ways, and suppose both
events cannot occur simultaneously. Then A or B can occur in m + n ways.

In other words (Sum Rule Principle ): Suppose A and B are disjoints sets.

Then A ∪ B = A + B .

Clearly, the principle can be extended to three or more events. Specifically,


suppose an event A1 can occur in n1 ways, an event A2 can occur in n2 ways,

an event A3 can occur in n3 ways, and so on, and suppose no two of the

events can occur at the same time. Then one of the events can occur in
n1 + n2 + n3 + ways.

2
Example 1.1 (The Addition Rule)

Show by induction on n , that if { A1, A2 ,..., An } is a collection of pairwise disjoint


sets then

A1 ∪ A2 ∪ ... ∪ An = A1 + A2 + ... + An

Solution:

Basis of induction: For n = 2 the result holds by the Inclusion-Exclusion Principle.

Induction hypothesis: Suppose that for any collection { A1, A2 ,..., An } of pairwise

disjoint sets we have

A1 ∪ A2 ∪ ... ∪ An = A1 + A2 + ... + An .

Induction step: Let { A1 , A2 ,..., An , An+1} be a collection of pairwise disjoint sets.


Since

( A1 ∪ A2 ∪ ... ∪ An ) ∩ An+1 =
( A1 ∩ An+1 ) ∪ ( A2 ∩ An+1 ) ∪ ( An ∩ An+1 ) =

then by the Inclusion-Exclusion Principle and the induction hypothesis we have

A1 ∪ A2 ∪ ... ∪ An ∪ An+1 = A1 ∪ A2 ∪ ... ∪ An + An+1

= A1 + A2 +  + An + An+1

3
Example 1.2

A total of 35 programmers interviewed for a job; 25 knew FORTRAN, 28 knew


PASCAL, and 2 knew neither language. How many knew both languages?

Solution:

Let A be the group of programmers that knew FORTRAN, B those

Who knew PASCAL. Then A ∩ B is the group of programmers who knew both
languages. By the Inclusion-Exclusion Principle we have:

A∪ B = A + B − A∩ B .

That is,

33 = 25 + 28 − A ∩ B .

Solving for A ∩ B we find A ∩ B =


20 |.

4
1-1.2 Product Rule Principle
Another important rule of counting is the multiplication rule.

The second Rule Principle (Product Rule Principle ): Suppose there is an event
A which can occur in m ways and, independent of this event, there is a second
event B which can occur in n ways. Then combinations of A and B can occur
in mn ways.

In other words (Product Rule P rinciple ): Suppose A and B are finite sets.

Then A × B = A ⋅ B

Clearly, the principle can be stated as: If a decision consists of k steps, where
the first step can be made in n1 different ways, the second step in n2 ways,…,

the k th step in nk ways, then the decision itself can be made in n1 ⋅ n2 ⋅  ⋅ nk

ways.

For example,

. Tossing a coin has two possible outcomes and tossing a die has six
possible outcomes. Then the combined experiment, tossing the coin and
die together results in 2 × 6 = 12 possible outcomes:
H 1, H 2, H 3, H 4, H 5, H 6, T 1, T 2, T 3, T 4, T 5, T 6

. The number of different ways for a man to get dressed if he has 8


different shirts and 6 different pairs of trousers is 8 × 6 = 48

. The number of ways a three-figure integer be formed from the numbers,


4, 3, 5, 6 and 7 if no number is used twice or more is 5 × 4 × 3 = 60.

5
Example 1.3

1. Suppose a college has 3 different computer science courses, 4 different


mathematics courses, and 2 different actuarial courses (with no
prerequisites)
a) There are n = 3 + 4 + 2 = 9 ways to choose 1 of the courses.

=
b) There are n (=
3)( 4 )( 2 ) 24 ways to choose one of each of the
courses.
2. Suppose Airline A has three daily flights between Kumasi and Accra, and
Airline B has two daily flights between Kumasi and Accra
a) There are n = 3 + 2 = 5 ways to fly from Kumasi to Accra.

b) There =
are n (=
3)( 2 ) 6 ways to fly Airline A from Kumasi to Accra,
and then Airline B from Accra back to Kumasi.
c) There =
are n (=
5 )( 5 ) 25 ways to fly from Kumasi and Accra , and
then back again.

3. How many possible outcomes are there if 2 distinguishable dice are


rolled?
4. Suppose that a state’s license plates consist of 3 letters followed by four
digits. How many different plates can be manufactured?(No repetitions)

Solution:

3. By the multiplication rule there are 6 × 6 =36 possible

outcomes.

4. By the multiplication rule there are


26 × 25 × 24 × 10 × 9 × 8 × 7 =78,624,000 possible license plates.

6
Example 1.3

Let ∑ ={a, b, c, d } be an alphabet with 4 letters. Let ∑ be the set of all words
2

of length 2 with letters from ∑ . Find the number of all words of length 2
where the letters are not repeated. First use the product rule. List the words by
means of a tree diagram.

Solution:

By the multiplication rule there are 4 × 3 =


12 different words. Constructing a
tree diagram:

a b c d

c a c d a b d a b c
b d

we find that the words are:

{ab, ac, ad , ba, bc, bd , ca, cb, cd , da, db, dc}


Applying the multiplication principle, results in the other two counting
techniques, namely Permutation and Combination, used to find the number of
possible ways when a fixed number of items are to be picked from a lot without
replacement

7
SESSION 2-1: PERMUTATION AND COMBINATION

2-1.1 Permutation
Any arrangement of a set of n object in a given order is called a permutation of
the objects (taken all at a time). Any arrangement of any r ≤ n of those objects
in a given order is called an r -permutation of n objects or a permutation of the
n objects taken r at a time. In symbol P ( n, r ) , is an ordered selection of r
objects from a given n objects.

Consider, for example, the set of letters a, b, c, and d . Then:

a) abcd , bcda, acdb, and dcba are permutations of the four letters (taken all at

a time);
b) bad , adb, cbd , and bca are permutations of the four letters taken three at a

time;
c) ad , cb, da, and bd are permutations of the four letters taken two at a time.

Example 1.4

n!
a) Use the product rule to show that P ( n, r ) =
( n − r )!
b) Find all possible 2 - permutations of the set {1, 2, 3} .

Solution:

a) We can treat a permutation as a decision withr steps. The first step can
be made in n different ways, the second in n − 1 different ways, ..., the r th in

n − ( r − 1) = n − r + 1 different ways. Thus, by the multiplication rule there

are n ( n − 1) · · · ( n − r + 1) r - permutations of n objects.

8
n!
That is P ( n, r ) = n ( n − 1)( n − r + 1=
)
( n − r )!

3!
b) P (=
3, 2 ) = 6
( 3 − 2 )!

Example 1.5

How many license plates are there that start with three letters followed by 4
digits (no repetitions)?

Solution:

P ( 26, 3) · P (10, 4 ) = 78, 624, 000

An ordered arrangement of objects is called a permutation. The number of


permutations of

(i) n distinct objects, taken all together is n! =

n (n − 1)(n − 2) × ... × 3 × 2 × 1
n!
(ii) n distinct objects taken r at a time is n Pr or P(n, r ) = , where
(n − r )!
r ≤ n.
(iii) n objects consisting of groups of which n1 of the first group are alike, n2
of the second group are alike and so on for the k th group with nk objects

n!
which are alike is , where n = n1 + n2 + . . . + nk
n1 !. n2 !. n3 ! . . .nk !

(iv) n distinct objects arranged in a circle, called circular permutations is


given by

n!
= (n − 1)!.
n

9
For example,

1. The number of possible permutations of the letters, A, B and C is


3! = 6. The required permutations are ABC, BAC, ACB, BCA, CAB and

CBA.
2. The number of permutations of 10 distinct digits taken two at a time
10!
= 10
P2 = = 10 × 9 = 90.
(10 − 2)!

3. The number of permutations of the letters forming the following 14-


letter word, S C I E N T I F I C A L L Y, which contains 2C’s, 3I’s, 2L’s,
14!
and 1’s of the rest of letters = = 3,632,428,800
2!.3!.2!

4. The number of circular permutations of 6 persons sitting around a


circular table
= 5! = 120

2-1.2 Ordered Samples


When we choose one element after another from the set S containing n
elements, say r times, we call the choice an ordered sample of size r . We
consider two cases:

I. Sampling with replacement


Here the element is replaced in the set S before the next element is
chosen. Since there are n different ways to choose each element
(repetitions are allowed), the product rule principle tells us that there are
 
r times

n ⋅ n ⋅ n n =nr
different ordered samples with replacement of size r.

10
II. Sampling without replacement
Here the element is not replaced in the set S before the next element is
chosen. Thus there are no repetitions in the ordered sample. According,
an ordered sample of sizer without replacement is simply an r −
permutation of the elements in the set S with n elements. Thus there
are
n!
P ( n, r =
) n ( n − 1)( n − 2 )( n − r + 1=)
( n − r )!
different ordered samples without replacement of size r from a
population (set) with n elements. In other words, by the product rule, the
first element can be chosen in n ways, the second in n − 1 ways, and so
on.

Example 1.6

Three cards are chosen in succession from a deck with 52 cards. Find the
number of ways this can be done (a) with replacement (b) without
replacement.

Solution:

a) Since each card is replaced before the next card is chosen, each card
can be chosen in 52 ways. Thus there are

52 ( 52 )( 52
= ) 52=3 140,608
different ordered samples of size r = 3 with replacement.

b) Since there is no replacement, the first card can be chosen in 52 ways,


the second card in 51 ways, and the last card 50 ways. Thus there are

11
P ( 52,3
= ) 52 ( 52 − 1) ( 52 − ( 3 − 1) )
= 52 ( 52 − 1)( 52 − 3 + 1)
= 52
= ( 51)( 50 ) 132,600
different ordered samples of size r = 3 without replacement.

2-1.3 Combination
Suppose we have a collection of n objects. A combination of these n objects
taken r at a time is any selection of r of the objects without taking order in
account. An r - combination of n objects, in symbol C ( n, r ) , is an unordered
selection of r of the n objects. In other words, an r − combination of a set of n
objects is any subset of r elements. But the number of different ways that r
objects can be ordered is r !. Since there are C ( n, r ) groups of r objects from
a given n objects then the number of ordered selection of r objects from n
given objects is r !C ( n, r ) = P ( n, r ) .Thus

P ( n, r ) n! n
( n, r )
C= = =  .
r! r !( n − r )!  r 

For example, the combinations of the letters a, b, c, d taken three at a time are:

{a, b, c},{a, b, d },{a, c, d },{b, c, d } or simply abc, abd , acd , bcd

Observe that the following combinations are equal:

abc, acb, bac, bca, cab, cba

That is, each denotes the same set {a, b, c}

12
Example 1.7

Find the number of combinations of four objects, a, b, c, d taken three at a time.

Solution:

Each combination consisting of three objects determines 3! = 6 permutations of


the objects in the combination. Thus the number of combination multiplied by 3!
equals the number of permutations. That is:

P ( 4,3)
C ( 4,3) ⋅ 3! =P ( 4,3) or C ( 4,3) =
3!

But P ( 4,3) = 4 ⋅ 3 ⋅ 2 = 24 and 3! = 6 . Thus C ( 4,3) = 4 , which is shown in the

table below:

Combinations Permutations

abc abc, acb, bac, bca, cab, cba

abd abd , adb, bad , bda, dab, dba

acd acd , adc, cad , cda, dac, dca

bcd bcd , bdc, cbd , cdb, dbc, dcb

Example 1.8

In how many different ways can a hand of 5 cards be selected from a deck of
52 cards? (no repetition)

13
Solution:

C ( 52,5 ) = 2, 598, 960

Example 1.9

Prove the following identities:

a) C ( n,0
= ) C ( n,=
n ) 1 and C ( n=
,1) C ( n, n −=
1) n .

b) Symmetry property: C ( n, r ) = C ( n, n − r ) , r ≤ n .

c) Pascal’s identity: C ( n + 1,=


k ) C ( n, k − 1) + C ( n, k ) , n ≤ k .

Solution:

a) Follows immediately from the definition of C ( n, r ) . Check yourself.

b) Indeed, we have

n! n!
C ( n, n −=
r) = = C ( n, r )
( n − r )!( n − n + r )! r !( n − r )!

n! n!
c) C ( n, k=
− 1) + C ( n, k ) +
( k − 1)!( n − k + 1)! k !( n − k )!

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

n! ( n + 1)! =
= ( k + n − k + 1=) C ( n + 1, k )
k !( n − k + 1)! ( n + 1 − k )!

14
Example 1.10

1. Find the number m of committees of three that can be formed from eight
people. Each committee is, essentially, a combination of the eight people
take three at a time.
Solution:

8 8 ⋅ 7 ⋅ 6
m C ( 8,3
= = ) = = 56
 
3 1 ⋅ 2 ⋅3

2. A farmer buys three cows, two pigs, and four hens from a man who has six
cows, five pigs, and eight hens. How many choices does the farmer have?
Solution:

6 5
The farmer can choose the cows in   ways, the pigs in   ways, and the
3  2
8 
hens in   ways. Hence altogether he can choose the animals in
 4
 6 5  8 
 3  ⋅  2  ⋅  4  = 20 ⋅ 10 ⋅ 70 = 14,000 ways
     
3. Find the number m of ways that 9 toys can be divided between 4 children if
the youngest is to receive 3 toys and each of the others 2 toys.
Solution:
There are C ( 9,3) = 84 ways to first choose 3 toys for the youngest. Then

there are C ( 6,2 ) = 15 ways to choose 2 of the remaining 6 toys for the

oldest. Next, there are C ( 4,2 ) = 6 ways to choose 2 of the remaining 4 toys

for the second oldest. The third oldest receives the remaining 2 toys. Thus,
by the product rule:
= =
m 84 (15)( 6 )(1) 7560
15
Example 1.11

1.11(a) (i) In how many ways can a three-figure integer is formed from
the numbers: 4, 3, 5, 6 and 7 if any number can be used more than once?

(ii) In a certain examination paper, students are required to answer 5 out of


10 questions from Section A another 3 out of 5 questions from Section B and 2
out of 5 questions from Section C. In how many ways can the students answer
the examination paper?

Solution:

(i) The first, second and third numbers, each can be chosen in 5 ways. The
total number of ways = 5 × 5 × 5 = 125

(ii) The number of ways of answering the questions in Section A

= 10 × 9 × 8 × 7 × 6 = 30,240

The number of ways of answering the questions in section B

= 5 × 4 × 3 = 60

The number of ways of answering the questions in section C

= 5 × 4 = 20

Hence the students can answer the questions in the three sections in

= 30,240 × 60 × 20 = 36,288,000

1.11(b) A company codes its customers by giving each customer an eight


character code. The first 3 characters are the letter A, B and C in any order and
the remaining 5 are the digits 1, 2, 3, 4 and 5 also in any order. If each letter

16
and digit can appear only once then number of customers the company can
code is obtained as follows:

The first 3 letters can be filled in 3!

The next 5 digits can be filled in 5!

Then the required number = 3! × 5! = 720

1.11(c) In many ways can 4 boys and 2 girls seat themselves in a row if :

(i) The 2 girls are to sit next to each other?

(ii) The 2 girls are not to sit next to each other?

Solution:

(i) If we regard the 2 girls as a separate persons (B1 B2 B3 B4 G1G2), then the
number of arrangements of 5 different persons, taken all at a time = 5!

The 2 girls can exchange places and so the required number of ways they can
seat themselves = 5! × 2! = 240

(ii) The number of ways the boys can arrange themselves = 4!

The number of ways the 2 girls can occupy the arrowed places:

B1 B2 B3 B4 = 5
P2 = 5 × 4

The required number of permutations (with the 2 girls not sitting next to each
other) = 4! × 5 × 4 = 480

1.11(d) Find the number of ways in which a committee of 4 can be chosen


from 6 boys and 5 girls if it must

(i) Consist of 2 boys and 2 girls.

17
(ii) Consist of at least 1 boy and 1 girl.

Solution:

(i) The number of ways of choosing 2 bys from 6 and 2 girls from 5

6 5
=  .   = 15 × 10 = 150
 2  2

(ii) For the committee to contain at least 1 boy and 1 girl we have

1B3G, 2B2G or 3B1G

The required number of ways

6  5  6  5   6  5
=  .   +  .   +  .  
1   3  2  2 3 1 

= 6 (10 ) + 15 (10 ) + 20 ( 5 ) =
130

1.11(e) (i) A school Parent-Teacher committee of 5 members is to be


formed from 6 parents, 2 teachers and the principal. In how many ways can the
committee be formed in order to include

(α ) The principal? (β ) Exactly four parents?

(γ ) Not more than four parents?

(ii) Four balls are drawn from a bag of 12 balls of which 7 are blue and 5 are
red. In how many of the possible combinations of 4 balls is at least a red?

Solution:

(i) (α ) If the principal is to be included then we select 4 people from the

remaining 8. Hence required number of ways the committee is formed

1 8 
=  .   = 70
1  4

18
6
(β ) The number of ways of selecting 4 parents out of 6 =   . The number
 4
of ways of selecting the remaining number from the 3 (2 teachers and the
 3
principal) =  
1 

Therefore the number of ways of selecting exactly 4 parents

 6   3
=   .   = 15 × 3 = 45
 4  1 

12 
(γ ) The number of ways of forming a 5-member committee =  
5 

6
The number of ways of selecting 5 parents from 6 =  
5

Therefore the required number of ways of selecting a committee with not


12   6 
more than 4 parents =   −   = 126 – 6 = 120
5  5

(ii) If at least one red is to be included then the combinations include

 5  7 
1R 3B, with number of combinations =     = 175
1   3 

5 7
2R 2B, with number of combinations =     = 210
 2  2

 5 7
3R 1B, with number of combinations =     = 70
 3 1 

5 7
4R, with number of combinations =     = 5
 4 0

19
2-1.4 Tree Diagram
A (rooted) tree diagram is a useful to enumerate all the logical possibilities of a
sequence of events where each event can occur in a finite number of ways.

A tree diagram is constructed from left to right and that the number of branches at
each point corresponds to the number of ways the next event can occur.

Example 1.12

1. Find the product set A× B × C where A = {1,2} , B = {a, b, c} , C = {α , β } .


Solution:
α (1, a,α )
a β (1, a, β )
α (1, b,α )
β (1, b, β )
1 b

c
α (1, c,α )
β (1, c, β )
α ( 2, a,α )
a
β ( 2, a, β )
α ( 2, b,α )
2 b
β ( 2, b, β )
α ( 2, c,α )
c
β ( 2, c, β )

There are 12 endpoints corresponding to the 12 elements in A × B × C . Specifically,


each path from the beginning of the tree to the endpoints designates an element of
A× B × C which is listed to the right of the tree.

20
That is,

{(1, a,α ) , (1, a, β ) , (1, b,α ) , (1, b, β ) , (1, c,α ) , (1, c, β ) ,


A× B ×C =
( 2, a,α ) , ( 2, a, β ) , ( 2, b,α ) , ( 2, b, β ) , ( 2, c,α ) , ( 2, c, β ) ,}
2. A man has time to play roulette at most five times. At each play he wins or loses a
cedi. The man begins with one cedi and will stop playing before the five times if he
loses all his money or if he wins three cedis, i.e., if he has four cedis.
a) Find the number of possible ways that the playing can occur.
b) Determine the number of times the betting will stop before he has played five
times.
Solution 0
0 1
2
1 2
0 2
3
4
1 2
0
1
2
3 2
2
3
4
4

a) There are 11 endpoints; hence the betting can occur in 11 different ways.
b) The betting will stop before the five times are up in only three of the ways.

21
 Review Probl

ems

Problem 1.1

a) How many ways can we get a sum of 4 or a sum of 8 when two distinguishable
dice are rolled?
b) Suppose a bookcase shelf has 6 mathematics texts, 3 physics texts, 4 chemistry
texts, and 5 computer science texts. Find the number n of ways a student can

choose: (a) one of the texts ( Ans :18) , (b) one of each type of text ( Ans : 360 )
c) How many ways can we get a sum of 8 when two undistinguishable dice are rolled?
Problem 1.2

a) How many 4 - digit numbers can be formed using the digits, 1,2,· · · ,9 (with
repetitions)? How many can be formed if no digit can be repeated?
b) How many different license plates are there that involve 1,2, or 3 letters followed

by 4 - digits (with repetitions)?


Problem 1.3

a) In how many ways can 4 cards be drawn, with replacement, from a deck of 52
cards?
b) In how many ways can 4 cards be drawn, without replacement, from a deck of 52
cards?
Problem 1.4

In how many ways can 7 women and 3 men be arranged in a row if the three men
must always stand next to each other.

Problem 1.5

A menu in a Chinese restaurant allows you to order exactly two of

eight main dishes as part of the dinner special. How many different

22
combinations of main dishes could you order?

Problem 1.6

There are 12 students in a class. Find the number n of ways that 12 students can take

three different tests if four students are to take each test. ( Ans : 34,650 )
.
ANS. 12C4*8C4*4C4

Problem 1.7

Teams A and B play in a basketball tournament. The team that first wins three
games wins the tournament. Find the number of possible ways in which the
tournament can occur.

Problem 1.8

A woman is at the origin on the x axis and takes a one unit step either to the left
or to the right. She stops if she reaches 3 or −3 , or if she occupies any position,
other than the origin, more than once. Find the number of different paths the
woman can travel.

23
Unit 2
MULTINOMIAL EXPANSION AND COEFFICIENT

Introduction

This unit extends the technique of counting as already treated under permutations and
combinations. It may be recalled that binomial expansion is very much linked with
combinations. We are going to have a short but concise study of multinomial expansion, which
is naturally linked with multinomial coefficients.

Learning Objectives

After reading this unit you should be able to:

1. Determine the coefficient of a term in binomial


expansion without necessary listing every term
2. Determine the coefficient of a term in multinomial
expansion without necessary listing every term

Unit content

Session 1-2: Binomial Coefficients

Session 2-2: Multinomial Coefficients

24
SESSION 1-2: BINOMIAL COEFFICIENTS
Choosing a subset of size r out of a set of size n is logically equivalent to
partitioning the set of size n into two subsets, one of size r and the other of size

( n – r ) . The number of such partitions if by definition n


Cr =
n!
r !( n − r ) !
. Suppose

x, y are variable and n ∈ Z + the positive integers, then


n
( x +=
y) ∑ Cr x n= C0 x n y 0 + nC1 x n −1 y1 + nC2 x n −2 y 2 + ... + nCn x 0 y n
n n −r r n
y
r =o

The coefficients nCr , n ≥ r , r ∈ {0,1,..., n} are called the binomial coefficients of the

binomial expression ( x + y ) , n ∈ Z + .
n

Definition 2.1

n!
n
Cr = (2)
r !( n − r ) !

Where 0! =1 and n! = n ( n − 1)( n − 2 ) ...1

Pascal’s identity allows one to construct the following triangle known as

Pascal’s triangle (for n = 5) as follows

1→1

1→ 2 →1

1→ 3→ 3→ 1

1→ 4 → 6 → 4 →1

25
The following theorem provides an expansion of ( x + y )
n
where n is a

nonnegative integer.

Theorem 2.1 (Binomial Theorem)

Let x and y be variables, and let n be a positive integer. Then

n
( x + y) ∑ C ( n, r )x n−r y r
=
n

r =0

where C ( n, r ) is called the binomial coefficient.

Proof.

The proof is by induction.

Basis of induction: For n = 1 we have

1
1  1−0 0 1 1−1 1
( + ) ∑ C ( n, r )x n−r y r =
=  0  x y +  1 x y =
x+ y
1
x y
r =0    

Induction hypothesis: Suppose that the theorem is true for n .

Induction step: Let us show that it is still true for n + 1 . That is

n +1
( x + y) ∑ C ( n + 1, r )x
n +1
= n − r +1
yr .
r =0

Indeed, we have:

( x + y) =( x + y )( x + y ) =x ( x + y ) + y ( x + y )
n +1 n n n

n n
= x ∑ C ( n, r )x y + y ∑ C ( n, r )x n −r y r n−r r

=r 0=r 0

26
n n
=
=r 0=r 0
∑ C ( n, r )x n − r +1
y r + y ∑ C ( n, r )x n −r y r +1

= C ( n,0 ) x n +1 + C ( n,1) x n y + C ( n,2 ) x n −1 y 2 +  + C ( n, n ) xy n


+ C ( n,0 ) x n y + C ( n,1) x n −1 y 2 +  + C ( n, n − 1) xy n + C ( n, n ) y n +1

= C ( n + 1,0 ) x n +1 + C ( n + 1,1) x n y + C ( n + 1,2 ) x n −1 y 2 +


+  + C ( n + 1, n ) x n y + C ( n + 1, n + 1) y n +1

n +1
= ∑ C ( n + 1, r )x
r =0
n − r +1
yr

Example 2.1

Expand ( x + y )
6
using the binomial theorem.

Solution:

By the Binomial Theorem and Pascal’s triangle we have

( x + y) =
x 6 + 6 x 5 y + 15 x 4 y 2 + 20 x 3 y 3 + 15 x 2 y 4 + 6 xy 5 + y 6
6

Example 2.2

∑ C ( n, r ) = 2 n
n
a) Show that r =0

∑ ( −1) C ( n, r ) =
r
b) Show that
n
r =0
0

27
Solution:

a) Letting x= y= 1 in the binomial theorem we find


n
2n =(1 + 1) =∑ C ( n, r )
n

r =0

b) This follows from the binomial theorem by letting x = 1 and y = −1

Example 2.3

Expand ( 2 x − 3)
5

Solution:

5
( 2 x − 3) ∑ Cr ( 2 x ) ( −3)
n−r
=
5 5 r

r =0

= C0 ( 2 x ) ( −3) + 5C1 ( 2 x ) ( −3) + 5C2 ( 2 x ) ( −3)


5 5 0 4 1 3 2

+ 5C3 ( 2 x ) ( −3) + 5C4 ( 2 x )( −3) + 5C5 ( 2 x ) ( −3)


2 3 4 0 5

5! 5 5 5! 4 4 5! 3 3 5! 2 2
= 2 x + 2 x ( −3) + 2 x (9) + 2 x ( −27 )
5!0! 4!1! 3!2! 2!3!
5! 5!
+ 2 x ( 81) + ( −243)
1!4! 0!5!
= 32 x 5 − 240 x 4 + 720 x 3 − 1080 x 2 + 81x − 243

28
Example 2.4

Obtain the coefficient of a b in the expansion of ( 2a − 3b )


5 2 7

Solution:

To obtain the coefficient of the term a 5b 2 , we notice that in (2), we set r = 2 to


obtain

C2 ( 2 ) ( -3) as the coefficient of a 5b 2


7 5 2

But

7!
C2 ( 2 ) (=
−3) ( 2 ) ( −3)
7 5 2 5 2

5!2!
= 6048

Therefore, the coefficient of a 5 b 2 of the binomial expression is 6048

 Self Assessment 1-2

1. Expand the following binomial expressions:

(i) ( 2x − 4 y )
5
(ii) ( 3x + 2 y )
2
(iii) ( 2 − 5xy )
4

3 z + (1 − b )  3 x − ( 7 + 2 y ) 
3 3
(iv) (v)

29
2. Find the coefficients of the indicated terms in the given binomial
expressions:

(i) x12 y13 in ( x + y ) (ii) x12 y13 in ( 2 x − 3 y )


25 25

x 9 in ( 2 − x ) y 6 in 3 − 5 (1 − y ) 
8
(ii) (iv)
19

x19 in ( 3 x + 1) − 2 
20
(v)

3. Prove that for any n ∈ Z +

n n
(i) ∑ (ii) ∑ ( −1) 0.
r n
n
Cr = 2 n Cr =
r =0 r =0

4. Using the binomial expression (1 + x ) to find the approximate values of the


n

following to 5 decimal places:

(i) 0.95 (ii) 1.994

5. Expand (1 − 2x ) and hence evaluate 0.96 to six decimal places.


6

6. Show that k Ck + k +1Ck + ... + k + r Ck =k + r +1


Ck +1

x 2 x3 x 4
7. Show that ln (1 + x ) =x − + − + ...
2 3 4

1  1+ x  x3 x5
Hence show that ln   =x + + + ...
2  1− x  3 5

8. Solve the following

a) Find the coefficient of a b in the binomial expansion of (1 − 2b)


5 7 12

b) Use the binomial theorem to prove that


n
3n = ∑ 2r C ( n, r )
r =0

30
SESSION 2-2: MULTINOMIAL COEFFICIENTS
Let k1 , k2 , ..., kr be integers satisfying the relation k1 + k2 + ... + kr =
n . Then

The number of ways a set of n elements can be partitioned into classes of

sizes k1 , k2 , ..., kr equal

n!
n
Ck ,k ,...,k =
1 2 r
k1 !k2 !...kr !

Proof

We obtain the partitioning in steps: First, we choose k1 out of n elements to

form the first partition. Next, we choose k2 elements out of the remaining

( n − k1 ) elements, and so on until we have n − k1 − k2 − ... − kr − 2 = kr −1 + kr elements

from which we choose kr −1 to form the next-to-last class. The remaining kr

elements forms the last class. This has been accomplished in


 n   n − k1   n − k1 − k2   n − k1 − k2 − ... − kr − 2  n − k1 − k2 − ... − kr −1 
    ...    ways.
 k1   k2   k3   kr −1  kr 

Simple algebra shows that

 n   n − k1   n − k1 − k2 − k3   n − k1 − k2 ......kr −1  n!
 k   k  ...  =
 1  2   kr −1  kr  k1 !k2 !...kr !

Suppose x1 , x2 , x3 ,..., xr are variables and n ∈ Z + , then

(x + x2 + ... + xr ) =∑
n
1
n
Ck ,k ...,k x1k x2 k ...xr k
1 2 r
1 2 r

k1 , k2 ..., kr

where k1 + k2 ... + kr =
n

31
Example 2.5

Expand ( x + y + z )
3

Solution:

(x + y + z)
3
= 3C3,0,0 x 3 y 0 z 0 + 3C0,3,0 x 0 y 3 z 0 + 3C0,0,3 x 0 y 0 z 3 + 3C2,1,0 x 2 y1 z 0 + 3C2,0,1 x 2 y 0 z1
+ 3C1,2,0 x1 y 2 z 0 + 3C0,2,1 x 0 y 2 z1 + 3C1,0,2 x1 y 0 z 2 + 3C0,1,2 x 0 y1 z 2 + 3C1,1,1 x1 y1 z1
3! 3! 3! 3 3! 2 3! 2
= x3 + y3 + z + x y+ x z
3!0!0! 0!3!0! 0!0!3! 2!1!0! 2!0!1!
3! 3! 3! 3! 3!
+ xy 2 + y2 z + xz 2 + yz 2 + xyz
1!2!0! 0!2!1! 1!0!2! 0!1!2! 1!1!1!
=x3 + y 3 + z 3 + 3 x 2 y + 3 x 2 z + 3 xy 2 + 3 y 2 z + 3 xz 2 + 3 yz 2 + 6 xyz

Example 2.6

6  5  10 
Evaluate the following (a)   (b)   (c)  
 4, 2, 0   3, 2   5,3, 0, 2 

6  6! 6 × 5 × 4 × 3 × 2 ×1
Solution: (a)  =  = = 15
 4, 2, 0  4!2!0! 4 × 3 × 2 ×1× 2 ×1

 5  5! 5 × 4 × 3 × 2 ×1
(b)  =  = = 10
 3, 2  3!2! 3 × 2 ×1× 2 ×1

10  10! 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
(c)  =  = = 2520
 5,3, 0, 2  5!3!0!2! 5 × 4 × 3 × 2 × 1× 3 × 2 × 1× 2 × 1

32
Example 2.7 (Previous example)

Find the number m of ways that 9 toys can be divided between 4 children if
the youngest is to receive 3 toys and each of the others 2 toys.

9!
=m = 7560
3!2!2!2!

 Self Assessment 2-2

n  n  n 
1. Show that   =   =  
 1 2
n , n  n1   n2 

2. Show that if i ≥ 1, j ≥ 1, k ≥ 1 and i + j + k = n + 1 , then

 ( n + 1) !  n! n! n!
 = + +
 i ! j !k !  (i − 1)! j ! k ! i !( j − 1)! k ! i ! j !( k − 1)!

n
3. Prove that for any n ∈ Z + , ∑
k1 , k2 ,..., kr
n
Ck1 ,k2 ,...,kr = r n

4. In the expansion of ( x + y + z ) find the coefficient of the terms:


7

(i ) xyz 5 ( ii ) x2 y 2 z3 ( iii ) x3 z 4

5. Determine the coefficient of the following terms in the indicated multinomial


expressions.

(i ) xyz 2 in ( 2 x − y − z )
4

( ii ) ( )
4
xyz −2 in x − 2 y + 3z −1

( iii ) w3 x 2 yz 2 in ( 2w − x + 3 y − 2 z )
8

( iv ) ( )
6
x11 y 4 z 2 in 2 x 3 − 3 xy 2 + z 2

(v) x3 y 4 z 5 in ( x − 2 y + 3 z )
12

33
6. The letters B,C,E,E,N,R,S,S,Y,Z,Z,Z,Z are arranged at random.

Determine the probability that these letters will spell the word

SZCZEBRZESZYN

7. Show that if a ≤ b ≤ c ≤ n , then

 n c b  n n − a  n − b
      =      
c  b a a b − a  c − b 

(i) Use the definition of binomial coefficients as ratios of factorials.

(ii) Use the interpretation of the binomial coefficients directly as the number
of subsets of a given size.

(iii) Generalize the above formula to answer the question: In how many ways
can one choose an a -element subset from a b -element subset from a c -
element subset from a d -element subset from an n -element set, where
a ≤b ≤ c ≤ d ≤ n?

8. Expand (x + y + z) . Hence with x= y= z= 0.3 evaluate 0.96 to six decimal


6

places. (Compare this approximation with that of Q5 of the previous exercise).

34
Unit 3
RECURRENCE RELATION AND LINEAR DIFFERENCE
METHOD

Introduction

Welcome to this unit. Any equation involving several elements of a sequence is called a
recurrence relation. Here, we shall learn more about recurrence relations, or simply put,
algorithms. This would entail one, two or three expressions that would generate an infinite set
of numbers. On the other hand, given a set of recurrence relations, a solution would be found
for such a relation.

Learning Objectives

After reading this unit you should be able to:

1. Use the difference operator method analogous to


differentiation of a real function
2. Find a generic form of a recurrence relation

Unit content

Session 1-3: The Difference Operator


Session 2-3: Recurrence Relations -Finite Difference Equations
2-3.1Recursion
2-3.2 Classification of Recurrence Relations
2-3.3The Homogeneous Case
2-3.4The Non-Homogeneous Case

35
SESSION 1-3: THE DIFFERENCE OPERATOR
The difference operator ∆ is defined by ( ∆y )( n )= y ( n + 1) − y ( n ) . This is called

the forward difference operator. The difference operator ∆ is the analogous of


y ( x + h) − y ( x)
the differential operator in calculus. Indeed, y′ ( x ) = lim is the
h →0 h
y ( x + h) − y ( x)
definition of the derivative f ′ ( x ) of f ( x ) . Similarly ( ∆y )( x ) = , when
h
h =1.

d
Familiar properties of carry over as follows:
dx

Linearity

∆ ( y + v ) = ∆y + ∆v; ∆ (α y ) = α∆ ( y ) , α scalar

Product Rule:

( ∆ ( y ⋅ v ) ) ( n )= y ( n + 1) v ( n + 1) − y ( n ) v ( n )
=  y ( n + 1) − y ( n )  v ( n + 1) + y ( n ) v ( n + 1) − v ( n ) 
=( ∆y )( n ) v ( n + 1) + y ( n )( ∆v )( n )

Exponential:

If y ( n )= 2n , ( ∆y )( n )= y ( n + 1) − y ( n )
= 2n +1 − 2n
= 2=
n
f (n)
that is ∆y =y

Thus 2n for difference equations plays the same role e x does for differential
equations.

36
Constants:

∆ ⋅ c = 0, c constant

y 0, that is ( ∆y )( n=
Conversely, suppose that ∆= ) y ( n + 1) − y ( n=) 0 for all n , then
y is a constant.

The operation analogous to integration is that of taking finite sums. The


following result is a discrete version of the fundamental theorem of calculus,
which essentially says that differentiation and integration are inverse operations.

Theorem

n n

∑ v ( r )= ∑ ( ∆y )( r )=  y ( r )  m = y ( n + 1) − y ( m ) .
n +1
If ∆y= v, then
=r m=r m

Proof

We have

v ( n )= y ( n + 1) − y ( n )
v ( n − 1=
) y ( n ) − y ( n − 1)
v ( n − 2 )= y ( n − 1) − y ( n − 2 )

v ( m + 1)= y ( m + 2 ) − y ( m + 1)
v ( m=
) y ( m + 1) − y ( m )
......................................................
n

∑ v ( r )=
r =m
y ( n + 1) − y ( m )

37
Example 3.1

Exponentials:

∆a n = a n +1 − a n = a n ( a − 1) , a constant
Hence
∆a n  an 
a = = ∆  ( by linearity )
n

a −1  a −1
n
1 n a n +1 − a m
∴ ∑= a r
∑ ∆=a r

=r m= a −1r m a −1

(This is just the usual method for summing a geometric progression).

Example 3.2

Polynomials:

We consider easier polynomials of the form

fr ( n =
) n ( n − 1)( n − 2 )...( n − r + 1)
Then, ∆f r (n=
) yr (n + 1) − yr (n)
∴∆f r ( n ) =
( n + 1) n ( n − 1)( n − 2 )...( n − r + 2 ) − n ( n − 1)( n − 2 )...( n − r + 1)
= n ( n − 1) ...( n − r + 2 ) ( n + 1) − ( n − r + 1) 
= rn ( n − 1)( n − 2 ) ...( n − r + 2 )
= rf ( n )
r −1

This is analogous to
d n
dx
( )
x = nx n −1 .

38
n
1
We may easily deduce that ∑f =
(s)
s =m
r −1
r
 f r ( n + 1) − f r ( m )  .

n
1
∑ yr ( s )
So in particular=
s =0 r +1
yr +1 ( n + 1) , if m = 0 .

With this, we have a method of summation for any polynomial.

For example,

n n

∑ s3 = ∑ s3
=s 1 =s 0
n
= ∑  s ( s − 1)( s − 2 ) + 3s ( s − 1) + s 
s =0

n
1 1 
= ∑  y ( s ) + 3 y ( s ) + y (=
s )  
4
y ( n + 1) + y ( n + 1) + y2 ( n + 1) 

3 2 1 4 3
s =0 2

1 1
= ( n + 1) n ( n − 1)( n − 2 ) + ( n + 1) n ( n − 1) + ( n + 1) n
4 2
( n + 1) n  n − 1 n − 2 + 4 n − 1 + 2
= ( )( ) ( ) 
4 
1
= n 2 ( n + 1)
2

Example 3.3

Let y ( n ) = na n . [ a , constant]

Using example 1, we study ∆y .

39
( ∆y )( n ) =
( n + 1) a n +1
− na n
= a + na ( a − 1) =
n +1 n
a n +1 + ( a − 1) y ( n )
1 a n +1
Hence y ( n ) = ( ∆y )( n ) −
a −1 a −1
1 a
= ( ∆y )( n ) − 2 ∆a
n

a −1 ( a − 1)
 1 a 
=
∆ y (n) − a n

 a − 1 ( a − 1) 
2

Then by the theorem,


n
1 a
y(r )
∑=  y ( n + 1) − y ( m )  − 2 
 a n +1 − a m 
r =m a −1 ( a − 1)
=
( n + 1) a − ma m a n + 2 − a m+1
n +1


a −1 ( a − 1)
2

Example 3.4

Trigonometric Functions:

We study this specialized branch of mathematics using forward differences:

+ α ) sin ( w ( x + 1) + α ) − sin ( wx + α )
∆ sin ( wx =
= 2sin ( w2 ) cos [ wx + α + w2 ]
Then

∑ 2sin ( ) cos [ wr + α=
+ ]
n
w
2
w
2 sin  w ( n + 1) + α  − sin α
r =0

so that
sin  w ( n + 1) + α  − sin α
∑ cos [ wr + α + ] =
n
w
2
r =0 2sin w2

40
w
Setting α = − , we have
2
n sin  w ( n + 12 )  + sin w2

r =0
cos wr =
2sin w2

n
A similar formula may be derived for ∑ sin wr .
r =0

 Self Assessment 1-3

1. Verify the following differences


(a ) ∆n 2 4n =( 3n + 2 )( n + 2 ) 4n ;
(b) ∆ 3n ( n + 1)( n + 2 )( n + 3) − 4 ( n + 1)( n + 2 )( n + 3) 
= 12n ( n + 2 )( n + 3)
nN n +1  N + 1 
(c) ∆ ( −1)   = ( −1)  
n   n +1 
2n + 1 2
(d) ∆ =−
n ( n + 1) n ( n + 2)

2. From (1) deduce the value of


n n
( a ) ∑ ( 3r + 2 )( r + 2 ) 4r ( b ) ∑ r ( r + 2 )( r + 3)
=r 0=r 1
10
15  N
1
( c ) ∑ ( −1) ( ) ∑
n
  d
=n n 
3= n 0 n ( n + 2)


1
From your answer to (d), deduce that ∑ n ( n + 2)
n =1
exists and find its value.

( )
n
n
3. Show that ∑=
r
r =1
4

30
( n + 1) 6n3 + 9n2 + n − 1 .

41
SESSION 2-1: FINITE DIFFERENCE EQUATIONS -
RECURRENCE RELATIONS
What we are about to study is the discrete analogue of differential equations. Let an be

a function defined on the set of positive integers. An inductive or recurrence definition of


the function y specifies the starting value, such as a0 (or several starting values of the

inductive or recursive definition, such as, a0 , a1 , a2 ,... ) and then a formula specified as
to how to generate subsequent function values from the starting value (or values).

We shall think of the integer n as the independent variable, and restrict our attention to
real sequences, so that the sequence an is considered as a function of the type

f :  ∪ {0} →  ; n  an

2-3.1 Recursion
A recurrence relation for a sequence a0 , a1 ,... is a relation that defines an in

terms of a0 , a1 ,..., an−1 . The formula relating an to earlier values in the sequence

is called the generating rule. The assignment of a value to one of the a ' s is
called an initial condition.

Example 3.5

The Fibonacci sequence

1,1,2,3,5,...

is a sequence in which every number after the first two is the sum of the
preceding two numbers. Find the generating rule and the initial conditions.

42
Solution:

The initial conditions are a=


0 a=
1 1 and the generating rule is =
an an−1 + an −2 ;
n≥2

Example 3.6

Let n ≥ 0 and find the number sn of words from the alphabet ∑ = {0,1} of
length n not containing the pattern 11 as a subword.

Solution:

Clearly, s0 = 1 (empty word) and s1 = 2 . We will find a recurrence relation for sn ,

n ≥ 2. Any word of length n with letters from ∑ begins with either 0 or 1 . If

the word begins with 0 , then the remaining n − 1 letters can be any sequence of
0' s or 1' s except that 11 cannot happen. If the word begins with 1 then the
next letter must be 0 since 11 cannot happen; the remaining n − 2 letters can
be any sequence of 0' s and 1' s with the exception that 11 is not allowed. Thus
the above two categories form a partition of the set of all words of length n with

letters from ∑ and that do not contain 11 . This implies the recurrence

relation =
sn sn−1 + sn−2 , n ≥ 2

A solution to a recurrence relation is an explicit formula for an in terms of n .

The most basic method for finding the solution of a sequence defined recursively
is by using iteration. The iteration method consists of starting with the initial
values of the sequence and then calculates successive terms of the sequence
until a pattern is observed. At that point one guesses an explicit formula for the
sequence and then uses mathematical induction to prove its validity.

43
Example 3.7

Find a solution for the recurrence relation

a0 =1

an = an−1 + 2, n ≥ 1

Solution:

Listing the first five terms of the sequence one finds

a0 = 1

a1 = 1 + 2

a2 = 1 + 4

a3 = 1 + 4

a4 = 1 + 8

Hence, a guess is a=
n 2n + 1 , n ≥ 0 . It remains to show that this formula is
valid by using mathematical induction.

Basis of induction: For n = 0, a0 = 1= 2 ( 0 ) + 1 .

Induction hypothesis: Suppose that a=


n 2n + 1 .

Induction step: We must show that an+1= 2 ( n + 1) + 1 . By the definition of an+1

we have an+1 = an + 2 = 2n + 1 + 2 = 2 ( n + 1) + 1 .

44
Example 3.8

Consider the arithmetic sequence

=
an an−1 + d , n ≥ 1

where a0 is the initial value. Find an explicit formula for an .

Solution:

Listing the first four terms of the sequence after a0 we find

a=
1 a0 + d

a=
2 a0 + 2d

a=
3 a0 + 3d

a=
4 a0 + 4d

Hence, a guess is a=
n a0 + nd . Next, we prove the validity of this formula by
induction.

Basis of induction: For n = 0 a=


0 a0 + ( 0 ) d .

Induction hypothesis: Suppose that a=


n a0 + nd .

Induction step: We must show that an+1 = a0 + ( n + 1) d . By the definition of

an+1 we have an+1 = an + d = a0 + nd + d = a0 + ( n + 1) d .

45
Example 3.9

Consider the geometric sequence

an = ran−1 , n ≥ 1

Where a0 is the initial value. Find an explicit formula for an .

Solution:

Listing the first four terms of the sequence after a0 we find

a1 = ra0

a2 = r 2 a0

a3 = r 3a0

a4 = r 4 a0

Hence, a guess is an = r a0 . Next, we prove the validity of this formula by


n

induction.

Basis of induction: For n = 0 , a0 = r a0 .


0

Induction hypothesis: Suppose that an = r a0 .


n

n +1
Induction step: We must show that an+1 = r a0 . By the definition of an+1 we
have a=
n +1 =
ran r ( ra=
0) r n +1
a0 .

46
Example 3.10

Find a solution to the recurrence relation

a0 0

an = an+1 + ( n + 1) , n ≥ 1

Solution:

Writing the first five terms of the sequence we find

a0 = 0

a1 = 0

a2 = 0 +1

a3 = 0 +1+ 2

a4 = 0 +1+ 2 + 3

A guessing formula is that

n ( n − 1)
an = 0 + 1 + 2 +  + ( n − 1) =
2

We next show that the formula is valid by using induction on n ≥ 0 .

0 ( 0 − 1)
Basis of induction: a0= 0= = 0.
2

n ( n − 1)
Induction hypothesis: Suppose that an = .
2

47
n ( n + 1)
Induction step: We must show that an +1 = . Indeed,
2

an+=
1 an + n

n ( n − 1)
= +n
2

n ( n + 1)
=
2

Example 3.11

Consider the recurrence relation

a0 =1

an =2an−1 + n n ≥ 1

Is it true that a= 2 + n is a solution to the given recurrence relation?


n
n

Solution:

If so then we must be able to prove its validity by mathematical

induction.

Basis of induction: a= 2 +1.0


0

Induction hypothesis: Suppose that a= 2 + n. n


n

48
Induction step: We must show that an+1 = 2
n +1
+ ( n + 1) . If this is so then we will

have 2
n +1
+ ( n + 1)= 2an + n= 2n+1 + 2n + n + 1 . But this would imply that n = 0
which contradicts the fact that n is any nonnegative integer.

Example 3.12

Define a sequence, a1 , a2 ,... , recursively as follows:

a1 =1
an =
2 ⋅ a n  , n ≥ 2
2

a. Use iteration to guess an explicit formula for this sequence.

b. Use induction to prove the validity of the formula found in a.

Solution:

Computing the first few terms of the sequence we find

a1 = 1 a2 = 2

a3 = 2 a4 = 4

a5 = 4 a6 = 4

a7 = 4 a=
8 = a=
 15 8

i +1
Hence, for 2 ≤ n < 2 , an = 2 . Moreover, i ≤ log 2 n < i + 1 so that
i i

i = log 2 n  and a formula for an is

49
an = 2 
log 2 n 
,n ≥1

b. We prove the above formula by mathematical induction.

log 2 1
Basis of induction: For n = 1 , a1 = 1= 2  .

log 2 n 
Induction hypothesis: Suppose that an = 2  .

log 2 n +1
Induction step: We must show that an+1 = 2  .

Indeed, for n odd (i.e. n + 1 even) we have:

an +1= 2 ⋅ a n +1 
 2 

log 2 n+2 1  log 2 ( n+1) −1 +1 log 2 ( n+1)  −1+1


= 2 ⋅ a n +1 = 2 ⋅ 2  = 2 = 2
2

log 2 ( n+1) 
= 2

A similar argument holds when n is even.

NOTATION:

We write a ( n ) = an , or y ( n ) = yn , n ∈ 
+

Example 3.13

Let n be the number of memory locations referenced by a certain computer


program. Suppose that the algorithm implemented by the program requires yn

bytes of the memory, where yn depends on n . Let yn be defined inductively by

50
 y1 = 3

= yn 4 yn −1 if n > 1

By this inductive definition, we generate the following table of Fibonacci


sequence:

n 1 2 3 4 5 …

yn 3 12 48 192 768 …

Sometimes it is more convenient to start at n = 0 instead of n = 1 . In fact, any


integer could be used as the starting value in the inductive definition or recursive
relation.

Example 3.14

The factorial function n ! is defined as follows:

0! = 1

n ( n − 1)! if n ≥ 1
n ! =

It is desirable to find an explicit expression of yn as a function of n . To find such

an expression is called the solution process of the inductive definition or


recurrence relation.

A general solution for the recurrence relation is a solution process involving some
arbitrary constants. The initial conditions enable us to find the values of those
arbitrary constants. Sometimes by studying the Fibonacci sequence, an intuition
gives the solution of yn in terms of n .

51
Example 3.15

A function an is defined recursively as follows:

a1 = 3

 a2 = 7
a =−
 n 3an −1 2an −2 for n ≥ 3

We want to find an explicit formula or solution for an in terms of n . We display

some few initial terms of the Fibonacci sequence:

n 1 2 3 4 5 6 …

an 3 7 15 31 63 127 …

By intuition, = − 1 . This formula clearly satisfies the initial conditions


n +1
an 2
a1 and a2 . We verify if it satisfies the recurrence relation

52
=
an 3an −1 − 2an −2
But
=
R.H .S 3an −1 − 2an −2
= 3 ( 2n − 1) − 2 ( 2n −1 − 1)
= 3 ⋅ 2n − 3 − 2n + 2
= 2n ( 3 − 1) − 1
= 2n +1 − 1
= an
= L.H .S

When iteration does not apply, other methods are available for finding explicit
formulas for special classes of recursively defined.

 Exercise 3.1

1. Use iteration to guess a formula for the following recursively defined


sequence and then use mathematical induction to prove the validity of
your formula:

an = 1 ,=
an 3an−1 + 1 , for all n ≥ 2

2. Use iteration to guess a formula for the following recursively


defined sequence and then use mathematical induction to prove the
validity of your formula:

a=
0 1, a=
n 2n − an−1 , for all n ≥ 2 .

3. Determine whether the recursively defined sequence: a1 = 0 and

a= ( n − 1) , n ≥ 1.
2an−1 + n − 1 satisfies the explicit formula an =
2
n

53
2-3.2 Classification of Recurrence Relation
A recurrence relation is of first order if an is defined only in terms of an −1 . It is of

second order if an is defined in terms of an −1 and an − 2 , and so on.

A recurrence relation is then an equation of the type

F ( n, an , an+1 ,..., an+ k ) = 0 ,

where k ∈  is fixed.

Example 3.16. an +1 = 5an is a recurrence relation of order 1 .

Example 3.17 an +1 + an =
n is a recurrence relation of order 1 .
4 5

54
Example 3.18 an +3 + 5an + 2 + 4an +1 + an =
cos n is a recurrence

relation of order 3 .

( )
1/3
Example 3.19 an + 2 + 5 an2+1 + an =
0 is a recurrence relation of

order 2 .

We now define the order of a recurrence relation.

Definition 3.1: The order of a recurrence relation is the difference between the
greatest and lowest sub – scripts of the terms of the sequence in the equation.

Hence F ( n, an , an +1 ,..., an + k ) = 0 is of order k .

Definition 3.2: A recurrence relation of order k is said to be linear if it is linear


in an , an +1 ,..., an + k . Otherwise, the recurrence relation is said to be non-linear.

Example 3.20. The recurrence relations in Examples 3.16 and 3.18


are linear, while those in Examples 3.17 and 3.19 are non-linear.

Example 3.21. an +1an + 2 = 5an is a non-linear recurrence relation of


order 2 .

55
Remark. The recurrence relation an +3 + 5an + 2 + 4an +1 + an =
cos n can also be
written in the form an + 2 + 5an +1 + 4an + an −1= cos(n − 1). There is no reason why the
term of the sequence in the equation with the lowest subscript should always have
subscript n .

For the sake of uniformity and convenience, we shall in this unit always follow the
convention that the element of the sequence in the equation with the lowest subscript
has subscript n .

Elimination of Arbitrary constants

We shall first of all consider a few examples. Do not worry about the details.

Example 3.22. Consider the equation an = A ( n!) , where A is an


arbitrary constant. Replacing n by ( n + 1) in the equation, we obtain

an +1 A ( ( n + 1)!) . Combining the two equations and eliminating A , we obtain


=
the first-order recurrence relation an +=
1 ( n + 1) a n
.

Example 3.23. Consider the equation

a=
n ( A + Bn ) 3n
(1)
where A and B are arbitrary constants. Replacing n by ( n + 1) and (n+2) in
the equation, we obtain respectively

56
( A + B ( n + 1) ) 3n+1 =
an +1 = ( 3 A + 3B ) 3n + 3Bn3n ( 2)
and

( A + B ( n + 2 ) ) 3n+2 =
an + 2 = ( 3 A + 3B ) 3n+1 + 3B ( n + 1) 3n+1
which simplifies

( A + B ( n + 2 ) ) 3n+2 =
an + 2 = ( 9 A + 18B ) 3n + 9 Bn3n ( 3)
Combining (1) − ( 3) and eliminating A and B , we obtain the second-order
recurrence relation

an + 2 − 6an +1 + 9an =
0

Example 3.24 Consider the equation

an = A ( −1) + B ( −2 ) + C 3n ( 4)
n n

where A , B and C are constants. Replacing n by ( n + 1) , ( n + 2 ) and

( n + 3) in the equation, we obtain respectively

A ( −1) + B ( −2 ) − A ( −1) − B ( −2 ) + 3C 3n ( 5)
n +1 n +1
an +1 = + C 3n +1 =
n n

an + 2 = A ( −1) + B ( −2 ) + C 3n + 2 = A ( −1) + 4 B ( −2 ) + 9C 3n ( 6)
n+2 n+2 n n

and

A ( −1) + B ( −2 ) − A ( −1) − 8 B ( −2 ) + 27C 3n ( 7 )


n +3 n +3
an +3 = + C 3n +3 =
n n

Combining ( 4 ) − ( 7 ) and eliminating A, B, and C , we obtain the third-order


recurrence relation

an +3 − 7 an +1 − 6an =
0

57
Note that in these three examples, the expression of an as a function of

n contains respectively one, two and three constants. By writing down one, two
and three extra expressions respectively, using subsequent terms of the
sequence, we are in a position to eliminate these constants.

In general, the expression of an as a function of n may contain k arbitrary

constants. By writing down k further equations, using subsequent terms of the


sequence, we expect to be able to eliminate these constants. After eliminating
these constants, we expect to end up with a recurrence relation of order k .

If we reverse the argument, it is reasonable to define the general solution of a


recurrence relation of order k as that solution containing k arbitrary constants.
This is, however, not very satisfactory. Instead, the following is true: Any
solution of a recurrence relation of order k containing fewer than k arbitrary
constants cannot be the general solution.

In many situations, the solution of a recurrence relation has to satisfy certain


specified conditions. These are called initial conditions, and determine the values
of the arbitrary constants in the solution.

Example 3.25. The recurrence relation

an + 2 − 6an +1 + 9an =
0

58
has general solution a=
n ( A + Bn ) 3 , where
n
A and B are arbitrary constants.
Suppose that we have the initial conditions a0 = 1 and a1 = 15 . Then we must

have an

an= (1 + 4n ) 3 n
.

Linear Recurrence Relations

Non-linear recurrence relations are usually very difficult, with standard


techniques only for very few cases. We shall therefore concentrate on linear
recurrence relations.

The general linear recurrence relation of order k is the equation

s0 ( n ) an + k + s1 ( n ) an + k −1 +  + sk ( n ) an =f ( n ) ………….(3.1)

where s0 ( n ) , s1 ( n ) ,..., sk ( n ) and f ( n ) are given functions. Here we are

primarily concerned with (3.1) only when the coefficients s0 ( n ) , s1 ( n ) ,..., sk ( n )

are constants and hence independent of n . We therefore study equations of the


type

s0 an + k + s1an + k −1 +  + sk an =f ( n ) ……………………………(3.2)

where s0 , s1 ,..., sk are constants, and where f ( n ) is a given function.

59
Linear recurrence relations have the following important properties:

• multiplying any solution by a constant gives another solution,


• adding two or more solutions give another solution.

First-Order Recurrence Relations

First-order recurrence relations are of the form:

an = san −1

a0 = t

We assume s and t are constants. We solve first-order recurrence relations by


iteration; a process of repetitive procedure, as displayed:

an = san −1
= s ( san −2 )
= s 2 ( san −3 )
= ............
= s n −1a1
= s n a0

Using the initial condition, we have=


an ts , n ∈  . +
By this procedure,
n

Example 3.13 above, with s= 4 and t= 3= a1 , we have an = s a1 = 3 ⋅ 4


n −1 n −1
.

The Second-Order Recurrence Relation

Second-order recurrence relation has the form:

60
an =+ s1 yn −1 s2 an −2 for n ≥ 2

a1 = t1
a = t
 0 0

2-3.3 The Homogeneous Case


If the function f ( n ) on the right-hand side of (3.1) is identically zero, then we

say that the recurrence relation (3.1) is homogeneous. If the function f ( n )

on the right-hand side of (3.1) is not identically zero, then we say that the
recurrence relation

s0 ( n ) an + k + s1an + k −1 + ... + sk an =
0 …………………………..(3.3)
is the reduced recurrence relation of (3.2).

In this subunit, we study the problem of finding the general solution of a


homogeneous recurrence relation of the type (3.3)(called the linear
homogeneous recurrence relation)

(1) (k )
Suppose that an ,..., an are k independent solutions of the recurrence relation

(3.3), so that no linear combination of them with constant coefficient is


identically zero, and

s0 a (1) n + k + s1a=
(1)
n + k −1
+ ... + sk an (1) 0, ..., s0 a ( k ) n + k + =
s1a ( k ) n + k −1 + ...sk an ( k ) 0.

61
We consider the linear combination

a=
n
c1an (1) + ... + ck an ( k ) ………………..(3.4)
where c1 ,..., ck are arbitrary constants. Then an is clearly also a solution of (3.3),

for

+ sk an s0 ( c1a (1) n + k + ... + ck a ( k ) n + k )


s0 an + k + s1an + k −1 + ...=
+ s1 ( c1a (1) n + k −1 + ... + ck a ( k ) n + k −1 ) + ... + sk ( c1an (1) + ... + ck an ( k ) )

= c1 ( s0 an(1+)k + s1an(1+)k −1 + ... + sk an(1) ) + ... + ck ( s0 an( k+)k + s1an( k+)k −1 + ...sk=
an( k ) ) 0.

Since (3.4) contains k constants, it is reasonable to take this as the general


(1) (k )
solution of (3.3). It remains to find k independent solutions an ,..., an .

Consider first of all the case k = 2 . We are therefore interested in the


homogeneous recurrence relation

s0 an + 2 + s1an +1 + s2 an =
0 ……………………….(3.5)
where s0 , s1 , s2 are constants, with s0 ≠ 0 and s2 ≠ 0 . Let us try a solution of

the form

an = λ n ………………………………..(3.6)
where λ ≠ 0 . Then clearly an+1 = λ n+1 and an+ 2 = λ n+ 2 , so that

(s λ0
2
+ s1λ + s2 ) λ n =
0
Since λ ≠ 0 , we must have

s0λ 2 + s1λ + s2 =
0 …………………….(3.7)

This is called the characteristic polynomial (or auxiliary equation) of the


recurrence relation (3.5).

62
It follows that (3.6) is a solution of the recurrence relation (3.5) whenever λ
satisfies the characteristic polynomial (3.7). Suppose that λ1 and λ2 are the two
roots of (3.7). Then

an(1) = λ1n and an( 2) = λ2n


are both solutions of the recurrence relation (3.5). It follows that the general
solution of the recurrence relation (3.5) is

an c1λ1n + c2λ2n ……………………….(3.8)


=

Characteristic Polynomial

The auxiliary or characteristic equation , s0λ + s1λ + s2 =


0 , is a quadratic
2

equation and to solve this, we have three possibilities

I. two distinct real roots


= λ λ=
1 and λ λ2

II. repeated real root λ ( twice=


) λ=1 λ2
III. roots λ λ=
two complex = 1 and λ2 λ1
Case I

Since an λ=
= and an λ2n are solutions of the linear recurrence relation, then
n
1

an c1λ1 + c2λ2 . Where


another solution (the general solution) is =
n n
c1 and c2 are
=
arbitrary constants. Using the initial values a0 t0=
and a1 t1 , c1 and c2 are
easily determined.

Case II

63
However, if λ1 = λ2 , then (3.8) does not qualify as the general solution of the

recurrence relation (3.5), as it contains only one arbitrary constant. We therefore


try for a solution of the form

an = un λ n ……………………………………….(3.9)
where un is a function of n , and where λ is the repeated root of the
characteristic polynomial (3.7). Then

an +1 = un +1λ n +1 And an + 2 = un + 2λ n + 2 ……………(3.10)


Substituting (3.9) and (3.10) into (3.5), we obtain

s0un + 2λ n + 2 + s1un +1λ n +1 + s2un λ n =


0

Note that the left-hand side is equal to

s0 ( un + 2 − un ) λ n + 2 + s1 ( un +1 − un ) λ n +1 + un ( s0λ 2 + s1λ + s2 ) λ n
= s0 ( un + 2 − un ) λ n + 2 + s1 ( un +1 − un ) λ n +1
It follows that

s0λ ( un + 2 − un ) + s1 ( un +1 − un ) =
0

Note now that since s0λ + s1λ + s2 =


0 and that λ is a repeated root, we must
2

have 2λ = − s1 s0 . It follows that we must have ( un + 2 − un ) − 2 ( un +1 − un ) =


0,
so that

un + 2 − 2un +1 + un =
0
This implies that the sequence un is an arithmetic progression, so that

un= c1 + c2 n , where c1 and c2 are constants. It follows that the general solution
of the recurrence relation (3.5) in this case is given by

a=
n (c 1
+ c2 n ) λ n

64
where λ is the repeated root of the characteristic polynomial (3.7).

Case III

Since the characteristic equation has real coefficients, the complex roots occur in
conjugate pairs. In other words, if λ= λ1= u + iv is a root of the characteristic
equation with real coefficients, then its complex conjugate λ2= λ 1= u − iv is

also a root with v ≠ 0 .

By the general rule, the solution

an = Aλ1n + Bλ2n = A ( u + iv ) + B ( u − iv )
n n

Converting u + iv and u − iv into polar coordinates,

+ iv ρ ( cosθ + i sin θ ) ,
u= − iv ρ ( cosθ − i sin θ )
u=

And by DeMoivre’s Theorem,

 ρ ( cosθ ± i sin θ )  = ρ n ( cos nθ ± i sin nθ )


n

Then

a=
n
Aρ n ( cos nθ + i sin nθ ) + B ρ n ( cos nθ − i sin nθ )
=( A + B ) ρ n (cos nθ ) + i ( A − B) ρ n sin nθ

If we substitute A= B= , then an = ρ cos nθ is a particular solution.


1 n
2

65
Similarly if we substitute A = 2 i , then an = ρ sin nθ is also a
− 12 i and B =
1 n

particular solution. Therefore the general solution is

an =c1 ρ n sin nθ + c2 ρ n cos nθ =ρ n ( c1 sin nθ + c2 cos nθ ) .

where ρ =+
u 2 v 2 and θ =
tan −1 uv .

Example 3.26. The recurrence relation

an + 2 + 4an +1 + 3an =
0
has characteristic polynomial λ 2 + 4λ + 3 =0 , with roots λ1 = −3 and λ2 = −1 .
It follows that the general solution of the recurrence relation is given by

an = c1 ( −3) + c2 ( −1)
n n

Example 3.27

Solve

 yn =−3 yn −1 2 yn − 2 for n ≥ 2

 y2 = 7
y = 3
 1

Solution:

The characteristic equation is λ − 3λ + 2 =0 . Factorizing the left-hand side gives


2

( λ − 1)( λ − 2=) λ 1 or =
0 so that = λ 2 . The general solution is yn = c1 ⋅1n + c2 ⋅ 2n .

Using the initial conditions specified, c1 =


−1 and c2 =
2 , therefore the solution is

yn =−1 + 2 ⋅ 2n
= 2n +1 − 1

66
Example 3.28. The recurrence relation

an + 2 − 6an +1 + 9an =
0
has characteristic polynomial λ − 6λ + 9 = 0 , with repeated roots λ = 3 . It
2

follows that the general solution of the recurrence relation is given by

a=
n (c
1
+ c2 n ) 3n

Example 3.29

Solve

 yn =−6 yn −1 9 yn −2 for n ≥ 1

 y1 = 3
y = 5
 0

Solution:

The characteristic equation is λ 2 − 6λ + 9 =0 . Factorizing the left-hand side gives

( λ=
− 3) = λ 3 ( repeated ) . The general solution is
2
0 so that

yn = c1 ⋅ 3n + c2 n ⋅ 3n .

Using the initial condition specified, c1 = 5 and c2 = −4 , therefore the solution is

67
yn =5 ⋅ 3n − 4n ⋅ 3n
= 3n ( 5 − 4n )

Example 3.30. The recurrence relation

an + 2 + 4an =
0
has characteristic polynomial λ2 + 4 =0 , with roots λ1 = 2i and λ2 = −2i . It
follows that the general solution of the recurrence relation is given by

a=
n
b1 ( 2i ) + b2 ( −2i=
n n
(
) 2n b1i n + b2 ( −i )
n
)
  π π
n
 π π 
n

= 2  b1  cos + i sin  + b2  cos − i sin  


n

  2 2  2 2 

  nπ nπ   nπ nπ  
= 2n  b1  cos + i sin  + b2  cos − i sin 
  2 2   2 2  

 nπ nπ 
= 2n  ( b1 + b2 ) cos + i ( b1 − b2 ) sin 
 2 2 
 nπ nπ 
= 2n  c1 cos + c2 sin 
 2 2 

Example 3.31. The recurrence relation

an + 2 + 4an +1 + 16an =
0

has characteristic polynomial λ 2 + 4λ + 16 =


0 , with roots λ1 =−2 + 2 3i and
λ2 =−2 − 2 3i . It follows that the general solution of the recurrence relation is
given by

( ) ( )
n n
an = b1 −2 + 2 3i + b2 −2 − 2 3i

68
  1 3 
n
 1 3  
n

= 4  b1  − +
n
i  + b2  − − i 
  2 2   2 2  

  2π 2π 
n
 2π 2π  
n

= 4  b1  cos
n
+ i sin  + b2  cos − i sin  
  3 3   3 3  

  2nπ 2nπ   2nπ 2nπ 


= 4n  b1  cos + i sin  + b2  cos − i sin 
  3 3   3 3 

 2nπ 2nπ 
= 4n  ( b1 + b2 ) cos + i ( b1 − b2 ) sin 
 3 3 

 2nπ 2nπ 
= 4n  c1 cos + c2 sin 
 3 3 

Example 3.32

Solve yn + 2 yn −1 + 2 yn − 2 =
0

Solution:

The characteristic equation is λ 2 + 2λ + 2 =0 . Using the quadratic formula, we

−2 ± 4 − 8
have the roots: λ = =−1 ± i. Thus λ1 =−1 + i and λ2 =−1 − i .
2

Using the diagram,

69
y

−1 + i


4

−1 − i

=ρ 2 and θ
= 3π
4 .

( ) ( )
n n
=
Hence, yn A 2 sin 3 n4π + B 2 cos 3 n4π is the general solution.

We note that a characteristic equation is equally used for higher-order


recurrence relations.We now consider the general case. We are therefore
interested in the homogeneous recurrence relation

s0 an + k + s1an + k −1 + ... + sk an =
0 …………………..(3.11)
where s0 , s1 ,..., sk are constants, with s0 ≠ 0 . If we try a solution of the form

an = λ n as before, where λ ≠ 0 , then it can easily be shown that we must have

s0λ k + s1λ k −1 + ... + sk =


0 ………………………….(3.12)
This is called the characteristic polynomial of the recurrence relation (3.11).

70
We shall state the following theorem without proof.

Proposition 3.1 Suppose that the characteristic polynomial (3.12) of the


homogeneous recurrence relation (3.11) has distinct roots λ1 ,..., λs , with

multiplicities m1 ,..., ms respectively (where, of course, k = m1 + ... + ms ). Then the


general solution of the recurrence relation (3.11) is given by

∑ (b )λ ,
s
m j −1
=
an j ,1
+ b j ,2 n + ... + b j ,m n
j
n
j
j =1

where, for every j = 1,..., s, the coefficients b j ,1 ,..., b j ,m are constants. j

Example 3.33. The recurrence relation

an +5 + 7 an + 4 + 19an +3 + 25an + 2 + 16an +1 + 4an =


0
has characteristic polynomial

λ 5 + 7λ 4 + 19λ 3 + 25λ 2 + 16λ + 4 = ( λ + 1) ( λ + 2 ) = 0 with roots λ1 = −1


3 2

and λ2 = −2 with multiplicities m1 = 3 and m2 = 2 respectively. It follows that


the general solution of the recurrence relation is given by

an = ( c1 + c2 n + c3n 2 ) ( −1) + ( c4 + c5 n )( −2 )
n n

Example 3.34

Solve

=
 yn 7 yn − 2 − 6 yn − 3

 y0 =
1, y1 = −2 and y2 =
3

71
Solution:

The characteristic equation is λ 3 − 7λ + 6 =0. Factorizing the right-hand side


gives

( λ − 1)( λ − 2 )( λ =
+ 3) =
0 so that λ 1, 2 and − 3 .

The general solution is yn = c1 ⋅ 1n + c2 ⋅ 2n + c3 ( −3) .


n

5 4 11
Using the initial conditions, c1 =
, c2 =
− and c3 =
.
4 5 20

5  4  n  11 
So the solution is yn =−  2 +   ( −3) .
n

4 5  20 

Sometimes a recurrence relation can be converted into linear, constant-


coefficient form although it might not originally be in that form.

Example 3.35

Consider the recurrence relation:

 yn = − yn −1 + 6 yn −2

 y1 = 1
y = 9
 0

72
Solution:

Using the substitution g n = yn transforms the recurrence relation into

 gn = − g n −1 + 6 g n −2

 g1 = 1
g = 3
 0

Using the appropriate standard method

g n =1 ⋅ ( −3) + 2 ⋅ 2n and therefore yn = g n2 = 1( −3) + 2 ⋅ 2n 


n n 2

2-3.4 The Non – Homogeneous Case


We study equations of the type

s0 an + k + s1an + k −1 + ... + sk an =f ( n ) ……………………………………(3.13)

where s0 , s1 ,..., sk are constants, and where f ( n ) is a given function.

(c)
Suppose that an is the general solution of the reduced recurrence relation

s0 an + k + s1an + k −1 + ... + sk an =
0 …………………………………(3.14)

73
(c)
so that the expression of an involves k arbitrary constants. Suppose further
( p)
that an is any solution of the non-homogeneous recurrence relation (3.13).

Then

s0 an( c+)k + s1an( c+)k −1 += ... + sk an( p ) f ( n )


... + sk an( c ) 0 and s 0 an( +p k) + s1an( +p k) −1 +=
Let

an an( c ) + an( p ) …………………..(3.15)


=
Then

s0 an + k + s1an + k −1 + ... + s=a s0 ( an( c+)k + an( +p k) ) +


k n

s1 ( an( c+)k −1 + an( +p k) −1 ) + ... + sk ( an( c ) + an( p ) )

= ( s a( )
0
c
n+k
+ s1an( c+)k −1 + ... + sk an( c ) ) + ( s0 an( +p k) + s1an( +p k) −1 + ... + sk an( p ) )
0 + f (n) =
= f ( n ).

It is therefore reasonable to say that (3.15) is the general solution of the non-
homogeneous recurrence relation (3.13).
(c)
The term an is usually known as the complementary function of the recurrence
( p)
relation (3.13), while the term an is usually known as a particular solution of
( p)
the recurrence relation (3.13). Note that an is in general not unique.

To solve the recurrence relation (3.13), it remains to find a particular solution

an( p ) .

The Method of Undetermined Coefficients

74
In this section, we are concerned with the question of finding particular solutions
of recurrence relations of the type

s0 an + k + s1an + k −1 + ... + sk an =f ( n ) …………………………(3.16)


w
here f (n) ( p)
trial an f (n) ( p)
trial an

s0 , s1 ,...sk
are
const
ants, and where f ( n ) is a given function.

The method of undetermined coefficients is based on assuming a trial form for


( p)
the particular solution an of (3.16) which depends on the form of the function

f ( n ) and which contains a number of arbitrary constants. This trial function is


then substituted into the recurrence relation (3.16) and the constants are chosen
to make this a solution.

The basic trial forms are given in the table below ( c denotes a constant in the

expression of f ( n ) and A (with or without subscripts) denotes a constant to be

determined):

75
c A c sin α n A1 cos α n + A2 sin α n

cn A0 + A1n c cos α n A1 cos α n + A2 sin α n

cn 2 A0 + A1n + A2 n 2 cr n sin α n A1r n cos α n + A2 r n sin α n

cn m ( m ∈  ) A0 + A1n + A2 n 2 + Am n m cr n cos α n A1r n cos α n + A2 r n sin α n

cr n ( r ∈  ) Ar n cn m r n r n ( A0 + A1n + Am r m )

Example 3.36 Consider the recurrence relation

an +2 + 4an +1 + 3an =5 ( −2 ) n

It has been shown in Example 3.26 that the reduced recurrence relation has
complementary function

an( c ) = c1 ( −3) + c2 ( −1)


n n

For a particular solution, we try

an( =
p)
A ( −2 )
n

Then

A( 2) −2 A ( −2 )
n +1
anp+1 =− =
n

and

an( +p 2) =A ( −2 ) =4 A ( −2 )
n+2 n

It follows that

76
( 4 A − 8 A + 3 A)( −2 ) =
an( +p 2) + 4an( +p1) + 3an( p ) = − A ( −2 ) =−
5( 2)
n n n

if A = −5 .

Hence

an = an( c ) + an( p ) = c1 ( −3) + c2 ( −1) − 5 ( −2 )


n n n

Example 3.37. Consider the recurrence relation

nπ nπ
an + 2 + 4=
an 6cos + 3sin
2 2
It has been shown in Example 3.30 that the reduced recurrence relation has
complementary function

 nπ nπ 
=an( c ) 2n  c1 cos + c2 sin 
 2 2 
For a particular solution, we try

nπ nπ
=an( p ) A1 cos + A2 sin
2 2
Then

=an( +p1) A1 cos


( n + 1)π + A2 sin
( n + 1)π
2 2

 nπ π nπ π  nπ π nπ π
= A1  cos cos − sin sin  + A2  sin cos + cos sin 
 2 2 2 2  2 2 2 2

nπ nπ
= A2 cos − A1 sin
2 2
and

77
=an( +p 2) A1 cos
( n + 2 )π + A2 sin
( n + 2 )π
2 2

 nπ nπ   nπ nπ 
= A1  cos cos π − sin sin π  + A2  sin cos π + cos sin π 
 2 2   2 2 

nπ nπ
=
− A1 cos − A2 sin
2 2
It follows that

nπ nπ nπ nπ
an( +p 2) + 4an(=
p)
3 A1 cos + 3 A2 sin = 6cos + 3sin
2 2 2 2
if A1 = 2 and A2 = 1 .

Hence

 nπ nπ  nπ nπ
an = an( c ) + an( p ) = 2n  c1 cos + c2 sin  + 2cos + sin
 2 2  2 2

Example 3.38. Consider the recurrence relation

nπ nπ
an + 2 + 4an +1 + 16
= an 4n + 2 cos − 4n +3 sin
2 2
It has been shown in Example 3.31 that the reduced recurrence relation has
complementary function

 2nπ 2nπ 
=an( c ) 4n  c1 cos + c2 sin 
 3 3 
For a particular solution, we try

 nπ nπ 
=an( p ) 4n  A1 cos + A2 sin 
 2 2 
78
Then


an( +p1) =4n +1  A1 cos
( n + 1)π + A sin ( n + 1)π 
= n nπ

nπ 
 4  2
4 A cos 4 A sin 
 2 
2 1
 2 2  2
and

=

an( +p 2) 4n + 2  A1 cos
( n + 2 )π + A sin ( n + 2 )π 
2 
 2 2 
 nπ nπ 
=
4n  −16 A2 cos − 16 A1 sin 
 2 2 

It follows that

nπ nπ
an( +p 2) + 4an( +p1) +=
16an( p ) 16 A2 4n cos − 16 A1 4n sin
2 2
nπ nπ
= 4n + 2 cos − 4n +3 sin
2 2
If A1 = 4 and A2 = 1 . Hence

 2nπ 2nπ nπ nπ 
an = an( c ) + an( p ) = 4n  c1 cos + c2 sin + 4cos + sin 
 3 3 2 2 

For f ( n ) = cr c, r are constants, if the characteristic polynomial (3.14) has


n

λ = r as a root of multiplicity k , then the trial function is of the form


an( p ) = An k r n , where A constant to be determined. If λ = r is Not a root, take
k = 0 . k = 1 if λ = r , k = 2 if λ=
1
λ=
2
r , and so on.

Example 3.39.

79
an + 2 + 4an +1 + 3an =12 ( −3) .
n
Solve the recurrence relation

Solution:

λ 2 + 4λ + 3 =0 ⇒ λ =−3, −1

an( c ) = c1 ( −3) n + c2 ( −1) n

For a particular solution, the trial solution

( p)
a= An ( −3)
n
n

Then

A ( n + 1)( −3) −3 An ( −3) − 3 A ( −3)


n +1
an( +p1) = =
n n

and

an( +p 2) = A ( n + 2 )( −3) = 9 An ( −3) + 18 A ( −3)


n+2 n n

It follows that

an( +p 2) + 4an( +p1) + 3an( p ) = ( 9 A − 12 + 3 A ) n ( −3) + (18 A − 12 A )( −3) = 12 ( −3)


n n n

⇒ 6 A ( −3) = 12 ( −3)
n n

⇒ A=
2

Hence

an = an( c ) + an( p ) = c1 ( −3) + c2 ( −1) + 2n ( −3)


n n n

Example 3.40.

80
Consider the recurrence relation

an + 2 − 6an +1 + 9an =
3n

The characteristic polynomial of the homogeneous part is:

λ 2 − 6λ + 9 =0 ⇒ λ = λ1 = λ2 = 3

The complementary solution is: an(=


c)
(c
1
+ c2 n ) 3n

For the roots of the polynomial , then k = 2 , so we have the particular solution
as:

an( p ) = An 2 3n

Then

an( +p1) = A ( n + 1) 3n +1 = A ( 3n 2 + 6n + 3) 3n
2

an( +p 2) = A ( n + 2 ) 3n + 2 = A ( 9n 2 + 36n + 36 ) 3n
2
and

It follows that

an( +p 2) − 6an( +p1) + 9an( p ) = 18 A3n = 3n

If A = 1 / 18 .

Hence

(c) ( p)  n2  n
a n = a n + an =  c1 + c2 n +  3
 18 

For f ( n ) = cr sin α n or cr cos α n , or both, a, b constants, if λ + r =


0 or
n n 2 2

λ 2 + r 2 is a factor of the auxiliary equation of multiplicity k , then the trial

81
=
function would be an n( p) k
( A sin α n + A cosα n ) , where
1 2
A, B are constant

to be determined. If λ 2 + r 2 is Not a factor, then k = 0 . k = 1 if λ 2 + r 2 is


the only factor.

Example 3.41.

Consider the recurrence relation


an + 2 + 4an =
2n cos
2

It has been shown in Example 3.30 that the reduced recurrence relation has
complementary function

 nπ nπ 
=an( c ) 2n  c1 cos + c2 sin 
 2 2 

For a particular solution, we will then have:

 nπ nπ 
=an( p ) n 2n  A1 cos + A2 sin 
 2 2 

Then

 ( n + 1)π + A sin ( n + 1)π 


( n + 1) 2n+1  A1 cos
an( +p1) = 2 
 2 2 

 nπ nπ 
⇒ an( +p1) =( n + 1) 2n +1  A2 cos − A1 sin 
 2 2 

and

82
 ( n + 2 )π + A sin ( n + 2 )π 
( n + 2 ) 2n+2  A1 cos
an( +p 2) = 2 
 2 2 

 nπ nπ 
⇒ an( +p 2) =( n + 2 ) 2n + 2  − A1 cos − A2 sin 
 2 2 

It follows that

nπ nπ  nπ nπ 
( n + 2 ) 2n+2  − A1 cos − A2 sin  + 4  n2n  A1 cos + A2 sin  
an( +p 2) + 4an( p ) =
 2 2    2 2 
nπ nπ
⇒ an( +p 2) + 4an( p ) = − ( n + 2 ) 2n + 2 + 4n 2n  A1 cos +  − ( n + 2 ) 2n + 2 + 4n 2n  A2 sin
2 2

nπ nπ nπ
=
−2n +3 A1 cos − 2n +3 A2 sin =
2n cos
2 2 2

If A1 = −1 / 8 and A2 = 0 . Hence

 nπ nπ n nπ 
an = an( c ) + an( p ) = 2n  c1 cos + c2 − cos 
 2 2 8 2 

 Self Assessment 2-3

1. Solve each of the following homogeneous linear recurrences:

a) an + 2 − 6an +1 =
− 7 an 0 b) an + 2 + 10an +1 +=
25an 0 e) an +3 + 5an + 2 + 12an +1 − 18an =
0

c) an +3 − 6an + 2 + 9an +1 −=
4an 0 d) an + 2 − 4an +1 + =
8an 0

2. For each of the following linear recurrences, write down its characteristic polynomial,
the general solution of the reduced recurrence, and the form of a particular solution to
the recurrence:

83
a) an + 2 + 4an +1 − 5an = 4 b) an + 2 + 4an +1 - 5an = n 2 + n + 1

c) an=
+2
− 2an +1 − 5an cos nπ d) an=
+2
+ 4an +1 + 8an 2n sin ( nπ 4 )

e) a= − 9 an 3 f ) a= − 9an n3n
n
n+2 n+2

g)=
an + 2 − 9an n 3 h) an + 2 −=
6an +1 + 9an 3n
2 n

i) an + 2 − 6an +1 + 9an =3 + 7
n n
(
j) an + 2 + 4an =2n cos nπ
2 )
k) an + 2 + 4an 2 cos nπ
= l) an + 2 + 4an n 2n sin nπ
=
n

3. For each of the following functions f ( n ) use the method of undetermined


coefficients to find a particular solution of the non-homogeneous linear recurrence
f ( n ).
an + 2 − 6an +1 − 7 an =

Write down the general solution of the recurrence, and then find the solution that
satisfies the given initial conditions:

a) f ( n ) =
24 ( −5 ) ; a0 =
3, a1 =
−1 b) f ( n ) =
16 ( −1) ; a0 =
4, a1 =
n n
2

c) f ( n ) = (
8 ( −1) + 7 n ; a0 =
n
)
5, a1 =
11 d) f ( n ) =
12n 2 − 4n + 10; a0 =
0, a1 =
−10

nπ nπ
e) f ( n ) =
2 cos + 36sin ; a0 =
20, a1 =
3
2 2

84
Unit 4
BOOLEAN ALGEBRA, LOGIC GATES

Introduction

We shall have an insight into the basic mathematical logic behind language of computer usage.
An understanding of this unit will ease up complex structures in the complex language of the
computer. You are encouraged to put in some effort to follow this unit

Learning Objectives

After reading this unit you should be able to:

1. Use Boolean symbols as analogous to logical


symbols
2. Use Boolean symbols for electrical circuits

Unit content

Session 1-4: Boolean Algebra and Function


1-4.1Basic Definitions and Theorems
1-4.2Boolean Expressions and Functions
1-4.3Duality
1-4.4Representation of Boolean Functions
Session 2-4: Logic Gates
2-4.1Logic Gates Forms
2-4.2Combinations of Gates
2-4.3Examples of circuit

85
SESSION 1-4: BOOLEAN ALGEBRA AND FUNCTIONS

1-4.1 Basic Definitions and Theorems

Definition (Boolean Algebra)

Let B be a set on which are defined two binary defined operators, + and ∗ , and a
unary operation, denoted by ' ; let 0 and 1 denote two distinct elements of B . Then the
sextuplet

B, +, ∗, ′, 0, 1

is called a Boolean algebra if the following axioms hold for any elements: a, b, c ∈ B ;

[B1 ] Commutative laws:


(1a ) a + b = b + a (1b ) a ∗ b = b ∗ a
[B2 ] Distributive laws:

( 2a ) a + ( b ∗ c ) = ( a + b ) ∗ ( a + c ) ( 2 b) a ∗ (b + c ) = ( a ∗ b) + ( a ∗ c )
[B3 ] Identity Laws:
( 3a ) a + 0 =a ( 3b ) a ∗1 =a
[B 4 ] Complement Laws:
( 4a ) a + a′ =
1 ( 4b ) a ∗ a′ =
0

The sextuplet is denoted by B when the operations are understood. The element 0 is
called the zero element, the element 1 is called the unit element, and a ' is called the
complement of a . The results of the operations + and ∗ are called the sum and
product, respectively. We will frequently drop the symbol ∗ and use juxtaposition
instead. Then ( 2b ) and ( 2a ) are written

( 2b ) a ( b + c ) = ab + ac ( 2a ) a + bc = ( a + b )( a + c )

86
The following convention, unless guided by parenthesis, is that ' has precedence over
∗ , and ∗ has precedence over +.

For example

a + b ∗ c means a + ( b + c ) not ( a + b ) ∗ c
a ∗ b ' means a ∗ ( b ) ' and not ( a ∗ b ) '

The Boolean Algebra B With Two Elements 0 And 1 (Called Bits)

Let + and ∗ be the binary operations in B . =


Let 0 ' 1=
and 1' 0 .

• '

1 0

0 1

Then we have the following two fundamental tables:

+ 1 0 * 1 0

1 1 1 1 1 0

0 1 0 0 0 0

Example 4.1

Find the value of 1 ∗ 0 + ( 0 + 1) '

87
Solution:

From the tables:

( 0 + 1) = 1
and ( 0 + 1) ' =1' =0
1 ∗ 0 + ( 0 + 1) ' =1 ∗ 0 + 0
= 0+0
=0

The complement, Boolean sum and Boolean product correspond to the logical operators
 , ∨ and ∧ respectively, where 0 corresponds to F (false) and 1 to T (true).

88
1-4.2 Boolean Expressions and Boolean Functions
Let B = {0,1} . The variable x is called a Boolean variable if it takes values only from

B . A function
= F : Bn {( x , x ,..., x ) x ∈ B, 1 ≤ i ≤ n} → B
1 2 n i is called a Boolean function

of degree n . The values of a Boolean function are displayed in tables.

Example 4.2

The Boolean function F ( x, y ) with the value 1 when


= and y 0 and the value 0 for
x 1=

all other choice of x and y is represented by the table

x y F ( x, y )

1 1 0

1 0 1

0 1 0

0 0 0

Boolean functions are represented by Boolean expressions made up of the variables


and the Boolean operations. Boolean algebra ( B, +, ∗, ', 0, 1) are defined recursively

as

For each s ∈ B , s is a Boolean expression. x1 , x2 ,..., xn are Boolean expressions.

If x1 and x2 are Boolean expressions, so are x1 , x2 , x1 + x2 and x1 ∗ x2 .


' '

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.

89
Example 4.3

Find the values of the Boolean function represented by F ( x, y , z=


) xy + z '
Solution:

x y z xy= x ∗ y z' F ( x, y , z )

1 1 1 1 0 1

1 1 0 1 1 1

1 0 1 0 0 0

1 0 0 0 1 1

0 1 1 0 0 0

0 1 0 0 1 1

0 0 1 0 0 0

0 0 0 0 1 1

The Boolean functions F and G of n variables are equal if and only if


F ( b1 , b2 ,..., bn ) G ( b1 , b2 ,..., bn ) whenever b1 , b2 ,..., bn ∈ B .

Two different expressions that represent the same function are called equivalent. For
example, the Boolean expressions: xy, xy + 0, xy ∗ 1 are equivalent.

The complement of the Boolean function F is the function F ' .

90
Let F and G be Boolean functions of degree n . The Boolean sum F + G and the
Boolean product F ∗ G are defined by

( F + G )( x , x ,..., x ) =F ( x , x ,..., x ) + G ( x , x ,..., x )


1 2 n 1 2 n 1 2 n

( F ∗ G )( x , x ,..., x ) =F ( x , x ,..., x ) ∗ G ( x , x ,..., x )


1 2 n 1 2 n 1 2 n

Recalling the definition of a function or a given domain into a co-domain using

b ({ f : f : B → A}) =
b ( A)
b( B )
exponentiation, we have . Where b denotes the

cardinality or distinct number of elements in a given set.

Therefore a Boolean function of degree 2, by definition, is a function from a set with


four elements, namely, pairs of elements from B = {0,1} , to B , a set of two elements.

Hence, there are 24 = 16 different Boolean functions of degree 2 . That is, we want to

(
find b F : B 2 = B ∗ B = { x1 , x2 } : x1 ∈ B = {0,1} → B . )

In a similar analysis, the different Boolean functions of degree n is 2 .


2n

91
Identities of Boolean Algebra

There are many identities of Boolean algebra but we provide the most important of
them as displayed in the following table:

Boolean Identities

Identity Name

( x ') ' = x Law of double complement

x+x = x
Idempotent laws
x⋅x =x

x+0= x
Identity laws
x⋅0 =0

x +1 =1 Dominance laws
x⋅0 =0

x+ y = y+x Commutative laws


xy = yx

x + ( y + z) = ( x + y) + z
x ( yz ) = ( xy ) z Associative laws

x + ( yz ) =( x + y ) ( x + z) Distributive laws
x ( y + z ) = xy + xz

( xy )=' x '+ y '


( x + y ) ' =x '⋅ y ' De Morgan’s laws

92
Example 4.4

Show that the distributive law x ( y + z ) = xy + xz is valid.

Solution:

The verification is shown in the following table

x y z y+z xy xz x( y + z) xy + xz

1 1 1 1 1 1 1 1

1 1 0 1 1 0 1 1

1 0 1 1 0 1 1 1

1 0 0 0 0 0 0 0

0 1 1 1 0 0 0 0

0 1 0 1 0 0 0 0

0 0 1 1 0 0 0 0

0 0 0 0 0 0 0 0

The identity holds because the last two columns of the table agree. The basic
important identities summarized in the previous table can be used to prove further
identities.

93
Example 4.5

Prove the absorption law x ( x + y ) =


x , verify the identities of Boolean algebra.

Solution:

The steps used to derive this identity and the law used in each step follows:

x ( x + y ) = ( x + 0 )( x + y ) Identity law for the Boolean sum

=x + ( 0 ⋅ y ) Distributive law of the Boolean sum over the Boolean product


= x + y⋅0 Commutative law for the Boolean product

= x+0 Dominance law for the Boolean product

=x Identity law for Boolean sum

94
1-4.3 Duality
Observe that in the table of Boolean Identities, the identities come in pairs (except for
the double complement). To fully explain the relationship between the two identities in
each pair, we use the concept of a dual. The dual of a Boolean expression is obtained
by interchanging Boolean sums and Boolean products and interchanging 0’s and 1’s.

Example 6

Find the duals of x ( y + 0 ) and x '⋅1 + ( y '+ z ) .

Solution:

Interchanging * signs and + signs and interchanging 0’s and 1’s in these expressions
produces their duals. The duals are x + ( y ⋅1) and ( x '+ 0 )( y ' z ) respectively.

The dual of a Boolean function F represented by a Boolean expression is the function


represented by the dual of this expression. This dual function, denoted by F d , does not
depend on the particular Boolean expression used to represent F .

An identity between functions represented by Boolean expressions remains valid when


the duals of both sides of the identity are taken. That is, if F and G are Boolean
functions represented by Boolean expressions in n variables and F = G, then Fd = Gd,
where Fd and Gd are the Boolean functions represented by the duals of the Boolean
expressions representing F and G, respectively. This result, called the duality
principle is useful for obtaining new identities.

95
Example 4.7

Construct an identity from the absorption law: x ( x + y ) =


x given in example 5 by taking

duals.

Solution:

Taking duals of both sides of this identity produces the identity x + ( xy ) =


x , which is

also called an absorption law.


1. Find the values of the following expressions
(a ) 1 ⋅ 0′ (b) 1 + 1' (c) 0 '⋅ 0 ( d ) (1 + 0 ) '

2. Find the values, if any, of the Boolean variable x that satisfy the following
equations:
( a ) x ⋅1 0
= (b) x + x 0
= ( c ) x ⋅1 x
= (d ) x ⋅ x ' 1
=
 Hint: use tables for x ∈ {0,1}

3. What values of the Boolean variables x and y satisfy xy= x + y ? [Hint: use table]

4. How many different Boolean functions are there of degree 7?


5. Prove the absorption law x + xy =
x using the laws in table 5.

6. Show that F ( x, y, z ) = xy + xz + yz has the value 1 if and only if at least two of

the variables x, y and z have 1. (use tables)

7. Show that xy '+ yz '+ x ' z = x ' y + y ' z + xz ' . (use tables)

96
Exercise 8-15 deal with the Boolean algebra defined by the Boolean sum and Boolean
product on {0,1}

8. Verify the law of double complement


9. Verify the idempotent laws
10. Verify the identity laws
11. Verify the dominance laws
12. Verify the commutative laws
13. Verify the associative laws
14. Verify the first-distributive law in Table 5
15. Verify De Morgan’s laws.

The operator ⊕ , called the xOR operator, is defined by

(a ) 1⊕
= 1 0, 1⊕
= 0 1 1⊕
= 0 1 and 0⊕
= 0 0

16. Simplify the following expressions


(a ) x⊕0 (b) x ⊕1 (c) x⊕ x (d) x⊕ x'

(use tables)

17. Show that the following identities hold:


(a ) x ⊕ y = ( x + y )( xy ) ' (b) x ⊕ y = ( xy ') + ( x ' y )

18. Show that x ⊕ y = y ⊕ x

19. Prove or disprove the following equalities

(a ) x ⊕ ( y ⊕ z) = ( x ⊕ y) ⊕ z
(b) x + ( y ⊕ z) = ( x + y) ⊕ ( x + z)
(c) x ⊕ ( y + z) = ( x ⊕ y) + ( x ⊕ z)

97
1-4.4 Representation Boolean Functions
Two important problems of Boolean algebra will be examined.

The first problem is: Given the values of a Boolean function, can the function be found?
This problem will be solved by showing that any Boolean function may be represented
by a Boolean sum or Boolean product of the variables and their complements, that is,
every Boolean function can be represented using the three Boolean operators:

⋅, + and ' .

The second problem is: Is there a smaller set of operators that can be used to
represent all Boolean functions? This will be answered by showing that all Boolean
functions can be represented using only one operator.

The foregoing problems have practical importance in circuit design.

Sum of Products Expansions

We use examples to illustrate one important way to find a Boolean expression that
represents a Boolean function.

Example 4.8

Find Boolean expressions that represent the functions F ( x, y, z ) and G ( x, y, z ) , which

are given in Table 1.

98
Table 1

x y z F G

1 1 1 0 0

1 1 0 0 1

1 0 1 1 0

1 0 0 0 0

0 1 1 0 0

0 1 0 0 1

0 0 1 0 0

0 0 0 0 0

Solution:

F has value 1 when x= z= 1 and y= 0 and θ otherwise. Such an expression is formed

by taking the Boolean product of x, y ' and z . This product xy ' z has value 1 if and only

if x= y =' z= 1 , which holds if and only if x= z= 1 and y= 0 .

To represent G , we need an expression that equals 1 when x= y= 1 and z= 0 , or when

x= z= 0 and y= 1 . We can form an expression with these values by taking the Boolean

sum of two different Boolean products. The Boolean product xyz ' has the value 1 if and

only if x= z= 0 and y= 1 . The Boolean sum of these two products xyz '+ x ' yz ' represent

G, since it has the value 1 if and only if x= y= 1 and z= 0 or x= z= 0 and y= 1.

99
Definition

A literal is a Boolean variable or its complement. A minterm of the Boolean variables


x1 , x2 ,..., xn is a Boolean product y1 , y2 ,..., yn where
= yi x=
i or yi xi' . Hence, a minterm is

a product of n literals with one literal for each variable.

Example 4.9

Find a minterm that equals 1 if x=


1 x=
3 0 and x=
2 x=
4 x=
5 1 , and equals 0 otherwise.

Solution:

The minterm x1' x2 x3' x4 x5 has the correct set of values.

By taking Boolean sums of distinct minterms we can build up a Boolean expression with
a specified set of values. In particular, a Boolean sum of minterms has the value 1
when exactly one of the minterms in the sum has the value 1. Consequently, given a
Boolean function, a Boolean sum of minterms can be formed that has the value 1 when
this Boolean function has the value 1. The minterms in this Boolean sum correspond to
those combinations of values for which the function has the value 1. The sum of
minterms that represents the function is called the sum of products expansion or
the disjunction normal forms of the Boolean function.

100
Example 4.10

Find the sum of products expansion for the function F ( x, y, z=


) ( x + y ) z′

Solution:

The first step is to find the values of F . These are found in table 2. The sum-of-
products expansion of F is the Boolean sum of three minterms corresponding to the
three rows of this table that give the value 1 for the function.

This gives F ( x, y, z ) =xyz '+ xy ' z '+ x ' yz ' .

Table 2

x y z x+ y z′ ( x + y ) z′ =
F

1 1 1 1 0 0

1 1 0 1 1 1

1 0 1 1 0 0

1 0 0 1 1 1

0 1 1 1 0 0

0 1 0 1 1 1

0 0 1 0 0 0

0 0 0 0 1 0

It is also possible to find a Boolean expression that represents a Boolean function by


taking a Boolean product of Boolean sums. The resulting expansion is called the

101
conjugate normal form or product-of-sums expansion of the function. These
expansions can be found from the sum-of-products expansions by taking duals.

Functional Completeness

Every Boolean function can be expressed as a Boolean sum of minterms, which are
Boolean products of Boolean variables or their complements. This shows that every
Boolean function can be represented using the Boolean operations ⋅, + and ' . We

therefore say that the set {⋅, +, '} is functionally complete.

Can we find a smaller set of functionally complete operators? This is achievable if one
of the three operators of this set can be expressed in terms of the other two.

There are two such procedures, in a De Morgan’s laws:

I. Eliminate all Boolean sums using the identity


( x ' y ') '
x+ y =

Thus the set {⋅, '} is functionally complete.

II. Eliminate all Boolean products using the identity


=
xy ( x '+ y ') '

Thus the set {+, '} is functionally complete.

However, the set {⋅, +} is not functionally complete.

102
Can we find a smaller set of functionally complete operators, namely, a set containing
just one operator? Such sets exist.

1 1 0 ↓ 1 0

1 0 1 1 0 0

0 1 1 0 0 1

Define two operator | or NAND (not AND) operator, defined by

= 0 and 1=
11 0 0= 0 0; and ↓ or NOR ( not OR )
1 0=

defined by 1 ↓ 1 = 1 ↓ 0 = 0 ↓ 1 = 0 and 0 ↓ 0 = 1 .

Both of the sets {|} is functionally complete. Since {⋅, '} is functionally complete, all

we need to do is show that both operators ⋅ and ' can be expressed using just |
operator. This is done as follows:

x' = x x
xy = ( x y ) ( x y )

103
 Exercise

1. Find a Boolean product of the Boolean variable x, y and z or their complements,

that has the value 1 if and only if


( a ) x= y= 0, z= 1
(b) = x 0, =
y 1=
z 0
( c ) x= 0, y= z= 1
( d ) x= y= z= 0

2. Find the sum-of-products expansions of the following Boolean functions


( a ) F ( x, y )= x '+ y
( b ) F ( x, y ) = xy '
( c ) F ( x, y ) = 1
( d ) F ( x, y ) = y '

3. Find the sum-of-products expansions of the following Boolean functions


( a ) F ( x, y , z ) = x + y + z
( b ) F ( x, y, z=) ( x + z ) y
( c ) F ( x, y , z ) = x
( d ) F ( x, y, z ) = xy '

4. Find the sum-of-products expansions of the Boolean function F ( x, y, z ) that

equals 1 if and only if


=( a ) x 0=( b ) xy 0
(c) x + y 0 =
= ( d ) xyz 0

5. Find the sum-of-products of the Boolean function F ( w, x, y, z ) that has the value

1 if and only if are odd number of w, x, y and z have the value 1

104
6. Find the sum-of-products expansions of the Boolean function F ( x1 , x2 , x3 , x4 , x5 )

that has the value 1 if and only if three or more of the variables x1 , x2 , x3 , x4 , x5

have the value 1.


In question numbers 7-11, find a Boolean expression that represents a Boolean function
formed from a Boolean product of Boolean sums of literals.

7. Find a Boolean sum containing either x or x ' , either y or y 'and either z or z ' that

have the value 0 if and only if


(a) x= y= 1, z= 0
(b ) x= y= z= 0
(c) x= z= 0, y= 1

8. Find a Boolean product of Boolean sums of literals that has the value 0 if and
only if either x= y= 1 and z= 0, x= z= 0 and y= 1 or x= y= z= 0 (Hint: take the

Boolean product of Boolean sums found in parts (a), (b) and (c) in7).
9. Show that the Boolean sum y1 + y2 + ... + yn , where
= =
yi xi and xi 1 if yi = xi' . This

Boolean sum is called a maxterm.

10. Show that a Boolean function can be represented as a Boolean product of


maxterms. This representation is called the product-of-sums expansion or
conjugate normal form of the function. (Hint: include one maxterm in this
product for each confirmation of the variables where the function has the value
0).
11. Find the product-of-sums expansion of each of the Boolean functions in (3).
12. Express each of the following Boolean functions using the operators ⋅ and ' .

(a) x + y + z
( b ) x + y ' ( x '+ z )
( c ) ( x + y ') '
( d ) x ' ( x + y '+ z ')

105
13. Express each of the Boolean functions in (12) using the operators ⋅ and ' .
14. Show that

=( a ) x ' x=
x ( b ) xy ( x y )( x y )
(c) ( x x )( y y )
x+ y=

15. Show that

(a) x ' =x ↓ x (b) xy =( x ↓ x ) ↓ ( y ↓ y )


(c) x + y = ( x ↓ y) ↓ ( x ↓ y)

16. Show that {↓} is functionally complete using (15)

17. Express each of the Boolean functions in (3) using the operator .

18. Express each of the Boolean functions in (3) using the operator ↓ .

106
SESSION 2-4: LOGIC GATES

2-4.1 Logic Gates Forms


We use Boolean algebra to model the circuiting of electronic devices. We take each
input and each output of such a device as a member of the set {0,1} .

A computer, or any electronic device, is made up of circuits. Each circuit is designed


using the rules of Boolean algebra so far studied. The basic elements of circuits are
called gates, so that each type of gate implements a Boolean operation. With these
gates, we apply the rules of Boolean algebra to design circuits to perform variety of
tasks. Such circuits give output, that depends only on the inputs, and not on memory
capacities. Such circuits are called combinatorial circuits.

Combinatorial circuits are constructed using three basic types of elements which we
describe as follows:

I. An inverter: This accepts the value of a Boolean variable as an input and


produces its complement as its output. This is represented by

x x'

Input Output

II. OR gate: The inputs of this gate are two or more Boolean variables. The output
is the Boolean sum of their values. This is represented by

x x+ y
y
Output
Input

107
III. AND gate: The inputs to this gate are of two or more Boolean variables. The
output is the Boolean product of their values. This is represented by

x
xy

y Output

Input

More inputs are permitted to AND and OR gates. Such situations are shown below

x1
x2
x1 x2 ...xn
...
xn

x1
x2
... x1 + x2 + ... + xn
xn

108
2-4.2 Combinations of Gates
Combination 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.
One method is the use of branching to indicate all the gates that use a given input.

x
xy

y
xy + x ' y

x'

x' y

The other method is to indicate this input separately for each gate.

x xy

y
xy + x ' y

x'
x x' y

109
Note also that the output from a gate may be used as input by one or more elements
as shown in the above two diagrams. Note also that the two diagrams represent the
same input and output circuiting.

EXAMPLE 4.11

Construct circuits that produce the following outputs:

( a ) ( x + y ) x '; (b) x ' ( y + z ') ';


( c ) ( x + y + z )( x ' y ' z ')

Solution:

(a)

x x+ y

y
( x + y) x '

x'
x

110
OR

x x+ y

y
( x + y) x '

x'

(b)

x'
x
x ' ( y + z ') '

y ( y + z ') ( x + z ') '


z'
z

111
x
(x + y + z)
y

( x + y + z )( x ' y ' z ')


x'
x
y' x' y'z'
y

z'
z

112
2-4.3 Examples of Circuit
We give some examples of circuits that perform some useful functions.

Example 4.12

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 received
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 he votes no; let y = 1 if the second

votes yes and y = 0 if he 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. The

representations of the Boolean function that have these output values are
F ( x, y, z ) = xy + xz + yz or F ( x, y, z ) = xy + xz + xyz + yz .

We draw the circuit of F ( x, y, z ) .

x xy

x xz
xy + xz + yz
z

y yz

113
Draw the circuit of F ( x, y, z ) = xy + xz + xyz + yz .

Example 3

Sometimes light fixtures are controlled by more than one switch. Circuits need to be
designed so that flipping any one of the switches 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.

Solution:

I. For two switches


Let x = 1 when the switch is closed and x = 0 when it is opened and let y = 1 when the

second switch is closed and y = 0 when it is opened. Let F ( x, y ) = 1 when the light is

on and F ( x, y ) = 0 when it is off. We arbitrary decide that the light is on when both

switches are closed, so that F (1,1) = 1 . This determines all the other values of F.

(1, 0 ) F=
When one of the two switches is opened, the light goes off, so F= ( 0,1) 0 .
When the other switch is opened, the light goes on, so that F ( 0, 0 ) = 1 . The following

table displays these values.

x y F ( x, y )

1 1 1

1 0 0

0 1 0

0 0 1

114
Then we see that F ( x, y=
) xy + x ' y ' with the following circuit:

x xy

xy + x ' y '

x'
x x' y'
y'
y

II. For three switches


Let x, y and z be the Boolean variables that indicate whether each of the three

switches are closed.

Let x = 1 when first switch is closed and x = 0 when it is opened;

Let y = 1 when the second switch is closed and y = 0 when it is opened;

Let z = 1 when the third switch is closed and z = 0 when it is opened.

Let F ( x, y, z ) = 1 when light is on and F ( x, y, z ) = 0 when the light is off.

We arbitrary specify that the light be on when all three switches are closed, so that
F (1,1,1) = 1 . This determines all the values of F . When one switch is open the light

(1,1, 0 ) F=
goes off, so that F= (1, 0,1) F=
( 0,1,1) 0 .

When a second switch is opened, the light goes on, so that


(1, 0, 0 ) F=
F= ( 0, 0,1) F=
( 0,1, 0 ) 1 . Finally, when the third switch is opened, the light
goes off again, so that F ( 0, 0, 0 ) = 0 . The following table and circuit display the

foregoing analysis.

115
x y z F ( x, y , z )

1 1 1 1

1 1 0 0

1 0 1 0

1 0 0 1

0 1 1 0

0 1 0 1

0 0 1 1

0 0 0 0

116
x xyz
y
z

x xy ' z '
y
xyz + xy ' z '+ x ' yz '+ x ' y ' z
z

x x ' yz '
y
z

x
x' y'z
y
z

Where F =xyz + xy ' z '+ x ' yz '+ x ' y ' z is the sum-of-products expansion.

117
 In (1) to (5), find the output of the given circuit.

1 2
x
x

y
y

3 4

x x

y
y

z y

x
x
y
z 5

x
y
z
x
y

118
6. Construct circuits from inverters, AND gates, and OR gates to produce the following
inputs: ( a ) x '+ y; ( b ) ( x + y ) ' x; (c) xyz + x ' y ' z '; (d) ( x '+ z )( y + z ')  '

7. Design a circuit that implements majority voting for five individuals. A proposal is
passed if it receives at least three yes votes.

8. Design a circuit for a light fixture controlled by four switches where flipping one of
the switches turns the light on when it is off and turns it off when it is on.

119
Unit 5
RELATIONS AND ORDER IN A SET

Introduction

The reader is familiar with many relations which are used in mathematics
and computer science, i.e. ”is a subset of”, ” is less than” and so on. One frequently
wants to compare or contrast various members of a set, perhaps to arrange them in
some appropriate order or to group together those with similar properties. The
mathematical framework to describe this kind of organization of sets is the theory of
relations.

Learning Objectives

After reading this unit you should be able to:

1. Have ordered arrangement of members of set


2. Find minimal and maximal elements

Unit content

Session 1-5: Relations


1-5.1Relations in a set
1-5.2Equivalence Relations
Session 2-5: Ordering of a set
2-5.1Partial Ordering
2-5.2Subsets of Ordered Sets
2-5.3First and Last Elements
2-5.4Maximal and Minimal Elements

120
SESSION 1-5: RELATIONS

1-5.1 Relations in a Set


Definitions

A binary relation (or relation)  from a set of A to a set B assigns to each pair a, b

in A × B exactly one of the following statements:

(i) " a is related to b " , written a b

(ii) " a is not related to b " , written a  b .

A relation from a set A to the same set A is called a relation in A .


Observe that any relation  from a set A to a set B uniquely defines a subset  of

A × B as follows: 

= { a, b : a b}

On the other hand, any subset  ∗ of A × B defines a relation  from A to B as:

b iff a, b ∈ ∗
a

Domain
= {a : a , b ∈ }
of 

Range
= {b : a, b ∈ }
of 

121
1-5.2 Equivalence Relation
Definition

A relation  in a set A , that is, a subset  of A × A is called an equivalence relation if


and only if it satisfies the following axioms:

[ E ] For every a ∈ A, a, a ∈  , reflexive property


1

[ E ] If a, b ∈ 
2
, then b, a ∈ , symmetric property

[ E ] If a, b ∈ 
3
, and b, c ∈ , then a, c ∈ , transition property
∗ ∗

Accordingly, a relation  is an equivalence relation if and only if it is reflexive,


symmetric and transitive.

If  is an equivalence relation in A , then the equivalence class of any element a ∈ A ,


denoted by [ a ] , is the set of elements to which a is related.
= [a] {x : a, x ∈  }

The collection of equivalence classes of A denoted by A /  , is called the quotient of A

by  . =
A/  {[ a ] : a ∈ A}

The quotient set A /  possesses the following properties:

Theorem

Let  be an equivalence relation in A and let [ a ] be the equivalence class of a ∈ A .

Then:

( i ) For every a ∈ A, a ∈ [ a ]
( ii ) [ a ] [b], iff a, b ∈ 
=
( iii ) If [ a ] ≠ [b], then [ a ] and [b] are disjoint

122
A class a of non-empty subsets of A is called a partition of A if and only if

1. each a ∈ A belongs to some member of a and


2. the members of a are pairwise disjoint.
Therefore, the theorem above implies the following fundamental theorem of
equivalence relations.

Theorem

Let  be an equivalence relation in A . Then the quotient set A /  is a partition of A .

Example 5.1

Let  5 be the relation in  , the set of integers, defined by x ≡ y ( mod 5 ) , which reads “

x is congruent to y modulo 5” and which means “ x − y is divisible by 5”. Then  5 is

an equivalence relation in  . There are exactly five distinct equivalence classes in


/ 5:


E0 = {..., −10, −5, 0,5,10,...} = [ 0]


E1= {..., −9, −4,1, 6,11,...} = [1]
E2= {..., −8, −3, 2, 7,12,...}= [ 2]
E3 = {..., −7, −2,3,8,13,...}= [3]
E4 = {..., −6, −1, 4,9,14} = [ 4]

We observe for each integer x, x = 5 p + r where 0 ≤ r < 5 , is a member of the equivalence

class Er , where r is the remainder when x is divided by 5.

Note that the equivalence classes are pairwise disjoint and that
Z = E0 ∪ E1 ∪ E2 ∪ E3 ∪ E4

123
Example 5.2

Consider
= the relation  {=
1, 2 , 1,3 , 2,3 } in A {1, 2,3} . Then

Domain of  = {1, 2} ,
Range of  = {2,3}

Let  −1 denote the relation that reverses the pairs in  . Then  −1 = { 2,1 , 3,1 , 3, 2 } .

We observe that  and  −1 are identical respectively, to the mathematical relations <
iff a < b, and a, b ∈ −1 iff a < b .
and > in the set A . Thus a, b ∈ 

The identity relation in any set A , denoted by ∆ or ∆ A , is the set of pairs in A × A with

equal coordinates, that =


is, ∆ A { a, a : a ∈ A}


1. Prove: let  be a relation in A , that is  ⊂ A × A . Then
(i)  is reflexive if and only if ∆ A ⊂ 

(ii)  is symmetric if and only 


= −1

2. Consider
= the relation  {=
1,1 , 2,3 , 3, 2 } in X {1, 2,3} . Determine whether or not

 is (i) reflexive, (ii) symmetric, (iii) transitive


3. Consider the set  ×  , that is, the set of ordered pairs of positive integers. Let 
be the relation  in  ×  which is defined by a, b  c, d iff ad = bc .

124
Prove that  is an equivalence relation

4. Consider  ×  , the set of ordered pairs of positive integers. Let  be the relation in
 ×  defined by a, b  c, d iff a + b = b + c

(i) Prove  is an equivalence relation


(ii) Find the equivalence class of 2,5 that is  2,5 

125
SESSION 2-5: ORDERING OF A SET

2-5.1 Partial Ordering


A relation  in a set A is called a partial order (or order) if and only if, for every

a, b, c ∈ A such that

(i) a  a , reflexive property

(ii) a  b and b  a implies a = b , anti-symmetric property

(iii) a  b and b  a implies a  c , transitive property

The set A together with the partial order, that is, the pair ( A,  ) is called a partially

ordered set. A partial order is a reflexive, anti-symmetric and transitive relation.

Example 5.3

Set inclusion is a partial order in any class of sets since

( i ) A ⊂ A is true for any set A


( ii ) A ⊂ B and B ⊂ A implies A = B for any sets A, B
( iii ) A ⊂ B and B ⊂ C implies A ⊂ C for any sets , A, B and C

Example 5.4

Let A be any set of real numbers. Then the relation in A defined by x y is a partial

order and is called the natural order in A .

126
Example 5.5

Let X = {a, b, c, d , e} . Then the diagram below defines a partial order in X as follows:

x y iff x = y or if one can go from x to y in the diagram, always moving in the indicated

direction that is upward.

b c

Definition

If ab in an ordered set, we say, a precedes or is smaller than b and that b follows

or dominates or is larger than a . We write a  b if a  b but a ≠ b .

A particular ordered set A is said to be totally (or linearly) ordered if, for every
a, b ∈ A , either a  b or b  a .

The set of real numbers,  , with the natural order defined by x  y is an example of
a totally ordered set.

127
Example 5.6

Let A and B be totally ordered. Then the product set A × B can be totally ordered as
follows: a, b  a ', b ' if a  a ' or a = a′, and b  b ' .

This order is called lexicographical of A × B since it is similar to the way words are
arranged in a dictionary.

REMARKS

If a relation  in a set A defines a partial order, that is, is reflexive, anti-symmetric


and transitive, then the inverse relation  −1 is also a partial order, it is called the
inverse order.

128
2-5.2 Subsets of Ordered Sets
Let A be a subset of a partially ordered set X . Clearly the order in X induces an
order in A in a very natural way. If a, b ∈ A , then ab as elements in A if and only if

ab as elements in X . More precisely, if  is a partial order in X , then the relation


A
= ∩ ( A × A ) , called the restriction of  to A , is a partial order in A . The

ordered set ( A,  )
A
is called partially ordered subset of the ordered set ( X , ).
Some subsets of a partially ordered set X may, in fact, be totally ordered. Clearly, if
X itself is totally ordered, every subset of X will also be ordered.

Example 5.7

Consider the partial order in W = {a, b, c, d , e} defined by the diagram

a b

d e

The sets {a, c, d } and {b, e} are totally ordered subsets, the sets {a, b, c} and {d , e} are

not totally ordered subsets.

129
2-5.3 First and Last Elements
Let X be an ordered set. An element a0 ∈ X is a first or smallest element of X if and

only if a0  x for all x ∈ X . Similarly, an element b0 ∈ X is a last or largest element of

X if and only if x  b0 for all x ∈ X .

Example 5.8

Let X = {a, b, c, d , e} be ordered by the diagram,

b c

Then a is a last element of X since a follows every element. We note that X has no
first element, since d is not a first element because d does not proceed e .

Example 5.9

The positive integers  with the natural order have 1 as a first element; there is no last
element. Similarly, the set of integers  with the natural order has no first element and
no last element.

130
2-5.4 Maximal and Minimal Elements
Let X be an ordered set. An element a0 ∈ X is maximal if and only if a0  x implies

x = a0 , that is, if no element follows a0 except itself. Similarly, an element b0 ∈ X is


minimal if and only if x b0 implies x = b0 , that is, if no element precedes b0 except

itself.

Example 5.9

Let X = {a, b, c, d , e} be ordered by the diagram of Example 5.7. Then both

d and e are minimal elements. The element a is a maximal element.

Example 5.10

Although  with the natural order is totally ordered it has no minimal and no maximal
elements.

Example 5.11

Let A = {a1 , a2 ,..., am } be a finite totally ordered set. Then A contains precisely one

minimal element and precisely one maximal element, denoted respectively by

min {a1 ,..., am } and max {a1 ,..., am }

131
2-5.5 Upper and Lower Bounds
Let A be a subset of a partially ordered set X . An element m ∈ X is a lower bound of
A if and only if m  x for all x ∈ A , that is, if m precedes every element in A . If
some lower bound of A follows every other lower bound of A , then it is called the
greatest lower bound (G.L.B) or infimum of A and is denoted by inf ( A ) . Similarly, an

element µ ∈ X is an upper bound of A if and only if x  µ for all x ∈ A , that is, if µ


follows every element in A . If some upper bound of A precedes every other upper
bound of A , then it is called the least upper bound (L.U.B) or supremum of A and is
denoted by sup ( A ) .

A is said to be bounded above if it has an upper bound, and bounded below if it has a
lower bound. If A has both an upper and lower bounds, then it is said to be bounded.

Example 5.12

Let X = {a, b, c, d , e, f , g } be ordered as shown in the following diagram:

a b

c
B

d e

g
f

132
Let B = {c, d , e} . Then a, b and c are upper bound of B , and f is the only lower

bound of B . We note that g is not a lower bound of B since g does not precede d .

Furthermore, c = sup ( B ) belongs to B , while f = inf ( B ) does not belong to B .

Example 5.13

Let A be a bounded set of real numbers. Then, a fundamental theorem about real
numbers states that, under the natural order, inf ( A ) and sup ( A ) exist.

Example 5.14

Let  be the set of rational numbers. Let B= {x : x ∈  , x > 0, 2 < x 2


}
< 3 . Then B has an

infinite number of upper and lower bounds, but inf ( B ) and sup ( B ) do not exist,

because the real numbers 2 and 3 do not belong to  and therefore cannot be
considered as upper and lower bounds of B .

 EXERCISE

1. Let  , the positive integers, be ordered as follows: each pair of elements


a, a ' ∈  can be written uniquely in the form a = 2r ( 2 s + 1) , a ' = a r ' ( as '+ 1)

Where r , r ', s, s ' ∈ {0,1, 2,3,...} . Let a  a ' if r < r or if ' r =r ' but s < s ' .

133
Insert the correct symbol,  or 
, between each of the following pairs of
numbers. (Note:
 x y iff y  x ).

(i) 5……14 (ii) 6…………9

(iii) 3……..20 (iv) 14………21

2. Let A = {a, b, c} be ordered as in the diagram below. Let Α be the collection of

all non-empty totally ordered subsets of A , and let Α be partially ordered by set
inclusion. Construct a diagram of the order of Α .

b c

3.=
Let A {=
2,3, 4,...}  \ {1} and let A be ordered by " x divides y " .

(i) Determine the minimal elements of A


(ii) Determine the maximal elements of A .

4. Let B = {2,3, 4,5, 6,8,9,10} be ordered by " x is a multiply of y " .

(i) Find all maximal elements of B


(ii) Find all minimal elements of B .

5. Let W = {1, 2,..., 7,8} be ordered as follows:

134
1 2

4 5

6 7

Consider V = {4,5, 6} , a subset of W

(i) Find the set of upper bounds of V


(ii) Find the set of lower bounds of V
(iii) Does sup (V ) exist?

(iv) Does inf (V ) exist?

6. Let =
A ( , ≤) , the positive integers with the natural order; and let =
B ( , ≥) ,
the positive integer with the inverse order. Furthermore, let A × B denote the
lexicographical ordering of  ×  according to the order of A and then B . Insert
the correct symbol, < or >, between each pair of elements of  ×  .
( i ) 3,8 .......... 1,1 ( ii ) 2,1 .............. 2,8
( iii ) 3,3 .......... 3,1 ( iv ) 4,9 ............. 7,15

7. Let X = {1, 2,3, 4,5, 6} be ordered as in the diagram below. Consider the subset

A = {2,3, 4} of X .

135
1

3 4

5 6

(i) Find the maximal elements of X


(ii) Find the minimal elements of X
(iii) Does X have a first element?
(iv) Does X have a last element?
(v) Find the set of upper bounds of A
(vi) Find the set of lower bounds
(vii) Does sup (A) exist?
(viii) Does inf (A) exist?

8. Consider  , the set of rational numbers, with the natural order, and its subset

{
A = x : x ∈  , x3 < 3}
(i) Is A bounded above?
(ii) Is A bounded below?
(iii) Does sup ( A ) exist?

(iv) Does inf ( A ) exist?

9. Let  , the positive integers, be ordered by " x divides y " and let A ⊂ 

(i) Does inf ( A ) exist?

136
(ii) Does sup ( A ) exists?

ZORN’S LEMMA

Zorn’s lemma: Let X be a non-empty partially ordered set in which every totally
ordered subset has an upper bound, then X contains at least one maximal element.

[based on respective learning points in learning objective add interactive subject matter;
with examples, exercises with answers, insert captioned illustrations, diagrams, tables,
figures, etc.]

137
Unit 6
ELEMENTS OF GRAPH THEORY

Introduction

In this unit we present the basic concepts related to graphs and trees such as the
degree of a vertex, connectedness, Euler and Hamiltonians circuits.

Learning Objectives

After reading this unit you should be able to:

1. Graphs are binary – relations on their vertex


set(except for multigraphs)
2. Different purposes require different types of graphs

Unit content

Session 1-6: Basics of Graphs


1-6.1Definitions
1-6.2Complete Graph
1-6.3Degree
Session 2-6: Paths and Circuits
2-6.1Paths
2-6.2Connectivity
2-6.3Euler Path and Circuit
2-6.4Hamiltonian Path and Circuit

138
SESSION 1-6: BASICS OF GRAPHS

1-6.1 Definitions
An undirected graph G consists of a set VG of vertices, points, or nodes

and a set EG of edges such that each edge e ∈ EG is associated with an

unordered pair of vertices, called its endpoints.

A directed graph or digraph G consists of a set VG of vertices, points or

nodes and a set EG of ordered pairs of vertices called arcs or directed edges

or, simply, edges .

We denote a graph by G = (VG , EG ) .

Two vertices are said to be adjacent if there is an edge connecting the two
vertices. Two edges associated to the same vertices are called parallel. An edge
incident to a single vertex is called a loop. A vertex that is not incident on any
edge is called an isolated vertex. A graph with neither loops nor parallel edges
is called simple graph.

Example 6.1

Describe formally the graph shown in fig. 6-1.

A e1 B

e4 e2
e5

C e3 D
Figure 6-1 shows the graph G = G (V , E ) where: (i) V consists of the vertices A ,
B , C , D ; and (ii) E consists of the five edges e1 = { A, B} , e2 = { B, C} ,
e3 = {C , D} , e4 = { A, C} , e5 = { B, D} .

139
Example 6.2

Consider the following graph G

e3 v3

v2 e4
e2 v
v6 •5
e1 v4
e6
v1 e5
v7

a. Find EG and VG .

b. List the isolated vertices.

c. List the loops.

d. List the parallel edges.

e. List the vertices adjacent to v3 ..

f. Find all edges incident on v4 .

Solution.

a. EG = {e1 , e2 , e3 , e4 , e5 , e6 } and VG = {v1 , v2 , v3 , v4 , v5 , v6 , v7 } .

b. There is only one isolated vertex, v5 .

c. There is only one loop, e5 .

d. {e2 , e3 } .

e. {v2 , v4 } .

f. {e1 , e4 , e5 }

140
Example 6.3

Which one of the following graphs is simple.

Solution.

a. G is not simple since it has a loop and parallel edges.

b. G is simple.

141
1-6.2 Complete Graph
A complete graph on n vertices, denoted by K n , is the simple graph that

contains exactly one edge between each pair of distinct vertices.

Example 6.4

Draw K 2 , K 3 , K 4 , and K 5 .

Solution.

K2 K3

K4 K5

A graph in which the vertices can be partitioned into two disjoint sets V1 and V2

with every edge incident on one vertex in V1 and one vertex of V2 is called

bipartite graph.

142
Example 6.5

a. Show that the graph G is bipartite.


v1
u1

v2

u2
v3
b. Show that K 3 is not bipartite.

Solution:

a. Clear from the definition and the graph.

b. Any two sets of vertices of K 3 will have opposite parity. Thus, according

to the definition of bipartite graph, K 3 is not bipartite.

A complete bipartite graph K m ,n , is the graph that has its vertex set

partitioned into two disjoint subsets of m and n vertices, respectively. More –


over, there is an edge between two vertices if and only if one vertex is in the
first set and the other vertex is in the second set.

143
Example 6.6

Draw K 2,3 , K 3,3 .

Solution: v1 u1 v1
u1
v2 u2 v2
u2
v3 u3 v3
K 2,3
K 3,3

144
1-6.3 Degree
The degree of a vertex v in an undirected graph, in symbol deg ( v ) , is the

number of edges incident on it. By definition, a loop at a vertex contributes

twice to the degree of that vertex. The total degree of G is the sum of the

degrees of all the vertices of G .

Example 6.7

What are the degrees of the vertices in the following graph

v2
v1•
e1 e2

v3

e3

Solution:

= =
deg(v1 ) 0,deg( =
v2 ) 2,deg( v3 ) 4 .

145
Theorem 6.1

For any graph G = (VG , EG ) we have

2 | EG | = ∑ deg ( v )
v∈V ( G )

[The sum of the degrees of the vertices of a graph is equal to twice the number
of edges]

Proof:

Suppose that VG = {v1 , v2 ,..., vn } and | EG | = m . Let e ∈ EG . If e is a loop then

it contributes 2 to the total degree of G . If e is not a loop then let vi and v j

denote the endpoints of e . Then e contributes 1 to deg ( vi ) and contributes 1 to

the deg(v j ) .Therefore, e contributes 2 to the total degree of G . Since e was

arbitrarily, this shows that each edge of G contributes 2 to the total degree of
G . Thus,

2| EG | = ∑
v∈V ( G )
deg(v)

The following is easily deduced from the previous theorem.

146
Theorem 6.2

In any graph there are an even number of vertices of odd degree.

Proof.

Let G = (VG , EG ) be a graph. By the previous theorem, the sum of all the

degrees of the vertices is T = 2 | EG |, an even number. Let E be the sum of

the numbers deg(v) , each which is even and O the sum of numbers deg(v)

each which is odd. Then T= E + O . That is, O= T − E . Since both T and E


are even then T is also even. This implies that there must be an even number of
the odd degrees. Hence, there must be an even number of vertices with odd
degree.

Example 6.8

Find a formula for the number of edges in K n .

Solution:

Since G is complete, each vertex is adjacent to the remaining vertices. Thus,


the degree of each of the n vertices is n − 1 , and we have the sum of the

degrees of all of the vertices being n ( n − 1) .

By Theorem 6.1 n ( n − 1) =
2 | EG |.

This completes a proof of the theorem.

147
SESSION 2-6: PATHS AND CIRCUITS

2-6.1 Paths
In an undirected graph G a sequence P of the form v0e1e2 ...vn −1en vn is called a

path of length n or a path connecting v0 to vn . If P is a path such that

v0 = vn then it is called a circuit or a cycle. A path or circuit is simple if it does


not contain the same edge more than once. A graph that does not contain any
circuit is called acyclic.

Example 6.9

In the graph below, determine whether the following sequences are paths,
simple paths, circuits, or simple circuits.

v1 e2 v5
e4
e1 v2
e3 e5
v0 e10
e9 e7

v3 e8 v4

e6

a. v0e1v1e10v5e9v2e2v1 .

b. v3e5v4e8v5e10v1e3v2 .

c. v1e2v2e3v1 .

d. v5e9v2e4v3e5v4e6v4e8v5 .

148
Solution:

a. a path (no repeated edge), not a simple path (repeated vertex v1 ), not a

circuit

b. a simple path

c. a simple circuit

d. a circuit, not a simple circuit (vertex v4 is repeated)

149
2-6.2 Connectivity
An undirected graph is called connected if there is a path between every pair of
distinct vertices of the graph. A graph that is not connected is said to be
disconnected.

Example 6.10

Determine which graph is connected and which one is disconnected.

v4 v2 v5 v6

v2 •v3 v5 •v
4

v1 v•6 v1 v3
v8 v7
a b
Solution:

a. Connected.

b. Disconnected since there is no path connecting the vertices v1 and v4 .

150
2-6.3 Euler Path and Circuit
A simple path that contains all edges of a graph G is called an Euler path.

If this path is also a circuit, it is called an Euler circuit.

Theorem 6.3

If a graph G has an Euler circuit then every vertex of the graph has even
degree.

Proof:

Let G be a graph with an Euler circuit. Start at some vertex on the circuit and
follow the circuit from vertex to vertex, erasing each edge as you go along it.
When you go through a vertex you erase one edge going in and one edge going
out, or else you erase a loop. Either way, the erasure reduces the degree of the
vertex by 2 . Eventually every edge gets erased and all the vertices have degree
0 . So all vertices must have had even degree to begin with.

It follows from the above theorem that if a graph has a vertex with odd

degree then the graph cannot have an Euler circuit.

The following provide a converse to the above theorem.

Theorem 6.4 (Euler Theorem)

If all the vertices of a connected graph have even degree, then the graph has an
Euler circuit.

151
Example 6.11

Show that the following graph has no Euler circuit.

v2 e1 v3
e4 e e5 e2
6
e7
v1 v4
e3

Solution:

Vertices v1 and v3 both have degree 3 , which is odd. Hence, by the remark

following the previous theorem, this graph does not have an Euler circuit.

152
2-6.4 Hamiltonian Path and Circuit
A path is called a Hamiltonian path if it visits every vertex of the graph exactly
once. A circuit that visits every vertex exactly once except for the last vertex
which duplicates the first one is called a Hamiltonian circuit.

Example 6.12

Find a Hamiltonian circuit in the graph


v

w z

x y
Solution:

vwxyzv .

153
Example 6.13

Show that the following graph has a Hamiltonian path but no Hamiltonian

circuit.

y z

Solution:

vwxyz is a Hamiltonian path. There is no Hamiltonian circuit since no cycle goes


through v .

154
MY PAGE
Name: _______________________________________ Learning Centre: _________________

Contact: Tel. ____________ Email: ________________ Emergency Name/Phone: __________

Important numbers: Student number ______________ Examination number ________________

Program: ___________ Year: _______ Course code/title: _______________________________

Course objectives: ______________________________________________________________

_____________________________________________________________________________

Course dates/Semester No ( ): Starts_____________________ Ends ____________________

FFFS schedule/Dates: ___________________________________________________________

Quiz dates: ____________________________________________________________________

Assignments hand in dates: _______________________________________________________

Revision dates: _________________________________________________________________

Group discussion/work members (names and contacts): _________________________________

______________________________________________________________________________

______________________________________________________________________________

End of course Self Evaluation:


I have completed all Units & interactive sessions, mastered all learning objectives, completed
all self Assessments, unit summary, key words and terms, discussion questions, review
questions, reading activity, web activity, unit assignments, and submitted all CA scoring
assignments, learner feedback on this course and submitted my comments and course focus
contributory questions to facilitator for discussion.

Self-grading: self assessment questions score ______ % Unit Assignments scored ______ %

My course conclusion remarks: ____________________________________________________

______________________________________________________________________________

______________________________________________________________________________

____________________________________________________ (may continue on reverse side)

155
= = = = = = = = = = = = = = = = = = = = = = = = = detach and return to IDL, KNUST = = = = = = = = = = = = = = = = = = = = Learner Feedback Form/[insert course code]
Dear Learner,
While studying the units in the course, you may have found certain portions of the text
difficult to comprehend. We wish to know your difficulties and suggestions, in order
to improve the course. Therefore, we request you to fill out and send the following
questionnaire, which pertains to this course. If you find the space provided
insufficient, kindly use a separate sheet.

1. How many hours did you need for studying the units
Unit no. 1 2 3 4 5 6
No. of hours

2. Please give your reactions to the following items based on your reading of the
course
Items Excellent Very Good Poor Give specific examples, if
good poor
Presentation    
quality
Language and    
style
Illustrations    
used
(diagrams,
tables, etc.)
Conceptual    
clarity
Self assessment    
Feedback to SA    

3. Any other comments (may continue on reverse side)

Unit 1: _______________________________________________________________

Unit 2: _______________________________________________________________

Unit 3: _______________________________________________________________

Unit 4: _______________________________________________________________

Unit 5: _______________________________________________________________

Unit 6: _______________________________________________________________

156

You might also like