integer denote

advertisement
.
+
DISCRETE MATHEMATICS AND ITS APPLICATIONS
FOR COMPUTER SCIENCE
110
100
111
101
010
111
011
001
DR. AWATIF MOHAMMED ALI ELSIDDIEG
SALMAN BIN ABDULAZIZ UNIVERSITY
FACULTY OF SCIENCE AND HUMANITY STUDIES
HOTAT BANI TAMIM
2015
1
Dedecated to:
my family , my
mother and friends
2
List of symbols
symbol
meaning
¬p
Negation of p
pห„ q
Conjunction of p and q
Pห…q
Disjunction of p and q
p⊕๐’’
Exclusive of p and q
p→ q
The implication of p and q
p↔ q
Biconditional of p and q
P≡q
Equivalence of p and q
T
Tautology
F
Contradiction
P(๐’™๐Ÿ , ๐’™๐Ÿ , ๐’™๐Ÿ‘ , … , ๐’™๐’ )
Propositional function
∀๐’™ p(๐’™)
Universal quantification of ๐’‘(๐’™)
∃๐’™ ๐’‘(๐’™)
Existential quantification of ๐’‘(๐’™)
๐’™∈๐‘บ
๐’™ is a member of ๐‘บ
๐’™∉๐‘บ
๐’™ is not a member of ๐‘บ
โ„•
Set of natural numbers
โ„ค
Set of integers
3
โ„ค+
Set of positive integers
โ„š
Set of rational numbers
๐“ก
Set of real numbers
S=T
Set equality
∅
The empty set (or null set)
|S|
Cardinality of S
P(S)
The power set of S
(a,b)
Ordered pair
๐‘บ⊆๐‘ป
S is a subset of T
๐‘บ⊂๐‘ป
S is a proper subset of T
๐‘จ×๐‘ฉ
Cartisian product of A and B
๐‘จ∪๐‘ฉ
Union of A and B
๐‘จ−๐‘ฉ
The difference of A and b
ฬ…
๐‘จ
Complement of A
๐’‚ ≡ ๐’ƒ(๐’Ž๐’๐’… ๐’Ž)
๐’‚ is congruent to ๐’ƒ ๐’Ž๐’๐’…๐’–๐’๐’– ๐’Ž
a| b
๐’‚ divides ๐’ƒ
๐’‚โˆค๐’ƒ
๐’‚ ๐’๐’๐’• ๐’…๐’Š๐’—๐’Š๐’…๐’†๐’” ๐’ƒ
๐’‚ div b
Quotient when ๐’‚ ๐’Š๐’” ๐’…๐’Š๐’—๐’Š๐’”๐’‚๐’ƒ๐’๐’† ๐’ƒ๐’š๐’ƒ
๐’‡(๐’‚)
Value of the function ๐’‡ at ๐’‚
4
๐’‡: ๐‘จ→ B
Function of A and B
๐’‡๐Ÿ + ๐’‡๐Ÿ
Sum of the functions ๐’‡๐Ÿ ๐’‚๐’๐’… ๐’‡๐Ÿ
๐’‡๐Ÿ . ๐’‡๐Ÿ
Product of the functions ๐’‡๐Ÿ ๐’‚๐’๐’…๐’‡๐Ÿ
๐’‡°๐’ˆ
Composite of ๐’‡ and ๐’ˆ
gcd(a,b)
Greatest common divisor of a and b
Lcm(a,b)
Least common multiple of a and b
(๐’‚๐’Œ ๐’‚๐’Œ−๐Ÿ … ๐’‚๐Ÿ ๐’‚๐ŸŽ )๐’ƒ
Base b representation
๐‘จ∨๐‘ฉ
Join of A and B
๐‘จห„ b
The meet of A and B
๐‘จโŠ™๐‘ฉ
Boolean product of A and B
๐’!
๐’ factorial
C(a,b)
Combination of a and b
P(a,b)
Permutation of a and b
๐Ÿ๐ŸŽ
The sum of i from 0 to 10
∑๐’Š
๐’Š=๐ŸŽ
5
Contents
Introduction:
12
Chapter 1 (Logic and Proofs)
1.1 Logic:
13
13
1.1.1 Propositions :
13
1.1 2 Converse ,Contraposition and Inverse:
16
1.1.3 Biconditionals:
16
1.1.4 Logic and Bit Operations :
17
Exercises:
19
1.1.5 Logical Equivalence:
20
1.2 Introduction to Proofs :
21
1.2.1 Direct Proofs :
21
1.2.2 Indirect Proofs:
22
1.2.3 Proofs by Contradiction:
23
Exercises:
24
1.2.4 Mathematical Induction:
25
Exercises:
28
Chapter 2
29
Basic Structures( sets ,Relations and functions)
2.1 1 Sets:
29
2.1.2 The Power Set:
32
6
2.1.3 Cartesian Products:
33
2.1.4 Sets Operations:
34
2.1.5 Sets Identities:
37
2.1.6 Computer Representation of Sets:
40
Exercises:
41
2.2.
Relations:
42
2.2.1 Relations and their properties:
42
2.2.2 Relations on a set:
43
2 .2. 3 Properties of relations:
44
2.2.4 Combining relations:
47
Exercises:
49
2.2.5 Representing relations using matrices:
50
2.2.6 The matrix for the composite relations:
53
2.2.7 Representing Relations Using Diagraphs:
54
Exercises:
57
2.2.8 Equivalence relations:
58
2.2.9 Equivalence classes:
60
Exercices:
64
2.2.10 Partial ordering:
65
2.2.11 Hasse diagrams:
66
2.2.12 Maximal and minimal elements:
68
7
2.2.13 The greater element and the least element:
68
2.2.14 Lattices:
72
Exercises:
73
2.3 Functions :
74
2.3.1 One-to-one and Onto functions :
77
2.3.2 Inverse functions and compositions of functions :
80
2.3.3 Some important functions:
82
Exercises:
83
Chapter 3
85
Algorithms ,Integers and Matrices
3.1 Algorithms:
85
3.2 Number theory:
87
3.2.1 The integers and division:
87
3.2.2 The division algorithm:
88
3.3 Modular Arithmetic:
89
3.4 Primes and greater common divisor primes:
90
3.5 The Greatest common divisor and the least common multiple:
91
Exercises:
93
3.6 Integers and algorithms:
94
3.6.1 Representation of integers:
94
3.6.2 Base conversion:
95
8
3.6.3 Algorithms for integers operations:
98
3.6.4 The Euclidean algorithm:
101
Exercises:
102
Chapter 4 (Boolean Algebra)
4.1.1 Boolean Functions:
105
105
4.1.2 Boolean Expressions and Boolean Functions:
106
4.1.3 Identities of Boolean algebra:
109
4.2 Duality :
110
4.3 The abstract definition of a Boolean algebra:
111
4.4 Representing Boolean Functions:
111
4.5 Logic Gates:
113
4.6 Combinations of Gates:
115
4.7 Minimization of Circuits:
115
4.8 Karnaugh Maps:
115
Exercises:
117
Chapter 5
119
An Introduction to Graph Theory
5.1 Basic Terminology:
120
5.2 Some special simple graphs:
122
5.3 Bipartite graphs:
124
5.4 Representing Graphs and Graph Isomorphism:
9
125
5.5 Adjency Matrices:
127
5.6 Incidence Matrices:
128
5.7 Isomorphism of Graphs:
129
Exercises:
131
5.8.1 Paths:
132
5.8.2 Connectedness in undirected graphs:
133
5.8.3 Connectedness in directed graphs:
135
5.8.4 Counting path between vertices:
136
5.9.1 Euler and Hamilton Paths:
138
5.9.2 Hamilton Paths and Circuits:
139
5.10 Planar Graphs:
141
Exercises:
144
Chapter 6 (Counting)
145
6.1 Basic Counting Principles:
145
6.2 The sum rule:
145
Exercises:
146
6.3 The Pigeonhole Principle:
147
6.4 Sequences and Summations:
148
6.4.1 Sequences:
148
6.4.2 Summations:
150
Exercises:
152
10
6. 5 Discrete Probability:
154
6.5.1 Random variables and sample Spaces :
154
Exercises:
157
6.6 Permutations and Combinations:
158
6.6.1 Permutations:
158
6.6.2 Combinations:
159
6.6 .3 The Binomial Theorem:
160
6.6 .7 Pascal’s triangle:
165
6.8. 1 Recurrence relations:
165
6.8. 2 Inhomogenious Requrrence Relations :
170
6.8.3 Another method of solving inhomogenous recurrence relations:
172
6.8.4 A formula for Fibonaci numbers :
174
Exercises:
175
References:
177
11
Discrete Mathematics
Introduction
What is discrete mathematics?
Discrete mathematics is the part of mathematics denoted to the
study of discrete objects.
Why We Study Discrete Mathematics?
There are several important reasons for studying discrete
mathematics. First, through this course you can develop your
mathematical maturity:
that is, your ability to understand and
create mathematical arguments. You will not get very far in your
studies in the mathematical sciences without these skills.
Second, discrete mathematics is the gate-way to more advanced
courses in all parts of the mathematical sciences.
Discrete
mathematics provides the mathematical foundations for many
computer science courses including data structures, algorithms,
database theory, automata theory, formal languages, compiler
theory, computer security and operating systems students find these
courses much more difficult when they have not had the appropriate
mathematical foundations from discrete mathematics.
12
Chapter 1
Logic and Proofs
1.1 Logic:
1.1.1 Propositions:
Def. (1):
A proposition is a declarative sentence (declares a fact) that is
either true or false, but not both.
Example (1): All
the following declarative sentences are
propositions
1. Khartoum is the capital of Sudan.
2. 1 + 1 = 2
3. 2 + 2 = 3
Propositions 1 and 2 are true but 3 is false.
Example (2): Consider the following sentences:
1. What time it is?
2.
Read this carefully.
3.
x+1= 2
4.
x+y = z
Sentences 1 and 2 are not propositions because they are not
declarative sentences. Sentences 3 and 4 are not propositions because
they are neither true nor false.
Def. (2) : Let p be a proposition. The negation of p denoted by
๏€จ ๏€ฉ is the statement "It is not the case that
๏ƒ˜p p
๏ƒ˜ p is
p ".
read "not p " the truth value of negation of p , ๏ƒ˜ p is the
opposite of the truth value of .
Example (3): Find the negation of the proposition:
Today is Friday
13
Solution: Today is not Friday.
Example (4): Find the negation of the proposition:
"At least 10 inches of rain fell today in Makka"
Solution: "Less than 10 inches of rain fell today in Makka".
Logic Connectives and Truth Tables of Compound Propositions:
Def. (3) : Let p and q be propositions.
The conjunction of p and q denoted by ๏€จ p ๏ƒ™ q ๏€ฉ is the proposition
"p and q".
The conjunction p ๏ƒ™ q is true when both p and q are true and
false otherwise.
The truth table for the conjunction of two propositions:
p
q
p๏ƒ™q
T
T
T
T
F
F
F
T
F
F
F
F
Def. (4): let p and q be propositions. The disjunction of p and q
denoted by p ๏ƒš q , is the proposition "p or q". The disjunction p ๏ƒš q
is false when both p and q are false and is true otherwise.
The table for the disjunction of two propositions:
p
q
p๏ƒšq
T
T
T
T
F
T
F
T
T
F
F
F
14
Def. (5): Let p and q be propositions. The exclusive OR of p and
q denoted by
p๏ƒ…q,
is the proposition that is true when exactly one
of p and q is true and false otherwise.
The truth table for the exclusive or of two propositions:
Def. (6):
p
q
p๏ƒ…q
T
T
F
T
F
T
F
T
T
F
F
F
Let p and q be propositions.
The conditional
statement p ๏‚ฎ q is the proposition "if p, then q", the conditional
statement p ๏‚ฎ q
otherwise.
is false when p is true and q is false, and true
In the conditional statement
p๏‚ฎq,
p is called the
hypothesis and q is called the conclusion.
The truth value for the condition statement:
p
q
p๏‚ฎq
T
T
T
T
F
F
F
T
T
F
F
T
The following ways express the conditional statement:
"if p then q
"p implies q"
"if p, q
"p only if q"
'p is sufficient for q"
"a sufficient condition for q is p"
"q if p"
"q whenever p"
"q when p"
"q is necessary for p"
"a necessary condition for p is q"
"q unless ๏ƒ˜ p"
"q follows from p"
15
Example (7): Let p be the statement "Maha learns discrete
mathematics" and q the statement Maha will find a good job"
express the statements p ๏‚ฎ q as a statement.
Solution:
If "Maha learns discrete mathematics then she will find a good
job" or "Maha will find a good job when she learns discrete
mathematics" or "for Maha to get a good job, it is sufficient for her
to learn discrete mathematics".
1.1.2 Converse, Contrapositive, and Inverse
The proposition q ๏‚ฎ p is called the converse of p ๏‚ฎ q , the
contrapositive of p ๏‚ฎ q is the proposition ๏ƒ˜ q ๏‚ฎ ๏ƒ˜ p . The proposition
๏ƒ˜ p ๏‚ฎ ๏ƒ˜ q is
called the inverse of p ๏‚ฎ q .
Example (8):
What are the contrapositive, the converse, and the inverse of the
conditional statement "The home team wins whenever it is raining".
Solution:
Because " p whenever q" is one of the ways to express the
conditional statement p ๏‚ฎ q , the original statement can be written as
"If it is raining, then the home team wins".
The contrapositive of the conditional statement is: "If the home
team does not win, then it is not raining".
The converse is : "If the home team wins, then it is raining"
The inverse is : "If it is not raining, then the home team does not
win".
1.1.3 Biconditionals:
Def. (7):
statement
Let p and q be propositions.
p ๏‚ซ q is
The biconditional
the proposition "p if and only if q".
the
biconditional statement p ๏‚ซ q is true when p and q have the same
16
truth values, and it is false otherwise biconditional statements are
called bi-implications.
The truth table for the biconditional p ๏‚ซ q
p
q
p๏‚ซq
T
T
T
T
F
F
F
T
F
F
F
T
Some other common ways to express p ๏‚ซ q
"p is necessary and sufficient for q"
"If p then q, and conversely"
"p iff q"
So p ๏‚ซ q ๏‚บ ๏€จ p ๏‚ฎ q๏€ฉ ๏ƒ™ ๏€จq ๏‚ฎ q๏€ฉ
Example (10):
Construct the truth table of the compound proposition
๏€จp ๏ƒš ๏ƒ˜
q๏€ฉ ๏‚ฎ
๏€จ p ๏ƒ™ q๏€ฉ
Solution:
p๏ƒš
๏ƒ˜q
p๏ƒ™q
๏€จp ๏ƒš
๏ƒ˜ q๏€ฉ ๏‚ฎ ๏€จ p ๏ƒ™ q๏€ฉ
P
q
๏ƒ˜q
T
T
F
T
T
T
T
F
T
T
F
F
F
T
F
F
F
T
F
F
T
T
F
F
1.1.4 Logic and Bit Operations:
Def. (8):
A bit is a symbol with two values zero and one, a bit string is a
sequence of zero or more bits. The length of this string is the
number of bits in the strings.
17
Example (11):
1 0101 0011 is a bit string of length nine.
The table for the Bit operators OR,AND and XOR:
x๏ƒ™ y
x๏ƒ… y
0
0
0
1
1
0
1
1
0
1
0
1
1
1
1
1
0
x
y
0
0
0
x๏ƒš
y
Truth value
Bit
T
1
F
0
Example (12):
Find the bitwise OR, bit wise AND and bitwise XOR of the bit
strings 01 1011 0110 and 11 0001 1101
Solution:
01 1011 0110
11 0001 1101
11 1011 1111
bit wise OR
01 0001 0100
bit wise AND
10 1010 1011
bitwise XOR
18
Exercises:
1) Which of these sentences are propositions? What are the
truth values of those that are propositions?
(a) London is the capital of America
(b) 2 + 3 = 5
(c) x + 2 = 11
(d) 5 + 7 = 10
(e) Answer this question?
2) What is the negation of each of these propositions
(a) Today is Thursday
(b) 2 + 1 = 3
(c) The summer in Khartoum is hot and sunny.
3) Construct a truth table for each of these compound
propositions:
(a) p ๏‚ฎ ๏ƒ˜ q
๏ƒ˜ p๏‚ซq
(b)
(c)
๏€จ p ๏‚ฎ q๏€ฉ ๏ƒš ๏€จ๏ƒ˜ p ๏‚ฎ p๏€ฉ
(d) ๏€จ p ๏‚ซ q๏€ฉ ๏ƒš ๏€จ๏ƒ˜ p ๏‚ซ q๏€ฉ (e) ๏€จ๏ƒ˜ p ๏‚ซ ๏ƒ˜ q๏€ฉ ๏‚ซ ๏€จ p ๏‚ซ q๏€ฉ
4) Construct a truth table for each of these compound
propositions:
(a) p ๏‚ฎ ๏€จ๏ƒ˜ q ๏ƒš r ๏€ฉ
(b) ๏ƒ˜ p ๏‚ฎ ๏€จq ๏‚ฎ r ๏€ฉ
(c) ๏€จ p ๏‚ฎ q๏€ฉ ๏ƒš ๏€จ๏ƒ˜ p ๏‚ฎ r ๏€ฉ
(d) ๏€จ p ๏‚ซ q๏€ฉ ๏ƒš ๏€จ๏ƒ˜ p ๏‚ซ r ๏€ฉ
5) Find the bitwise OR, bitwise AND and bitwise XOR of each
of these pairs of bit strings:
(a) 101 1110 , 010 001
(b) 111 0000 , 1010 1010
(c) 00 0111 0001 , 10 0100 1000
(d) 11 1111 1111 , 00 0000 0000
6) Evaluate each of these expressions
(a) 1 1000ห„ (1 1011 ๏ƒš 1 1011)
19
(b) (0 1111 ๏ƒ™ 1 010) ๏ƒš 0 1000
(c) (0 1010 ๏ƒ… 11011) ๏ƒ… 0 1000
Def.(9):
A Compound proposition that always true is called a tautology,
a compound proposition that is always false is called a contradiction
and a compound proposition that neither a tautology nor a
contradiction is called a contingency.
Examples of a tautology and a contradiction
p
๏ƒ˜p
p ห… ๏ƒ˜p
p ห„ ๏ƒ˜p
T
F
T
F
F
T
T
F
1.1.5 Logical Equivalence:
Def.(10):
The compound propositions p and q are called logically
equivalent if p ๏‚ซ q is a tautology. The notation p ๏‚บ q denotes that p
and q are logically equivalent.
Example (13):
Show that ๏ƒ˜ ๏€จ p ๏ƒš q ๏€ฉ and ๏ƒ˜ p ๏ƒ™ ๏ƒ˜ q are logically equivalent
Solution:
p
q
p๏ƒšq
๏ƒ˜ ๏€จ p ๏ƒš q๏€ฉ
๏ƒ˜p
๏ƒ˜q
๏ƒ˜ p๏ƒ™๏ƒ˜q
๏ƒ˜ ๏€จ p ๏ƒš q ๏€ฉ ↔( ๏ƒ˜ p ๏ƒ™ ๏ƒ˜ q )
T
T
T
F
F
F
F
T
T
F
T
F
F
T
F
T
F
T
T
F
T
F
F
T
F
F
F
T
T
T
T
T
Example (14):
Show that p ๏‚ฎ q is logically equivalent to
20
๏ƒ˜ p๏ƒšq
Solution:
P
q
๏ƒ˜p
๏ƒ˜ p๏ƒšq
p๏‚ฎq
T
T
F
T
T
T
T
F
F
F
F
T
F
T
T
T
T
T
F
F
T
T
T
T
(๏ƒ˜
p ๏ƒš q)
↔( p ๏‚ฎ q )
Example (15):
Show that ๏€จ p ๏ƒ™ q๏€ฉ ๏‚ฎ ๏€จ p ๏ƒš q๏€ฉ is a tautology
P
q
p๏ƒ™q
p๏ƒšq
๏€จ p ๏ƒ™ q๏€ฉ ๏‚ฎ ๏€จ p ๏ƒš q๏€ฉ
T
T
T
T
T
T
F
F
T
T
F
T
F
T
T
F
F
F
F
T
1.2 Introduction to Proofs:
Introduction :
In this section we introduce the notation of a proof and describe
methods for constructing proofs. A proof is a valid argument that
establishes the truth of a mathematical statement.
1.2.1The Direct Proofs:
Def(11).:
A direct proof of a conditional statement p ๏‚ฎ q is
constructed when the first step is the assumption that p is true;
subsequent steps are constructed using rules of inference with the
final step showing that q must also be true.
Def(12).: The integer n is even if there exists an integer k such
that: n = 2k , and n is odd if there exists an integer k such that
n = 2k + 1.
21
Example (16):
Give a direct proof of the theorem "If n is an odd integer, then n2
is odd".
Solution:
This theorem states ๏€ขn p๏€จn๏€ฉ ๏‚ฎ q๏€จn๏€ฉ where p๏€จn๏€ฉ is "n is an odd
integer" and q๏€จn๏€ฉ is "n2 is odd",
๏ƒž
assume that n is odd
n ๏€ฝ 2k ๏€ซ 1 ,
n 2 ๏€ฝ ๏€จ2k ๏€ซ 1๏€ฉ
๏ƒž
k ๏ƒŽZ
2
๏ƒž n2 ๏€ฝ 4k 2 ๏€ซ 4k ๏€ซ 1
๏€จ
๏€ฉ
๏ƒž ๏€ฝ 2 2k 2 ๏€ซ 2k ๏€ซ 1
๏ƒž
n2
is odd.
1.2.2 The Indirect Proofs: (Proof by contraposition)
p๏‚ฎq ๏‚บ๏ƒ˜q๏‚ฎ๏ƒ˜ p.
p ๏‚ฎ q can
This means that the conditional statement
be proved by showing that its contrapositive ๏ƒ˜ q ๏‚ฎ ๏ƒ˜ p is
true.
Example (17):
Prove that if n is an integer and 3n + 2 is odd, then n is odd.
Solution:
p๏‚ฎq
๏ƒ˜q ๏‚ฎ ๏ƒ˜p
means if 3n + 2 is odd, then n is odd its contrapositive
that is n is even implies 3n + 2 is even.
Assume that n is even
๏ƒž
n ๏€ฝ 2k
,
k ๏ƒŽZ
๏ƒž 3n ๏€ฝ 3๏€จ2k ๏€ฉ
๏ƒž 3n ๏€ซ 2 ๏€ฝ 3๏€จ2k ๏€ฉ ๏€ซ 2
๏€ฝ 6k ๏€ซ 2
๏€ฝ 2๏€จ3k ๏€ซ 1๏€ฉ
22
๏ƒž
๏œ
3n ๏€ซ 2
is even
If 3n ๏€ซ 2 is odd, then n is odd.
1.2.3 Proofs by Contradiction:
The proof by contradiction does not prove a result directly.
Example (18): Prove that
2 is irrational by giving a proof by
contradiction.
Solution: Let p be the proposition " 2 is irrational" suppose
that ๏ƒ˜p is true.
Suppose 2 is rational
๏ƒž
2๏€ฝa
b where a and b have no common
factors
๏ƒž 2๏€ฝa
2
b2
๏ƒž 2b 2 ๏€ฝ a 2
๏ƒž
a 2 is an even integer
๏ƒž a is an even integer
๏ƒž
a ๏€ฝ 2c
c๏ƒŽ
,
Z
๏ƒž 2b 2 ๏€ฝ 4c 2
๏ƒž b 2 ๏€ฝ 2c 2
๏ƒž b 2 is an even integer
๏ƒž
b
is an even integer
This contradicts a and b have no common factor
hence 2 is irrational.
Example (19): Give a proof by contradiction of the theorem "if
3n ๏€ซ 2 is odd, then n is odd".
Solution: p ๏‚ฎ q ๏‚บ ๏ƒ˜q ๏‚ฎ ๏ƒ˜p
Let p be " 3n ๏€ซ 2 is odd" and q be "n is odd".
23
To construct a proof by contradiction assume that both p and
`๏ƒ˜ q are
true
๏ƒž
3n ๏€ซ 2
is odd and n is not odd
๏ƒž n is even
๏ƒž
n ๏€ฝ 2k
,
k ๏ƒŽZ
๏ƒž 3n ๏€ฝ 3๏€จ2k ๏€ฉ
๏ƒž 3n ๏€ซ 3 ๏€ฝ 3๏€จ2k ๏€ฉ ๏€ซ 2
๏œ 3n ๏€ซ 2
๏€ฝ
6k ๏€ซ 2
๏€ฝ
2(3k ๏€ซ 1)
is even
This contradict our assumption that 3n ๏€ซ 2 is odd,
hence n is odd .
Exercises:
1) Use a direct proof to show that the sum of two odd integers is
even.
2) Use a direct proof to show that the sum of two even integers
is even.
3) Use a proof by contradiction to prove that the sum of an
irrational number and a rational number is irrational.
4) Show that if n is an integer and ๐’๐Ÿ‘ + ๐Ÿ“ ๐’Š๐’” ๐’๐’…๐’… ,
then n is even using :
a) A proof by contraposition.
b) A proof by contradiction .
5) Prove that if n is an integer and 3n+2 is even , then n is even
using :
a) A proof by contraposition.
b) A proof by contradiction.
24
6) Show that
these statements about the integer x are
equivalent;
(i) 3x +5 is even .
(ii) x+5 is odd.
(iii) ๐‘ฅ 2 is even.
1.2.4 Mathematical Induction:
Introduction:
In general, mathematical induction can be used to prove
statements that assert that
where
p (n )
p (n )
is true for all positive integers n ,
is a propositional function. A proof by mathematical
induction has two parts, a basis step, where we show that
p (1)
is true
and inductive step, where we show that for all positive integers k , if
p (k )
p (k ๏€ซ 1)
is true, then
is true.
Example (1):
Show that if n is a positive integer, then 1 ๏€ซ 2 ๏€ซ ..... ๏€ซ n ๏€ฝ
n(n ๏€ซ 1)
2
Solution:
Let
p (n )
integers is
be the proposition that the sum of the first n positive
n( n ๏€ซ 1)
.
2
Basis step:
p (1)
inductive step
is true because 1 ๏€ฝ
p (k )
(1 ๏€ซ 1)
.
2
holds.
Inductive step:
Assume that 1 ๏€ซ 2 ๏€ซ ..... ๏€ซ k ๏€ฝ
k (k ๏€ซ 1)
is true ----- (1)
2
we must show that :
1 ๏€ซ 2 ๏€ซ ..... ๏€ซ k ๏€ซ (k ๏€ซ 1) ๏€ฝ
Add
(k ๏€ซ 1)
(k ๏€ซ 1)( k ๏€ซ 1) ๏€ซ 1 (k ๏€ซ 1)( k ๏€ซ 2)
๏€ฝ
is also true? -----(2)
2
2
to both sides of equation (1)
25
1 ๏€ซ 2 ๏€ซ ..... ๏€ซ k ๏€ซ (k ๏€ซ 1) ๏€ฝ
k (k ๏€ซ 1)
k (k ๏€ซ 1) ๏€ซ 2(k ๏€ซ 1) (k ๏€ซ 1)( k ๏€ซ 2)
๏€ซ (k ๏€ซ 1) ๏€ฝ
๏€ฝ
2
2
2
is equal to both sides of equation(2)
Hence
p ( k ๏€ซ 1)
๏œ p (n) is
is true
true ๏€ขn๏ƒŽ IN .
Example (2):
Use mathematical induction to show that
๏€ขn๏ƒŽ IN
1 ๏€ซ 2 ๏€ซ 22 ๏€ซ ... ๏€ซ 2n ๏€ฝ 2n ๏€ซ1 ๏€ญ 1
Solution:
Let
p (n ) be
the proposition that 1 ๏€ซ 2 ๏€ซ ... ๏€ซ 2n ๏€ฝ 2n ๏€ซ1 ๏€ญ 1 .
Basis step:
p ( 0)
is true because 20 ๏€ฝ 21 ๏€ญ 1 ๏€ฝ 1
๏€ขn๏ƒŽ IN
Inductive step: for the inductive hypothesis, we assume that
p (k )
is true. That is, we assume that
1 ๏€ซ 2 ๏€ซ ... ๏€ซ 2k ๏€ฝ 2k ๏€ซ1 ๏€ญ 1
-----(1) is true
To carry out the inductive step using this assumption we must
show that when we assume that
p (k )
is true, then
p ( k ๏€ซ 1)
is also true.
That is, we must show that:
1 ๏€ซ 2 ๏€ซ ... ๏€ซ 2k ๏€ซ 2k ๏€ซ1 ๏€ฝ 2( k ๏€ซ1) ๏€ซ1 ๏€ญ 1 ๏€ฝ 2k ๏€ซ 2 ๏€ญ 1
-----(2) is true. ????
assuming the inductive hypothesis
assumption of
p (k ) ,
p (k ) is
add 2k ๏€ซ1 to both sides of equation (1)
๏€จ
๏€ฝ ๏€จ2
๏€ฉ
1 ๏€ซ 2 ๏€ซ 22 ๏€ซ ... ๏€ซ 2k ๏€ซ 2k ๏€ซ1 ๏€ฝ 1 ๏€ซ 2 ๏€ซ 22 ๏€ซ ... ๏€ซ 2k ๏€ซ 2k ๏€ซ1
k ๏€ซ1
๏€ฝ 2.2
๏€ฝ2
๏€ฉ
๏€ญ 1 ๏€ซ 2k ๏€ซ1
k ๏€ซ1
k ๏€ซ2
๏€ญ1
๏€ญ1
is equal to both sides of equation (2)
๏œ p (k ๏€ซ 1)
Hence
is true
p (n)
true.
is true ๏€ขn๏ƒŽ IN .
26
Under the
Example(3):
Use mathematical induction to prove:
๏€ขn ๏ƒŽ IN
n ๏ฐ 2n
Solution:
Let
be the proposition that
p (n )
Basis step:
p (1)
is true, because 1 ๏ฐ 21 ๏€ฝ 2
Inductive step: Assume that
i.e
p (k )
is true ๏€ขn๏ƒŽ IN
----(1)
k ๏ฐ 2k
To complete the inductive step, we need to show that if
true, then
p ( k ๏€ซ 1) = k ๏€ซ 1 ๏ฐ 2k ๏€ซ1
p (k )
is
is true ----(2)???
We add 1 to both sides of inequality (1)
k ๏€ซ 1 ๏ฐ 2k ๏€ซ 1 ๏‚ฃ 2k ๏€ซ 2k ๏€ฝ 2.2k ๏€ฝ 2k ๏€ซ1
is equal to both sides
of inequality (2)
hence
p ( k ๏€ซ 1)
๏œ p (n) is
is true
true ๏€ขn๏ƒŽ IN .
Example (4):
Use mathematical induction to prove that
2n ๏ฐ n! ๏€ขn ๏‚ณ 4
Solution :
Let
p (n )
be the propositional that
Basis step:
p ( 4)
is true because
Inductive step: Assume that
2k ๏ฐ k!
2 n ๏ฐ n!
24 ๏€ฝ 16 ๏ฐ 4! ๏€ฝ 24
p (k )
is true
๏€ขk ๏‚ณ 4
We must show that under this hypothesis
2k ๏€ซ1 ๏ฐ (k ๏€ซ 1)!?
We have
2 k ๏€ซ1 ๏€ฝ 2.2 k
(by definition of exponent)
27
p ( k ๏€ซ 1)
is also true
๏ฐ 2.k! (by inductive hypothesis)
๏ฐ (k ๏€ซ 1)k!
๏€ฝ ( k ๏€ซ 1)!
(because 2 ๏ฐ k ๏€ซ 1 )
(by definition of factorial function)
This shows that
p ( k ๏€ซ 1)
is true when
p (k )
is true.
Exercises:
1) Prove that ∀๐’ ∈ โ„ค
1.2 + 2.3 + โ‹ฏ + ๐‘›(๐‘› + 1) =
๐’(๐’+๐Ÿ)(๐’+๐Ÿ)
๐Ÿ‘
2) Let ๐’‘(๐’) be the statement that ๐’! < ๐’๐’ where ๐’ > 1
a) What is ๐’‘(๐Ÿ)? b) Show that ๐’‘(๐Ÿ)
3) Prove that 3๐‘› < ๐‘›!, ∀๐‘› > 6
4) Prove that 2๐‘› > ๐‘›2 , ∀๐‘› > 4
5) Prove that 12 + 32 + 52 + โ‹ฏ + (2n + 1) =
(๐’+๐Ÿ)(๐Ÿ๐’+๐Ÿ)(๐Ÿ๐’+๐Ÿ‘)
6) Let ๐‘(๐‘›) be the statement that 12 + 22 + ๐‘›2 =
๐Ÿ‘
๐’(๐’+๐Ÿ)(๐Ÿ๐’+๐Ÿ)
๐Ÿ”
,∀๐‘› ∈ โ„ค+
๐’(๐’+๐Ÿ) ๐Ÿ
7) Let ๐’‘(๐’) be the statement that ๐Ÿ๐Ÿ‘ + ๐Ÿ๐Ÿ‘ + ๐’๐Ÿ‘ = (
∀๐’ ∈ โ„ค+
a) What is the statement ๐’‘(๐Ÿ)?
b) Show that ๐’‘(๐Ÿ) is true.
28
๐Ÿ
) ,
Chapter 2
Basic Structures
1) Sets
2) Relations
3) Functions
2.1 Sets :
Def. (1): A set is a collection of an unordered of objects.
Def. (2): The objects in a set are called the elements, or
members, of the set. A set is said to contain its elements.
We write a ๏ƒŽ A
to denote a is an element of the set A. the
notation a ๏ƒ A denotes that a is not an element of the set A. We use
a notation where all members of the set are listed between braces {a,
b, c, d} represent the set with four elements a, b, c and d.
Example (1):
1) The set V of all vowels in the English alphabet can be written
as: V = {a, e, i, o, u}
2) The set O of odd +ve integers less than 10 can be represented
by : O = {1, 3, 5, 7, 9}
3) The set of +ve integers less than 100 can be denoted by {1, 2,
…., 99}
Another way to describe a set is to use set builder notation. We
characterize all those elements in the set by stating the property or
properties they must have to be members.
e.g., the set O of all odd +ve integers less than 10 can be written
as
O = { x | x is an odd positive integer < 10}
O = { x ๏ƒŽ Z ๏€ซ | x is odd and x < 10}
Q+ = { x ๏ƒŽ ๏ƒ‚ |
x๏€ฝ p/q
, for some +ve integers p and q}
29
is the set of all +ve rational numbers
IN = {0, 1, 2, 3, ….} the set of natural numbers.
Z = {…, -1, -1, 0, 1, 2, …} the set of integers
Z + = {1, 2, 3, …} the set of +ve integers
Q = {p/q | p ,q๏ƒŽ Z, q ๏‚น 0} the set of rational numbers
IR, the set of real numbers.
Def (3).
Two sets are equal if and only if they have the same elements.
Example (2):
The set {1, 2, 3} and {3, 2, 2,1} are equal because they have the
same elements. Note that the order in which the elements of a set are
listed does not matter.
Sets can be represented graphically using Venn diagrams. In
Venn diagrams the universal set U which contains all the objects
under consideration, is represented by a rectangle.
In side this
rectangle, circles or other geometrical figures are used to represent
sets.
Example (3):
Draw a Venn diagram that represent V, the set of vowels in the
English alphabet.
U
ax
ux
e
V
ox
i
.
.
Venn diagram for the set of vowels
30
Def (4).:
The set A is said to be a subset of B if and only if every element
of A is also an element of B . we use the notation A ๏ƒ B to indicate
that A is a subset of the set B .
A๏ƒ B
U
A๏ƒ B
A๏ƒ B
B
A๏ƒ B
A
Venn diagram showing A ๏ƒ B
Example (4):
The set of all odd positive integers less than 10 is a subset of the
set of all positive integers less than 10.
The set of rational numbers is a subset of real numbers
Q ๏ƒ IR
Theorem:
For every set S
(i) ๏ฆ ๏ƒ S
(ii) S ๏ƒ S
Proof:
We will prove (i) and leave the proof of (ii) as an exercise
Let S be a set
๏€ขx( x ๏ƒŽ ๏ฆ ๏‚ฎ x ๏ƒŽ S )
is true because the empty set contains no
elements it follows that
conditional statement
x ๏ƒŽ๏ฆ
is always false, it follows that the
x ๏ƒŽ๏ฆ ๏‚ฎ x ๏ƒŽ S
is always true because its
hypothesis is always false and a conditional statement with a false
hypothesis is true.
31
When we wish to emphasize that a set A is a subset of the set B
but A ๏‚น B we write A ๏ƒŒ B and say that A is a proper subset of B
๏€ขx( x ๏ƒŽ A ๏‚ฎ x ๏ƒŽ B) ๏ƒ™
x( x ๏ƒŽ B ๏ƒ™ x ๏ƒ A) .
If A and B are sets with A ๏ƒ B and B ๏ƒ A , then A = B .
Def. (4):
Let S be a set. If there are exactly n distinct elements in S
where n is a nonnegative integer, we say that S is a finite set and that
n is the cardinality of S.
The cardinality of S is denoted by: |S|.
Examples (5):
1) LetA be the set of odd positive integers less than 10. Then |A|= 5.
2) Let S be the set of letters in the English alphabet.
Then | S | = 26.
3) ๏ฆ ๏€ฝ 0 .
Def.(6): A set is said to be infinite if it is not finite.
Example (6): The set of positive integers is infinite.
2.1.2 The Power Set:
Def. (1):
Given a set S , the power set of S is the set of all subsets of the set
S and is denoted by p (S ) .
Example (7): What is the power set of the set {0, 1, 2}?
Solution:
p๏€จ๏ป0,1,2๏ฝ๏€ฉ is the set of all subsets of {0, 1, 2}. Hence
p๏€จ๏ป0,1,2๏ฝ๏€ฉ ๏€ฝ ๏ป๏ฆ ,๏ป0๏ฝ๏ป๏ฝ๏ป
, 1 , 2๏ฝ๏ป
, 0,1๏ฝ๏ป
, 0,2๏ฝ๏ป
, 1,2๏ฝ๏ป
, 0,1,2๏ฝ๏ฝ
Example (8):
What is the power set of the empty set?
What is the power set of the set ๏ป๏ฆ ๏ฝ
32
Solution :
p๏€จ๏ฆ ๏€ฉ ๏€ฝ ๏ป๏ฆ๏ฝ
p๏€จ๏ป๏ฆ๏ฝ๏€ฉ ๏€ฝ ๏ป๏ฆ ,{ ๏ป๏ฆ๏ฝ๏ฝ
If a set has n elements, then its power set has 2n elements
2.1.3 Cartesian Products:
Def. (7) :
The ordered n–tuple ๏€จa1 , a 2 , ๏‹, a n ๏€ฉ is the ordered
collection that has a1 as its first element a 2 as its second element and
a n as its nth element.
Def. (8): Let A and B be sets. The Cartesian product of A and
B,
denoted by A ๏‚ด B , is the set of all ordered pairs ( a , b ) where a ๏ƒŽ A
and b ๏ƒŽ B
A๏‚ด B
= {( a , b ) | a ๏ƒŽ A ๏ƒ™ b ๏ƒŽ B }
Example (9):
What is the Cartesian product of A = {1,2} and B = { a , b , c }?
Solution: A ๏‚ด B ๏€ฝ ๏ป(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)๏ฝ
Def.(9):A subset R of the Cartesian product
A๏‚ด B
is called a
relation from the set A to the set B . the elements of R are ordered
pairs.
For example R ๏€ฝ ๏ปa,0), (a,1), (b,1), (b,2), (c,0), (c,3)๏ฝ is a relation from
the set ๏ปa, b, c๏ฝ to the set ๏ป0,1,2,3๏ฝ.
Example (10):
Show that the Cartesian product A ๏‚ด B ๏‚น B ๏‚ด A where A and B are
the sets in example (9)
A ๏‚ด B ๏€ฝ ๏ป1, a), (1, b), (1, c), (2, a), (2, b), (2, c)๏ฝ
B ๏‚ด A ๏€ฝ ๏ป(a,1), (b,1), (c,1)(a,2)(b,2), (c,2)๏ฝ
33
Def. (10): The Cartesian product of A1 , A2 , ... , An denoted by
A1 ๏‚ด A1 ๏‚ด A3 ๏‚ด ... ๏‚ด An is the set of ordered n-tuples
๏€จa1 , a 2 , ... , a n ๏€ฉ where
ai ๏ƒŽ A i ๏€ฝ 1,2,...., n .
Example (11):
What is the Cartesian product
A ๏‚ด B ๏‚ด C where A ๏€ฝ ๏ป0,1๏ฝ, B ๏€ฝ ๏ป1,2๏ฝ
and C ๏€ฝ ๏ป0,1,2๏ฝ?
Solution:
A ๏‚ด B ๏‚ด C ๏€ฝ ๏ป(0,1,0), (0,1,1), (0,1,2), (0,2,0), (0,2,1), (0,2,2), (1,1,0), (1,1,1)
(1,1,2), ๏€จ1,2,0), (1,2,1), (1,2,2)๏€ฉ๏ฝ
2.1.4 Sets Operations:
Def. (11) : Let A and B sets. The union of the sets A and B,
denoted by A ๏ƒˆ B , is the set that contains those elements are either in
A or in B, A ๏ƒˆ B ๏€ฝ ๏ปx x ๏ƒŽ Avx๏ƒŽ B๏ฝ
u
A
B
A๏• B
Example (12):
The union of the sets ๏ป1,3,5๏ฝ and ๏ป1,2,3๏ฝ is the set ๏ป1,2,3,5๏ฝ.
Def. (12): Let A and B be sets. The intersection of the sets A and
B,
denoted by A ๏‰ B , is the set containing those elements in both A and
B.
A ๏‰ B ๏€ฝ ๏ปx x ๏ƒŽ A ๏ƒ™ x ๏ƒŽ B๏ฝ
u
A
A๏‰ B
34
B
Example (13):
The intersection of the sets ๏ป1,3,5๏ฝ and ๏ป1,2,3๏ฝ is the set ๏ป1,3๏ฝ.
Def. (13):
Two sets are called disjoint if their intersection is the empty set.
Example (14):
Let A ๏€ฝ ๏ป1,3,5,7,9๏ฝ, B ๏€ฝ ๏ป2,4,6,8๏ฝ
A ๏‰ B ๏€ฝ ๏ฆ , ๏œA
and B are disjoint
A๏• B ๏€ฝ A ๏€ซ B ๏€ญ A๏‰ B
Def. (14):
Let A and B sets.
The difference of A and B , denoted
by A – B , is the set containing those elements that are in A but not in
B.
A ๏€ญ B ๏€ฝ ๏ปx x ๏ƒŽ A ๏ƒ™ x ๏ƒ B๏ฝ
Example (15):
The difference of ๏ป1,3,5๏ฝ and ๏ป1,2,3๏ฝ is the set ๏ป5๏ฝ
Def. (15) :
Let U be the universal set.
denoted by
A,
The complement of the set A,
is complement of A with respect to U ๏€ญ A ๏€ฝ A
A ๏€ฝ ๏ปx x ๏ƒ A๏ฝ
A
A
35
Table (1)
Sets identities
A๏•๏ฆ ๏€ฝ A
A ๏‰U ๏€ฝ A
Identity laws
A ๏•U ๏€ฝ U
A๏‰๏ฆ ๏€ฝ ๏ฆ
Domination laws
A๏• A ๏€ฝ A
A๏‰ A ๏€ฝ A
Idempotent laws
๏€จA๏€ฉ ๏€ฝ A
Complementation law
A๏• B ๏€ฝ B๏• A
A๏‰ B ๏€ฝ B๏‰ A
Commutative laws
A ๏• ๏€จB ๏• C ๏€ฉ ๏€ฝ ๏€จ A ๏• B ๏€ฉ ๏• C
A ๏‰ ๏€จB ๏‰ C ๏€ฉ ๏€ฝ ๏€จ A ๏‰ B ๏€ฉ ๏‰ C
Associative laws
A ๏‰ ๏€จB ๏• C ๏€ฉ ๏€ฝ ๏€จ A ๏‰ B ๏€ฉ ๏• ๏€จ A ๏‰ C ๏€ฉ
A ๏• ๏€จB ๏‰ C ๏€ฉ ๏€ฝ ๏€จ A ๏• B ๏€ฉ ๏‰ ๏€จ A ๏• C ๏€ฉ
Distributive laws
A๏• B ๏€ฝ A๏‰ B
Demorgans laws
A๏‰ B ๏€ฝ A๏• B
A ๏• ๏€จA ๏‰ B๏€ฉ ๏€ฝ A
A ๏‰ ๏€จA ๏• B๏€ฉ ๏€ฝ A
Absorption laws
A ๏• A ๏€ฝU
Complement laws
A๏‰ A ๏€ฝ๏ฆ
36
Example (16):
Let A ๏€ฝ ๏ปa, e, i, o, u๏ฝ (where the universal set is the set of the letters
of the English alphabet).
Then A ๏€ฝ ๏ปb, c, d , f , g , h, j, k , l , m, n, p, q, r , s, t , v, w, x, y, z๏ฝ
Example (17):
Let A be the set of positive integers greater than 10 (with
universal set the set of all positive integers).
Then A ๏€ฝ ๏ป1,2,3,4,5,6,7,8,9,10๏ฝ.
2.1.5 Sets Identities:
Table 1 list the most important set identities here we prove
several of these identities using three different methods the proofs of
the remaining identities will be left as exercises.
Example (18): Use set builder notation express the reasoning
establish the 2nd demorgan’s law A ๏‰ B ๏€ฝ A ๏• B
Proof :
A ๏‰ B ๏€ฝ ๏ปx x ๏ƒ ( A ๏‰ B)๏ฝ (def of complement)
= ๏ปx ๏ƒ˜ ๏€จx ๏ƒŽ ๏€จ A ๏‰ B๏€ฉ๏€ฉ (def. of does not belong symbol)
= ๏ปx ๏ƒ˜ ๏€จx ๏ƒŽ A ๏ƒ™ x ๏ƒŽ B๏€ฉ๏ฝ (def . of intersection)
= ๏ปx ๏ƒ˜ ๏€จx ๏ƒŽ A๏€ฉ ๏ƒš ๏ƒ˜๏€จx ๏ƒŽ B๏€ฉ๏ฝ (first demorgan’s law)
= ๏ปx x ๏ƒ A ๏ƒš x ๏ƒ B๏ฝ (by definition of does not belong symbol)
= ๏ปx x ๏ƒŽ A ๏ƒš x ๏ƒŽ B๏ฝ (by definition of complement)
= ๏ปx x ๏ƒŽ ( A ๏• B)๏ฝ(by definition of union)
= A ๏• B (by meaning of set building notation).
Example (19):
Prove the first distributive law from table (1), which states that
A ๏‰ ๏€จB ๏• C ๏€ฉ ๏€ฝ ๏€จ A ๏‰ B๏€ฉ ๏• ๏€จ A ๏‰ C ๏€ฉ ๏€ข sets A, B and C.
37
Solution:
(i) Suppose x ๏ƒŽ A ๏‰ ๏€จB ๏• C ๏€ฉ
๏ƒž x๏ƒŽ A and x ๏ƒŽ ( B ๏• C )
๏ƒž x๏ƒŽ A and x ๏ƒŽ B or x๏ƒŽ C (or both)
๏ƒž x ๏ƒŽ A and x ๏ƒŽ B or x ๏ƒŽ A and x๏ƒŽ C
๏ƒž x๏ƒŽ A ๏‰ B
or x ๏ƒŽ A ๏‰ C
๏ƒž x ๏ƒŽ ๏€จ๏€จ A ๏‰ B๏€ฉ ๏• ๏€จ A ๏• C ๏€ฉ๏€ฉ
๏ƒž A ๏‰ ๏€จB ๏• C ๏€ฉ ๏ƒ ๏€จ A ๏‰ B๏€ฉ ๏• ๏€จ A ๏‰ C ๏€ฉ .
(ii)
Suppose that ๏€จx ๏ƒŽ (๏€จ A ๏‰ B๏€ฉ ๏• ๏€จ A ๏‰ C ๏€ฉ๏€ฉ)
๏ƒž x ๏ƒŽ ( A ๏‰ B)
or
x ๏ƒŽ ( A ๏‰ C)
๏ƒž x๏ƒŽ A and x ๏ƒŽ B or x ๏ƒŽ A ๏ƒ™ x ๏ƒŽ C
๏ƒž x ๏ƒŽ A and x ๏ƒŽ B or x ๏ƒŽ C
๏ƒž x ๏ƒŽ A and x ๏ƒŽ ( B ๏• C )
๏ƒž x ๏ƒŽ ( A ๏‰ ๏€จB ๏• C ๏€ฉ)
๏ƒž ๏€จ A ๏‰ B๏€ฉ ๏• ๏€จ A ๏‰ C ๏€ฉ ๏ƒ A ๏‰ ๏€จB ๏• C ๏€ฉ
From (i), (ii) we complete the proof.
Table (2): A membership table for the distributive property
A
B
C
B๏•C
A ๏‰ ๏€จB ๏• C ๏€ฉ
A๏‰ B
A๏‰C
๏€จ A ๏‰ B๏€ฉ ๏• ๏€จ A ๏‰ C ๏€ฉ
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
0
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
To complete the proof.
38
Example (20):
Let A, B and C be sets. Show that A ๏• ๏€จB ๏‰ C ๏€ฉ ๏€ฝ ๏€จC ๏• B ๏€ฉ ๏‰ A .
Solution :
๏€จ
A ๏• ๏€จB ๏‰ C ๏€ฉ ๏€ฝ A ๏‰ B ๏‰ C
๏€ฉ
(First Demorgan’s law)
= A ๏‰ ๏€จB ๏• C ๏€ฉ (2nd Demorgan’s law)
= ๏€จB ๏• C ๏€ฉ ๏‰ A (commutative law for intersections)
= ๏€จC ๏• B ๏€ฉ ๏‰ A (Commutative law for unions)
Generalized Unions and intersections.
U
A
U
B
A
B
C
Union of A, B and C
Intersection of A, B and C
Example (21):
Let A ๏€ฝ ๏ป0,2,4,6,8๏ฝ , B ๏€ฝ ๏ป0,1,2,3,4๏ฝ
and C ๏€ฝ ๏ป0,3,6,9๏ฝ what are A ๏• B ๏• C and A ๏‰ B ๏‰ C
Solution:
A ๏• B ๏• C ๏€ฝ ๏ป0,1,2,3,4,6,8,9๏ฝ
A ๏‰ B ๏‰ C ๏€ฝ ๏ป0๏ฝ
Def. (16):
The union of a collection of sets is the set that contains those
elements that are members of at least one set in the collection
n
A1 ๏• A2 ๏• ๏‹ ๏• An ๏€ฝ ๏• Ai
i ๏€ฝ1
39
Def. (17):
The intersection of a collection of sets is the set that contains
those elements that are members of all the sets in the collection
n
A1 ๏‰ A2 ๏‰ ๏‹ ๏‰ An ๏€ฝ ๏‰ Ai
i ๏€ฝ1
We can extend the notation we have introduce for unions and
intersections to other families can be denoted by
๏‚ฅ
1) A1 ๏• A2 ๏• ๏‹ ๏• An ๏• ๏‹ ๏€ฝ ๏• Ai
i ๏€ฝ1
๏‚ฅ
2) A1 ๏‰ A2 ๏‰ ๏‹ ๏‰ An ๏‰ ๏‹ ๏€ฝ ๏‰ Ai
i ๏€ฝ1
Example (22):
Suppose that Ai ๏€ฝ ๏ป1,2, ๏‹ , i๏ฝ for
i ๏€ฝ 1,2, ๏‹
Then
๏‚ฅ
๏‚ฅ
i ๏€ฝ1
i ๏€ฝ1
๏• Ai ๏€ฝ ๏• ๏ป1,2, ๏‹ , i๏ฝi ๏€ฝ ๏ป1,2,3, ๏‹๏ฝ
๏‚ฅ
๏‚ฅ
and
๏‰ A ๏€ฝ ๏‰ Ai ๏ป1,2, ๏‹, i๏ฝ ๏€ฝ ๏ป1๏ฝ
i
i ๏€ฝ1
i
i ๏€ฝ1
2.1.6 Computer Representation of sets:
There are various ways to represent sets using a computer. One
method is to store the elements of the set in an unordered fashion.
However, if this is done, the operations of computing the union,
intersection or difference of two sets would be time-consuming,
because each of these operations would require a large amount of
searching for elements.
We will present a method for storing
elements using an arbitrary ordering of the elements of the universal
set. This method of representing sets makes computing combinations
of sets easy.
40
Assume that the universal set ๏• is finite.
arbitrary ordering of elements of
First, specify an
๏• a1 , a 2 , ๏‹ , a n .
Represent a
subset of ๏• with the bit string of length n, where the ith bit in this
string is 1 if ai belongs to A and 0 if ai does not belong to A.
Example (23): Suppose that the universal set U= { 1,2,3,4,…,10}
The bit string for the subsets ๏ป1,2,3,4,6๏ฝ and ๏ป1,3,5,7,9๏ฝ of U are
11 1101 0000 and 10 1010 1010 respectively. Use bit strings to
find the union and intersection of these sets?
Solution:
1) The bit string for the union of these sets is
11 1101
0000 ๏ƒš 10 1010 1010 = 11 1111 1010 which
corresponds to the set ๏ป1,2,3,4,5,6,7,9๏ฝ .
2) The bit string for the intersection of these sets is
11 1101 0000 ๏ƒ™ 10 1010 1010 = 10 1000 000
Which corresponds to the set ๏ป1,3๏ฝ
Exercises:
1) Let ๐‘จ = {๐Ÿ, ๐Ÿ , ๐Ÿ‘, ๐Ÿ’, ๐Ÿ“} and ๐‘ฉ = {๐ŸŽ, ๐Ÿ‘, ๐Ÿ”}
Find
(a) ๐‘จ ∪ ๐‘ฉ
(b) ๐‘จ ∩ ๐‘ฉ
(c) ๐‘จ − ๐‘ฉ
(d) ๐‘ฉ − ๐‘จ
2) Find the sets A and B if
๐‘จ − ๐‘ฉ = {๐Ÿ, ๐Ÿ“, ๐Ÿ•, ๐Ÿ–}, ๐‘ฉ − ๐‘จ = {๐Ÿ, ๐Ÿ๐ŸŽ} and ๐‘จ ∩ ๐‘ฉ = {๐Ÿ‘, ๐Ÿ”, ๐Ÿ—}
3) Determine whether these statements are true or false:
(a) ๐ŸŽ ∈ ∅
(b) ∅ ∈ {๐ŸŽ} (c) {๐ŸŽ} ⊂ ∅ (d) ∅ ⊂ {๐ŸŽ}
(e) {๐ŸŽ} ∈ {๐ŸŽ} (f) {๐ŸŽ} ⊂ {∅, {∅}} (g) {{∅}} ⊂ {{∅}} , {∅}}
4) Use Venn diagram to illustrate the subset of odd integers in
the set of all positive integers not exceeding 10.
5) Use Venn diagram to illustrate the relation ship ๐‘จ ⊆ ๐‘ฉ and
๐‘ฉ ⊆๐‘ช
41
6) What is the Cartesian product ๐‘จ × ๐‘ฉ × ๐‘ช where ๐‘จ = {๐’‚, ๐’ƒ, ๐’„} ,
๐‘ฉ = {๐’™, ๐’š} and ๐‘ช = {๐ŸŽ, ๐Ÿ}
7) Let ๐‘จ = {๐ŸŽ, ๐Ÿ, ๐Ÿ’, ๐Ÿ”, ๐Ÿ–, ๐Ÿ๐ŸŽ}, ๐‘ฉ = {๐ŸŽ, ๐Ÿ, ๐Ÿ, ๐Ÿ‘, ๐Ÿ’, ๐Ÿ“, ๐Ÿ”} and ๐‘ช =
{๐Ÿ’, ๐Ÿ“, ๐Ÿ”, ๐Ÿ•, ๐Ÿ–, ๐Ÿ—, ๐Ÿ๐ŸŽ}. Find: (a) ๐‘จ ∩ ๐‘ฉ ∩ ๐‘ช (b) ๐‘จ ∪ ๐‘ฉ ∪ ๐‘ช (c)
(๐‘จ ∪ ๐‘ฉ) ∩ ๐‘ช (d) (๐‘จ ∩ ๐‘ฉ) ∪ ๐‘ช
8) Suppose that the universal set ๐‘ผ = {๐Ÿ, ๐Ÿ, ๐Ÿ‘, … , ๐Ÿ๐ŸŽ}
Express each of these sets with bit strings where the ith in
the string is 1 if i is the set and 0 otherwise. a) {๐Ÿ‘, ๐Ÿ’, ๐Ÿ“}
๐’ƒ){๐Ÿ, ๐Ÿ‘, ๐Ÿ”, ๐Ÿ๐ŸŽ}
c)
{๐Ÿ, ๐Ÿ‘, ๐Ÿ’, ๐Ÿ•, ๐Ÿ–, ๐Ÿ—}
9) Using the same universal set in problem (8) find the set
specified by each of these bit strings
(a) 11 1100 1111 (b) 01 0111 1000 (c) 10 0000 0001
2.2.1 Relations and their properties:
Def. (1):
let A and B be sets. A binary relation from A to B is a subset of
A๏‚ด B
We use aRb to denote that
( a, b) ๏ƒŽ IR
and aRb to denote that
( a , b) ๏ƒ R
Example (1):
Let A be the set of students in your school, and let B be the set
of courses. Let R be the notation that consists of those pairs
( a, b) ,
where a is a student enrolled in course b . For instance, if Ahmed
and Ali and Zeid are enrolled in CS518 , the pairs( Ahmed, CS518 )
and (Ali, CS518 ), belong to R , if Ali also enrolled in CS510 then the
pair (Ali, CS510 ) is also in R , however, if Zeid is not enrolled in CS510
then the pair (Zeid, CS510 ) is not in R .
42
Example (2):
Let A ๏€ฝ ๏ป0,1,2๏ฝ and B ๏€ฝ ๏ปa, b๏ฝ. Then
{(0, ๐‘Ž), (0, ๐‘), (1, ๐‘Ž), (2, ๐‘)} is a relation from A to B , aRa but
1Rb .
Relations can be represented graphically as shown in the figure:
0.
a
1.
2.
b
R
a
b
0
x
x
1
x
2
x
2.2.2 Relations on a set :
Relations from a set A to itself are of special interest.
Def. (2):
A relation on the set A is a relation from A to A
Example (3):
Let A ๏€ฝ ๏ป1,2,3,4๏ฝ which ordered pairs are in the relation
R ๏€ฝ ๏ป(a, b) a divides b๏ฝ
Solution :
( a, b) ๏ƒŽ R
if and only if a and b are positive integers not
exceeding 4 such that a divides b
R ๏€ฝ ๏ป(1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4)๏ฝ
R 1
2 3
4
1
1
1 x
x x x
2
2
2
x
3
3
3
4
4
4
x
x
x
Example (4) :
How many relations are there on a set with n elements?
43
Solution:
A relation on a set A ๏ƒ A ๏‚ด A since A ๏‚ด A has
n 2 elements
when A
has n elements, hence A has 2 n subsets.
๏œ
there are ๏€จ2n ๏€ฉ subsets of A ๏‚ด A .
2
2
Thus there are 2 n relations on a set of n elements. For example
there are 23 ๏€ฝ 29 ๏€ฝ 512 relations on the set ๏ปa, b, c๏ฝ
2
2.2.3 Properties of relations:
Def. (3):
A relation R on a set A is called reflexive if
(a, a) ๏ƒŽ R, ๏€ขa ๏ƒŽ A .
Example (5):
On ๏ป1,2,3,4๏ฝ
R1 ๏€ฝ ๏ป(1,1), (1,2), (2,1), (2,2), (3,4), (4,1), (4,4)๏ฝ
R2 ๏€ฝ ๏ป(1,1), (1,2), (2,1)๏ฝ
R3 ๏€ฝ ๏ป(1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4)๏ฝ
R4 ๏€ฝ ๏ป(2,1), (3,1), (3,2), (4,1), (4,2), (4,3)๏ฝ
R5 ๏€ฝ ๏ป(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4), (4,4)๏ฝ
R6 ๏€ฝ ๏ป(3,4)๏ฝ
Which of these relations are reflexive?
Solution:
The relations R3 and R5 are reflexive because they both contain
all pairs of the form
( a , a ) namely
(1,1), (2,2), (3,3), (4,4) .
The other
relations are not reflexive and because they do not contain all of these
ordered pairs.
In particular R1 , R2 , R4 and
R6 are not reflexive
because (3,3) is not in any of these relations.
Example (6):
Is the "divides" relation on the set of positive integers reflexive.
44
Solution:
Since a a
whenever a is a positive integer denoted by Rdiv
integer, the "divides" relation is reflexive. If we replace the set of
positive integers with the set of all integers the relation is not
reflexive because 0 does not divides 0 .
Def. (4):
A relation on a set A is called symmetric if
(a, b) ๏ƒŽ R , ๏€ขa, b ๏ƒŽ A .
( a, b) ๏ƒŽ R
and
(b, a ) ๏ƒŽ R
A relation R on a set A such that
(b, a) ๏ƒŽ R ,
whenever
๏€ขa, b ๏ƒŽ A ,
if
then a ๏€ฝ b is called antisymmetric.
Example (7): Consider the relations on the set of integers:
R1 ๏€ฝ ๏ป(a, b) a ๏‚ฃ b๏ฝ
R2 ๏€ฝ ๏ป(a, b) a ๏ฆ b๏ฝ
๐‘…3 = {(๐‘Ž,b)โ”‚a = b , or a = - b }
R4 ๏€ฝ ๏ป(a, b) a ๏€ฝ b๏ฝ
R5 ๏€ฝ ๏ป(a, b) a ๏€ฝ b ๏€ซ 1๏ฝ
R6 ๏€ฝ ๏ป(a, b) a ๏€ซ b ๏‚ฃ 3๏ฝ
Which of these relations contain each of the pairs (1,1) ,(1,2)
,(2,1) ,(1,-1) and (2,2)?
Solution: The pair (1,1) is in
๐‘…1 , ๐‘…3 , ๐‘…4 ๐‘Ž๐‘›๐‘‘ ๐‘…6 , (1,2) ๐‘–๐‘  ๐‘–๐‘› ๐‘…1 ๐‘Ž๐‘›๐‘‘ ๐‘…6 , (2,1) ๐‘–๐‘  ๐‘–๐‘› ๐‘…2 , ๐‘…5 ๐‘Ž๐‘›๐‘‘ ๐‘…6 , (1, −1)๐‘–๐‘  ๐‘–๐‘› ๐‘…1 , ๐‘…3 ๐‘Ž๐‘›๐‘‘๐‘…6
and finally, (2,2)is in๐‘…1 , ๐‘…3 , ๐‘Ž๐‘›๐‘‘ ๐‘…4
Example (8):
Which of the relations from example (5) are symmetric and
which are antisymmetric.
45
Solution :
The relations R2 and R3 are symmetric because in each case
belongs to the relation whenever
( a, b)
does. For R2 both
(b, a)
(2,1)
and
(1,2) ๏ƒŽ R2 . For R3 both (2,1), (1,2) ๏ƒŽ R3 and (1,4), (4,1) ๏ƒŽ R3 . R4 , R5 and R6 are
antisymmetric.
Example (9):
Which of the relations from example (7) are symmetric and
which are antisymmetric.
Solution:
The relations R3 , R4 and R6 are symmetric. R3 is symmetric, for
a ๏€ฝ b or a ๏€ฝ ๏€ญb , then b ๏€ฝ a or b ๏€ฝ ๏€ญa
R4 is symmetric because a ๏€ฝ b ๏ƒž b ๏€ฝ a .
R6 is symmetric because a ๏€ซ b ๏‚ฃ 3 ๏ƒž b ๏€ซ a ๏‚ฃ 3 .
non of the other relations is symmetric (verify).
The relations R1, R2 , R4 and R5 are antisymmetric
R1 is antisymmetric because the inequalities a ๏‚ฃ b and b ๏‚ฃ a ๏ƒž a ๏€ฝ b
R2 is antisymmetric because it is impossible for a ๏ฆ b and b ๏ฆ a .
R4 is antisymmetric, because two elements are related with
respect to R4 if and only if they are equal.
R5 is antisymmetric because it is impossible that a ๏€ฝ b ๏€ซ1 and
b ๏€ฝ a ๏€ซ1 .
Example (10):
Is Rdiv on the set of positive integers symmetric?
antisymmetric?
46
Is it
Solution:
Rdiv is not symmetric because (1,2) ๏ƒŽ Rdiv 1 2 but (2,1) ๏ƒ Rdiv since 2โˆค1.
It is antisymmetric,
๏€ขa, b ๏ƒŽ Z
with a b and b a , then a ๏€ฝ b .
Def. (3):
A relation R on a set A is called transitive if whenever
and
(b, c) ๏ƒŽ R ,
then
( a, b) ๏ƒŽ R
(a, c) ๏ƒŽ R. ๏€ขa, b, c ๏ƒŽ A .
Using quantifiers
๏€ขa, b, c ๏ƒŽ A (a, b) ๏ƒŽ R ๏ƒ™ (b, c) ๏ƒŽ R ๏‚ฎ (a, c) ๏ƒŽ R .
Example (11):
Which of the relations in example (7) are transitive?
Solution:
The relations R1 , R2 , R3 and R4 are transitive.
R1 is transitive since a ๏‚ฃ b and b ๏‚ฃ c ๏ƒž a ๏‚ฃ c
R2 is transitive since a ๏ฆ b and b ๏ฆ c ๏ƒž a ๏ฆ c
R3 is transitive since a ๏€ฝ ๏‚ฑb and b ๏€ฝ ๏‚ฑc ๏ƒž a ๏€ฝ ๏‚ฑc
R4 is clearly transitive.(verify)?
R5 is not transitive since (2,1) and (1,0) ๏ƒŽ R5 but (2,0) ๏ƒ R5
R6 is not transitive since (2,1) and (1,2) ๏ƒŽ R5 but (2,2) ๏ƒ R6
Example (12):
Is Rdiv on the set of positive integers is transitive?.
Solution:
Suppose that a divides b and b divides c . Then there are
positive integers k and L
such that b ๏€ฝ ak
so a divides c . Hence Rdiv is transitive .
2.2.4 Combining relations:
Example (13):
Let A ๏€ฝ ๏ป1,2,3๏ฝ and B ๏€ฝ ๏ป1,2,3,4๏ฝ
47
and c ๏€ฝ bL . Hence
c ๏€ฝ a(kL) ,
The relation R1 ๏€ฝ ๏ป(1,1), (2,2), (3,3)๏ฝand
R2 ๏€ฝ ๏ป(1,1), (1,2), (1,3), (1,4)๏ฝ
Can be combined to obtain:
R1 ๏ƒˆ R2 ๏€ฝ ๏ป(1,1), (1,2), (1,3), (1,4), (2,2), (3,3)๏ฝ
R1 ๏ƒ‡ R2 ๏€ฝ ๏ป(1,1)๏ฝ
R1 ๏€ญ R2 ๏€ฝ ๏ป(2,2), (3,3)๏ฝ
R2 ๏€ญ R1 ๏€ฝ ๏ป(1,2), (1,3), (1,4)๏ฝ
Example (14): Let R1 be the "less than" relation on the set of
real numbers and let R2 be the "greater than" relation on the set of
real numbers, that is R1 ๏€ฝ ๏ป( x, y) x ๏ฐ y๏ฝ and R2 ๏€ฝ ๏ป( x, y) x ๏ฆ y๏ฝ what are
(1) R1 ๏ƒˆ R2 (2) R1 ๏ƒ‡ R2 (3) R1 ๏€ญ R2 (4) R2 ๏€ญ R1 and (5) R1 ๏ƒ… R2 ?
Solution (1) We note that ( x, y) ๏ƒŽ R1 ๏ƒˆ R2 iff ( x, y) ๏ƒŽ R1 or ( x, y) ๏ƒŽ R2 .
Hence ( x, y) ๏ƒŽ R1 ๏ƒˆ R2 iff x ๏ฐ y or x ๏ฆ y . Because the condition x ๏ฐ y or
x๏ฆ y
is the same as the condition
x๏‚น y
it follows that
R1 ๏ƒˆ R2 ๏€ฝ ๏ป( x, y) x ๏‚น y๏ฝ
(2) ( x, y) ๏ƒ R1 ๏ƒ‡ R2 since x ๏ฐ y and x ๏ฆ y is impossible.
Hence R1 ๏ƒ‡ R2 =๐“
(3) R1 ๏€ญ R2 ๏€ฝ R1
(4) R2 ๏€ญ R1 ๏€ฝ R2
(5) R1 ๏ƒ… R2 ๏€ฝ R1 ๏ƒˆ R2 ๏€ญ R1 ๏ƒ‡ R2 ๏€ฝ ๏ป( x, y) x ๏‚น y๏ฝ
Def. (4):
Let R be a relation from a set A to the set B
and S
be a
relation from B to a set C . The composite of R and S is the relation
consisting of ordered pairs
( a, c )
where a ๏ƒŽ A and c ๏ƒŽ C , and for which
there exists an element b ๏ƒŽ B such that
denote the composite of R and S by SoR .
48
( a, b) ๏ƒŽ R
and
(b, c) ๏ƒŽ S .
We
Example (15):
What is the composite of R and S where R is a relation from
๏ป1,2,3๏ฝ to ๏ป1,2,3,4๏ฝ with
R ๏€ฝ ๏ป(1,1), (1,4), (2,3), (3,1), (3,4)๏ฝ and S is a relation
from ๏ป1,2,3,4๏ฝ to ๏ป0,1,2๏ฝ with S ๏€ฝ ๏ป(1,0), (2,0), (3,1), (3,2), (4,1)๏ฝ
Solution:
SoR ๏€ฝ ๏ป(1,0), (1,1), (2,1), (2,2), (3,0), (3,1)๏ฝ
Def. (5):
Let R be a relation on the set A . The powers R n , n ๏€ฝ 1,2,.... are
defined recursively by R1 ๏€ฝ R and
R n ๏€ซ1 ๏€ฝ R n oR
( R 2 ๏€ฝ RoR , R 3 ๏€ฝ R 2 oR ๏€ฝ RoRoR and so on)
Example (16):
Let R ๏€ฝ ๏ป(1,1), (2,1), (3,2), (4,3)๏ฝ find R n for
n ๏€ฝ 4,5,.... .
Solution:
Since R 2 ๏€ฝ RoR ๏œ R 2 ๏ป(1,1), (2,1), (3,1), (4,2)๏ฝ
R 3 ๏€ฝ R 2 oR
R 4 ๏€ฝ R3 .
๏œ R 2 ๏ป(1,1), (2,1), (3,1), (4,2)๏ฝ
Hence Rn ๏€ฝ R3 for
n ๏€ฝ 5,6,7,.......
Theorem(1) :
The relation R on a set A is transitive iff R n ๏ƒ R for
n ๏€ฝ 1,2,....
Exercises:
1) List the ordered pairs in the relation R from A={1,2,3,4} to
B={0,1,2,3}, where (a,b) ๏ƒŽR if and only if :
a) a=b (b) a+b =4 (c) a ๏€พ b (d) aโ”‚b
2) For each of these relations on the set {1,2,3,4}, decide whether it
is reflexive ,symmetric ,antisymmetric and whether it is
transitive:
a){(2,2) ,(2,3),(2,4),(3,2),(3,3),(3,4)}
b) {(1,1),(1,2),(2,1) ,(2,2),(3,3) ,(4,4)}
49
c) {(1,2),(2,3) ,(3,4)}
d) {(2,4),(4,2)}
3) Determine whether the relation R on the set of all people is
reflexive , symmetric ,antisymmetric and /or transitive ,where
(a,b)๏ƒŽ R if and only if :
a) a is taller than b
b) a and b were born on the same day.
c) a has the same first name as b.
d) a and b have a common grandparent.
4) Let ๐‘น๐Ÿ = { (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ‘), (๐Ÿ‘, ๐Ÿ’)}
And ๐‘น๐Ÿ = { (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ‘), (๐Ÿ‘, ๐Ÿ), (๐Ÿ‘, ๐Ÿ), (๐Ÿ‘, ๐Ÿ’)}
be relations from {1,2,3} to {1,2,3,4} find:
a) ๐‘น๐Ÿ ∪ ๐‘น๐Ÿ
b) ๐‘น๐Ÿ ∩ ๐‘น๐Ÿ
c) ๐‘น๐Ÿ โจ ๐‘น๐Ÿ
d) ๐‘น๐Ÿ − ๐‘น๐Ÿ
e) ๐‘น๐Ÿ − ๐‘น๐Ÿ
5) Let R be the relation {(1,2),(1,3),(2,3),(2,4),(3,1)} and S be the
relation {(2,1),(1,3),(2,3),(2,4),(3,1)} find S๏‚ฐR
2.2.5 Representing Relations Using Matrices:
A relation between finite sets can be represented using a zero –
one matrices. Suppose that R is a relation from A ๏€ฝ ๏ปa1, a2 ,..., an ๏ฝ to
B ๏€ฝ ๏ปb1, b2 ,..., bn ๏ฝ
(Here the elements of the sets A and B have been
listed in a particular, but arbitrary, order. Furthermore when A ๏€ฝ B
we use the same ordering from A and B .
The relation R can be represented by the matrix where ๐‘€๐‘… =
[๐‘š๐‘–๐‘— ]
50
๏ƒฌ๏ƒฏ1 if ๏€จai , b j ๏€ฉ๏ƒŽ R
mij ๏€ฝ ๏ƒญ
๏ƒฏ๏ƒฎ0 if ๏€จai , b j ๏€ฉ๏ƒ R
Example (17):
Suppose that A ๏€ฝ ๏ป1,2,3๏ฝand B ๏€ฝ ๏ป1,2๏ฝ let R be the relation from A to
B
containing
(a, b)
if
a ๏ƒŽ A , b๏ƒŽ B , and a ๏ฆ b .
What is the matrix
representing R if a1 ๏€ฝ 1, a2 ๏€ฝ 2, a3 ๏€ฝ 3 and b ๏€ฝ 1, b2 ๏€ฝ 2 ?
Solution:
Because R ๏€ฝ ๏ป(2,1), (3,1), (3,2)๏ฝ, the matrix for R is
๏ƒฉ0 0๏ƒน
M R ๏€ฝ ๏ƒช๏ƒช1 0๏ƒบ๏ƒบ
๏ƒช๏ƒซ1 1๏ƒบ๏ƒป
Example (18):
Let
A ๏€ฝ ๏ปa1 , a2 , a3 ๏ฝ
and
B ๏€ฝ ๏ปb1, b2 , b3 , b4 , b5 ๏ฝ represented by the
matrix
๏ƒฉ0 1 0 0 0 ๏ƒน
M R ๏€ฝ ๏ƒช๏ƒช1 0 1 1 0๏ƒบ๏ƒบ
๏ƒช๏ƒซ1 0 1 0 1๏ƒบ๏ƒป
Solution:
Since R consists of those ordered pairs ๏€จai , b j ๏€ฉ with mij ๏€ฝ 1 , it
follows that R ๏€ฝ ๏ป๏€จa1 , b2 ๏€ฉ, ๏€จa2 , b1 ๏€ฉ, ๏€จa2 , b3 ๏€ฉ, ๏€จa2 , b4 ๏€ฉ, ๏€จa3 , b1 ๏€ฉ, ๏€จa3 , b3 ๏€ฉ, ๏€จa3 , b5 ๏€ฉ๏ฝ
If the matrix of R is a square matrix, we say that R is reflexive if
๏€จai , ai ๏€ฉ ๏ƒŽ R,
i ๏€ฝ 1,2,..., n (the elements in the diagonal of the matrix are
1's).
The relation R is symmetric if ๏€จa, b๏€ฉ ๏ƒŽ R implies ๏€จa, b๏€ฉ ๏ƒŽ R
๏€จm
ij
๏€ฝ m ji ๏€ขi ๏€ฝ 1,2,...., n ๏€ฉ .
๏€จa, b๏€ฉ๏ƒŽ R and
The relation R is antisymmetric if and only if
( b, a) ๏ƒŽ R ๏ƒž a ๏€ฝ b .
Consequently, the matrix of an
51
antisymmetric relation has the property that if m ji ๏€ฝ 1 with i ๏‚น j then
m ji ๏€ฝ 0 .
Or, in other words, either m ji ๏€ฝ 0 or mij ๏€ฝ 0 when i ๏‚น j
1
1
1
0
1
1
0
Symmetric relation
0
0
0
1
antisymmetric matrix
Example (19):
Suppose that the relation R on a set is represented by the
matrix.
๏ƒฉ1 1 0๏ƒน
M R ๏€ฝ ๏ƒช๏ƒช1 1 1๏ƒบ๏ƒบ
๏ƒช๏ƒซ0 1 1๏ƒบ๏ƒป
Is R reflexive, symmetric, and/or antisymmetric.
Solution:
Because all the diagonal elements of the matrix are equal to 1, R
is reflexive. Moreover, because M R is symmetric, it follows that R is
symmetric. It is also easy to see that R is not antisymmetric.
The Boolean operations join and meet ๏€จ๏ƒš,๏ƒ™ ๏€ฉ can be used to find
the matrices representing the union and intersection of two relations.
Suppose that R1 and R2 are relations on a set A represented by the
matrices M R and M R respectively. The matrix representing the
1
2
union of these relations has a 1 in the position where both M R and
1
M R2 have
1.
Thus the matrices representing the union and
52
intersection
of
these
relations
are
M R1 ๏ƒˆ R2 ๏€ฝ M R1 ๏ƒš M R2 and
M R1 ๏ƒ‡ R2 ๏€ฝ M R1 ๏ƒ™ M R2
Example (20):
Suppose that the relations R1 and R2 on a set A are represented
by the matrices:
M R1
๏ƒฉ1 0 1๏ƒน
๏€ฝ ๏ƒช๏ƒช1 0 0๏ƒบ๏ƒบ ,
๏ƒช๏ƒซ0 1 0๏ƒบ๏ƒป
M R2
๏ƒฉ1 0 1๏ƒน
๏€ฝ ๏ƒช๏ƒช0 1 1๏ƒบ๏ƒบ
๏ƒช๏ƒซ1 0 0๏ƒบ๏ƒป
What are the matrices representing R1 ๏ƒˆ R2 and R1 ๏ƒ‡ R2
Solution:
The matrices of these relations are
M R1 ๏ƒˆ R2 ๏€ฝ M R1 ๏ƒš M R2
๏ƒฉ1 0 1๏ƒน
๏€ฝ ๏ƒช๏ƒช1 1 1๏ƒบ๏ƒบ
๏ƒช๏ƒซ1 1 0๏ƒบ๏ƒป
M R1 ๏ƒ‡ R2 ๏€ฝ M R1 ๏ƒ™ M R2
๏ƒฉ1 0 1๏ƒน
๏€ฝ ๏ƒช๏ƒช0 0 0๏ƒบ๏ƒบ
๏ƒช๏ƒซ0 0 0๏ƒบ๏ƒป
2.2.6 The matrix for the composite relations:
Suppose that
A, B
and C sets have m, n, p elements, respectively
let the zero – one matrices for SoR ( R is a relation from A to B and
S is a relation from B to C ), R and S be
๏› ๏
M SoR ๏€ฝ t ij ,
๏› ๏
M R ๏€ฝ rij
and
๏› ๏
M S ๏€ฝ Sij
resp, (these matrices have
sizes m ๏‚ด p , m๏‚ด n and n ๏‚ด p and resp.). The ordered pairs ๏€จai , c j ๏€ฉ๏ƒŽSOR if
and only if there is an element bk such that ๏€จai , bk ๏€ฉ ๏ƒŽ R and ๏€จbk , c j ๏€ฉ ๏ƒŽ S . It
follows that t ij ๏€ฝ 1 iff rik ๏€ฝ s kj ๏€ฝ 1 for some k . From the definition of
the Boolean product, this means that:
M SoR ๏€ฝ M R • M S
53
Example (21):
Find the matrix representing the relations SoR , where the
matrices representing R and S are
๏ƒฉ1 0 1๏ƒน
M R ๏€ฝ ๏ƒช๏ƒช1 1 0๏ƒบ๏ƒบ ,
๏ƒช๏ƒซ0 0 0๏ƒบ๏ƒป
๏ƒฉ0 1 0๏ƒน
M S ๏€ฝ ๏ƒช๏ƒช0 0 1๏ƒบ๏ƒบ
๏ƒช๏ƒซ1 0 1๏ƒบ๏ƒป
Solution:
The matrix for SoR is
M SoR ๏€ฝ M R
๏ƒฉ1 1 1๏ƒน
๏ƒช
๏ƒบ
• MS ๏€ฝ 0 1 1
๏ƒช
๏ƒบ
๏ƒช๏ƒซ0 0 0๏ƒบ๏ƒป
The matrix representing the composite of two relations can be
used to find the matrix for M R in particular
n
M Rn ๏€ฝ M R๏›n ๏
Example (22): Find the matrix representing the relation R 2 ,
where the matrix representing R is
๏ƒฉ0 1 0 ๏ƒน
M R ๏€ฝ ๏ƒช๏ƒช0 1 1๏ƒบ๏ƒบ
๏ƒช๏ƒซ1 0 0๏ƒบ๏ƒป
Solution: The matrix for R2 is
๏›2 ๏
M R2 ๏€ฝ M R
๏ƒฉ0 1 1 ๏ƒน
๏€ฝ ๏ƒช๏ƒช1 1 1๏ƒบ๏ƒบ
๏ƒช๏ƒซ0 1 0๏ƒบ๏ƒป
2.2.7 Representing Relations Using diagraphs:
Def. (6):
A directed graph or diagraph consists of a set V of vertices
(nodes) together with a set E of ordered pairs of elements of V called
54
edges (arcs). The vertex a is called the initial vertex of the edge ๏€จa, b๏€ฉ
and the vertex b is called the terminal vertex of this edge.
An edge of the form ๏€จa, a๏€ฉ is represented using an arc from the
vertex, a back to itself. Such an edge is called a loop.
Example (23): The directed graph with vertices
a , b, c
and d ,
and edges ๏€จa, b๏€ฉ , ๏€จa, d ๏€ฉ , ๏€จb, b๏€ฉ , ๏€จb, d ๏€ฉ , ๏€จc, a ๏€ฉ , ๏€จc, b ๏€ฉ, and ๏€จd, b๏€ฉ is displayed
as in the figure:
a
b
d
Example (24): The directed graph of the relation c
R ๏€ฝ ๏ป(1,1), (1,3), (2,1), (2,3), (2,4), (3,1), (3,2), (4,1)๏ฝ on the set
1
shown in the figure:
2
3
4
Example (25):
๏ป1,2,3,4๏ฝ is
What are the ordered pairs in the relation R represented by the
directed graph shown in the figure:
1
2
3
4
55
Solution :
The ordered pairs ๏€จx, y ๏€ฉ in the relation are:
R ๏€ฝ ๏ป(1,3), (1,4), (2,1), (2,2), (2,3), (3,1), (3,3), (4,1), (4,3)๏ฝ
Each of these pairs corresponds to an edge of the directed graph
with ๏€จ2,2๏€ฉ and ๏€จ3,3๏€ฉ corresponding to loops.
The directed graph representing a relation can be used to
determine whether the relation has various properties. A relation is
reflexive if and only if there exist a loop at every vertex of the
directed graph, so that every ordered pair of he form ๏€จx, x๏€ฉ occurs in
the relation.
A relation is symmetric if and only if for every edge between
distinct vertices in its diagraph there is an edge to the opposite
direction, so that ๏€จ y, x๏€ฉ is in the relation whenever ๏€จx, y ๏€ฉ is in the
relation. Similarly a relation is antisymmetric if and only if there are
edges in opposite direction between distinction vertices. A relation is
transitive if and only if whenever there is an edge from a vertex x to
a vertex y and an edge from a vertex y to a vertex z , there is an
edge from x to z.
Example (26):
Determine whether the relations for the directed graph shown in
the given figure are reflexive, symmetric, antisymmetric, and/or
a
transitive.
a
b
c
b
d
c
R
S
56
Solution :
There are loops at every of the directed graph of R , it is
reflexive, R is neither symmetric nor antisymmetric because there is
an edge from a to b but not one from b to a , but there are edges in
both directions connecting b and c .
R
is not transitive because there is an edge from a to b and an
edge from b to c but no edge from a to c .
The loops are not present at all the vertex of the directed graph
of S , this relation is not reflexive.
It is symmetric and not
antisymmetric because every edge between distinct vertices is
acompanied by an edge in the opposite direction. It is also S is not
transitive because (c,a) ,(a,b)๏ƒŽS but
(c, b ) ๏ƒ S .
Exercises:
Represent each of these relations on {๐Ÿ, ๐Ÿ, ๐Ÿ‘} with
(a) {(๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ‘)} (b) {(๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ‘, ๐Ÿ‘)}
(b) {(๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ‘), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ‘), (๐Ÿ‘, ๐Ÿ‘)} (c)
{(๐Ÿ, ๐Ÿ‘), (๐Ÿ‘, ๐Ÿ)}
2) List the ordered pairs in the relations on {๐Ÿ, ๐Ÿ, ๐Ÿ‘}
corresponding to these matrices
๐Ÿ
(a) [๐ŸŽ
๐Ÿ
๐ŸŽ ๐Ÿ
๐Ÿ ๐ŸŽ]
๐ŸŽ ๐Ÿ
๐ŸŽ
(b) [๐ŸŽ
๐ŸŽ
๐Ÿ ๐ŸŽ
๐Ÿ ๐ŸŽ]
๐Ÿ ๐ŸŽ
(c)
๐Ÿ ๐Ÿ
[๐Ÿ ๐ŸŽ
๐Ÿ ๐Ÿ
๐Ÿ
๐Ÿ]
๐Ÿ
3) List the ordered pairs in the relations represented by the
a
directed graphs
b
(a)
c
(b)
57
(c)
4) Draw the directed graph that represents the relation
{(๐’‚, ๐’‚), (๐’‚, ๐’ƒ), (๐’ƒ, ๐’„), (๐’„, ๐’ƒ), (๐’„, ๐’…), (๐’…, ๐’‚), (๐’…, ๐’ƒ)}
2.2.8 Equivalence Relations:
Def. (7):
A relation on a set A is called an equivalence relation if it is
reflexive, symmetric and transitive.
Equivalence relations are important throughout mathematics
and computer science. One reason for this is that are equivalence
relations, when two elements are related it makes sense to say they
are equivalent.
Def. (8):
Two elements a and b that are related by an equivalence
relation are called equivalent the notation a ~ b is often used to
denote that a and b that are equivalent elements with respect to a
particular equivalence relation.
Example (27):
Let R be a relation on the set of real numbers
๏ƒ‰ a Rb
if and
only if a ๏€ญ b ๏ƒŽ Z .
Is R an equivalence relation?
Solution:
1) R
is reflexive since
2) R is
3) R is
๏€ขa ๏ƒŽ R : a ๏€ญ a ๏€ฝ 0 ๏ƒŽ Z
symmetric since
๏€ขa, b ๏ƒŽ R : a ๏€ญ b ๏ƒŽ Z
๏œ aRa
๏€ขa ๏ƒŽ IR
and b ๏€ญ a ๏ƒŽ Z
๏œ aRb, bRa
transitive let aRb and bRc
๏ƒž a ๏€ญb๏ƒŽZ ๏ƒ™ b ๏€ญ c๏ƒŽZ .
Therefore
a ๏€ญ c ๏€ฝ (a ๏€ญ b) ๏€ซ (b ๏€ญ c) ๏ƒŽ Z
๏œ aRc
Hence R is an equivalence relation.
One of the most widely used equivalence relations is conqurence
modulo m , where m ๏ƒŽ Z ๏€ซ
m ๏ฆ1 .
58
Example (28):
m ๏ฆ 1.
Let m be a positive integer
Show that the relation
R ๏€ฝ ๏ป(a, b) a ๏‚บ b(mod m)๏ฝ is an equivalence relation on Z ๏€ซ
Solution:
1) We have seen that a ๏‚บ b mod m if and only if m divides a ๏€ญ b .
Note that a ๏€ญ a ๏€ฝ 0 is divisible by m , because 0 ๏€ฝ 0.m . Hence
a ๏‚บ a (mod m) ๏œ R
is reflexive.
a ๏€ญ b ๏€ฝ km where k ๏ƒŽ Z .
b ๏‚บ a (mod m) .
Then a ๏€ญ b is divisible by m , so
a ๏‚บ b(mod m) .
2) Suppose that
It follows that
b ๏€ญ a ๏€ฝ (๏€ญk )m ,
so
hence is symmetric.
3) Suppose that
a ๏‚บ b(mod m)
and
b ๏‚บ c(mod m) .
Then m divides
a ๏€ญ b and b ๏€ญ c . Therefore, there are integers k and L with
a ๏€ญ b ๏€ฝ km
and
b ๏€ญ c ๏€ฝ Lm .
Adding these two equations
a ๏€ญ c ๏€ฝ (a ๏€ญ b) ๏€ซ (b ๏€ญ c) ๏€ฝ km ๏€ซ Lm ๏€ฝ (k ๏€ซ L)m
Hence
a ๏‚บ c(mod m) ๏œ R
is transitive ๏œ form (1) , (2) and (3) R is
an equivalence relation.
Example (29):
Show that the "divides" relation ๏€จRdiv ๏€ฉ of the set of positive
integers is not an equivalence relation.
Solution:
By example (6) and example (12), we show that the " Rdiv" is
reflexive and transitive and by example (10) Rdiv is not symmetric
(for instance
2โ”‚4
but
4โˆค2.
Hence " Rdiv" on Z ๏€ซ is not an equivalence
relation.
59
Example (30):
Let R be the relation on the set of real numbers such that
and only if
x, y ๏ƒŽ IR
xRy
if
(real numbers) such that x ๏€ญ y ๏ฐ 1 . show that R is
not an equivalence relation.
Solution :
1) R is reflexive since x ๏€ญ x ๏€ฝ 0 ๏ฐ 1
2) R is symmetric since, for if xRy, x, y ๏ƒŽ IR x, y ๏ฐ 1 , which tells us
that y ๏€ญ x ๏€ฝ x ๏€ญ y ๏ฐ 1 so
yRx
3) R is not transitive. Take
so that
x ๏€ฝ 2.8, y ๏€ฝ 1.9
x ๏€ญ y ๏€ฝ 2.8 ๏€ญ1.9 ๏€ฝ 0.9 ๏ฐ 1,
and Z ๏€ฝ 1.1 ,
y ๏€ญ z ๏€ฝ 1.9 ๏€ญ1.1 ๏€ฝ 0.8 ๏ฐ 1
but
x ๏€ญ z ๏€ฝ 2.8 ๏€ญ 1.1 ๏€ฝ 1.7 ๏ฆ 1 . That is, 2.8R1.9, 1.9 R1.1 but 2.8R1.1 ๏œ R
is not an equivalence relation.
2.2.9 Equivalence Classes:
Def. (9):
Let R be an equivalence relation on a set A . The set of all
elements that are related to an element a ๏ƒŽ A is called the equivalence
class of a . The equivalence class of a with respect to R is denoted by
๏›a๏R . When only one relation is under consideration, we can delete
the subscript R and write ๏›a๏ for this equivalence class.
Example (31):
What are the equivalence classes of 0 and 1 for congruence module
4?
Solution:
The equivalence class of 0 contains all integers a such that
a ๏‚บ 0(mod 4) .
The integers in this class are those divisible by 4
๏œ๏›0๏ ๏€ฝ ๏ป...,๏€ญ8,๏€ญ4,0,4,8,...๏ฝ
60
The equivalence class of 1 contains all the integers a such that
a ๏‚บ 1(mod 4) .
The integers in this class are those
that have a
remainder of 1 when divided by 4. Hence
๏œ๏›1๏ ๏€ฝ ๏ป...,๏€ญ7,๏€ญ3,1,5,9,...๏ฝ
The equivalence classes of the relation congruence modulo are
called the congruence classes modulo m. The congruence class of an
๏›a๏m , so
๏›a๏m ๏€ฝ ๏ป..., a ๏€ญ 2m, a ๏€ญ m, a, a ๏€ซ m, a ๏€ซ 2m,...๏ฝ
integer a modulo m is denoted by
For instance, it follows that :
๏›0๏4 ๏€ฝ ๏ป...,๏€ญ8,๏€ญ4,0,4,8,...๏ฝ and
๏›1๏4 ๏€ฝ ๏ป...,๏€ญ7,๏€ญ3,1,5,9,...๏ฝ
Theorem(2) :
Let R be an equivalence relation on a set A . These statements
for elements
(i) aRb
a, b ๏ƒŽ A
are equivalent:
(ii) ๏›a๏ ๏€ฝ ๏›b๏
(iii) ๏›a๏๏ƒ‡ ๏›b๏ ๏‚น ๏ฆ
Proof :
1) (i) ๏ƒž implies
(ii) Assume that aRb . We will prove that
๏›a๏ ๏€ฝ ๏›b๏ by showing ๏›a๏ ๏ƒ ๏›b๏ and ๏›b๏ ๏ƒ ๏›a๏ . Suppose
c ๏ƒŽ ๏›a๏ .
Then
(bRa ) .
aRc .
Since aRb and R is symmetric
Furthermore, since R is transitive and bRa
and
aRc , it
follows that bRc . Hence c ๏ƒŽ ๏›b๏ ๏ƒž ๏›a๏ ๏ƒ ๏›b๏, ๏›b๏ ๏ƒ ๏›a๏ is left and
exercise for the reader.
2) (ii)
implies (iii).
Assume that ๏›a๏ ๏€ฝ ๏›b๏ .
It follows that
๏›a๏๏ƒ‡ ๏›b๏ ๏‚น ๏ฆ because ๏›a๏ ๏‚น ๏ฆ ๏€จa ๏ƒŽ ๏›a๏๏€ฉR is reflexive.
3) (ii) implies (i): suppose that
c ๏ƒŽ ๏›b๏. ( aRc and bRc ).
๏›a๏๏ƒ‡ ๏›b๏
= ๏ฆ
Then ๏€คc ๏ƒŽ ๏›a๏ and
By the symmetric property,
cRb .
Then by transivity, aRc and cRb ๏ƒž aRb . Because (i) implies
61
(ii), (ii) implies (iii), and (iii) implies (i), the three statements,
(i), (ii) and (iii) are equivalent.
The union of the equivalence classes of R is all of A
(1) ๏ƒˆa๏ƒŽA ๏›a๏R ๏€ฝ A
(2) ๏›a๏R ๏ƒ‡ ๏›b๏R when ๏›a๏R ๏‚น ๏›b๏R
These two observations show the equivalence classes from a
partition of A , because they split A into disjoint subsets. More
precisely, a partition of a set S is a collection of disjoint nonempty
subsets of S that have S as their union.
In other words, the
collection of subsets Ai , i ๏ƒŽ I (I is an index set) forms a partition of S
if and only if.
1) Ai ๏‚น ๏ฆ , i ๏ƒŽ I
2) Ai ๏ƒ‡ A j ๏€ฝ ๏ฆ , i ๏‚น j
3) ๏ƒˆi๏ƒŽI Ai ๏€ฝ S
The figure illustrates the concept of a partition of a set
A2
A1
A4
A3
A5
A7
A6
A9
A8
Example (32):
Suppose that S ๏€ฝ ๏ป1,2,3,4,5,6๏ฝ. The collection of the sets A1 ๏€ฝ ๏ป1,2,3๏ฝ,
A2 ๏€ฝ ๏ป4,5๏ฝ and ๏ป6๏ฝ forms a partition of S because these sets are disjoint
and their union is S .
62
Theorem (3) :
Let R be an equivalence relation on a set
S.
Then the
equivalence classes of R form a partition of S . Conversely, given a
partition { Ai i ๏ƒŽI } of the set S , there is an equivalence relation R that
has the sets Ai , i ๏ƒŽ I , as its equivalence classes.
Example (33):
List the ordered pairs in the equivalence relation R produced by
the partition A1 ๏€ฝ ๏ป1,2,3๏ฝ, A2 ๏€ฝ ๏ป4,5๏ฝ and A3 ๏€ฝ ๏ป6๏ฝ of S ๏€ฝ ๏ป1,2,3,4,5,6๏ฝ in
example (32).
Solution:
The subsets in the partition are the equivalence classes of R .
The pair
( a, b) ๏ƒŽ R
The pairs
iff a and b are in the same subset of the partition.
(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,2)
and
(3,3) ๏ƒŽ R
because
A1 ๏€ฝ ๏ป1,2,3๏ฝ is an equivalence class.
The pairs
(4,4), (4,5), (5,4) and (5,5) ๏ƒŽ R ,
equivalence class. The pair
(6,6) ๏ƒŽ R ,
because A2 ๏€ฝ ๏ป4,5๏ฝ is an
because ๏ป6๏ฝ is an equivalence
class. No pair other than those listed belong to R .
Example (34):
What are the sets in the partition of the integers arising from
congruence modulo 4?
Solution:
There are four congruence classes, corresponding to ๏›0๏4 , ๏›1๏4 , ๏›2๏4
and ๏›3๏4 . They are the sets:
๏›0๏4 ๏€ฝ ๏ป...,๏€ญ8,๏€ญ4,0,4,8,...๏ฝ
63
๏›1๏4 ๏€ฝ ๏ป...,๏€ญ7,๏€ญ3,1,5,9,...๏ฝ
๏›2๏4 ๏€ฝ ๏ป...,๏€ญ6,๏€ญ2,2,6,10,...๏ฝ
๏›3๏4 ๏€ฝ ๏ป...,๏€ญ5,๏€ญ1,3,7,11,...๏ฝ
These congruence classes are disjoint, and every integer is
exactly one of them.
In other words, as theorem (2) says, these
congruence classes form a partition.
Exercises :
Which of these relations on {๐ŸŽ, ๐Ÿ, ๐Ÿ, ๐Ÿ‘} are equivalence relations
(a) {(๐ŸŽ, ๐ŸŽ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ‘, ๐Ÿ‘)}
(b) {(๐ŸŽ, ๐ŸŽ), (๐ŸŽ, ๐Ÿ), (๐Ÿ, ๐ŸŽ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ‘), (๐Ÿ‘, ๐Ÿ), (๐Ÿ‘, ๐Ÿ‘)}
(c) {(๐ŸŽ, ๐ŸŽ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ, ๐Ÿ), (๐Ÿ‘, ๐Ÿ‘)}
2) Determine whether the relations represented by these matrices
are equivalence relations:
๐Ÿ
(a) [๐ŸŽ
๐Ÿ
๐Ÿ ๐Ÿ
๐Ÿ ๐Ÿ]
๐Ÿ ๐Ÿ
๐Ÿ
(b) [๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐Ÿ
๐Ÿ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ]
๐ŸŽ
๐Ÿ
๐Ÿ
(c) [๐Ÿ
๐Ÿ
๐ŸŽ
๐Ÿ
๐Ÿ
๐Ÿ
๐ŸŽ
3) Which of these collections of subsets are partions of
{๐ŸŽ, ๐Ÿ, ๐Ÿ, ๐Ÿ‘, ๐Ÿ’, ๐Ÿ“, ๐Ÿ”}?
(a) {๐Ÿ, ๐Ÿ}, {๐Ÿ, ๐Ÿ‘, ๐Ÿ’}, {๐Ÿ’, ๐Ÿ“, ๐Ÿ”}
(b) {๐Ÿ}, {๐Ÿ, ๐Ÿ‘, ๐Ÿ”}, {๐Ÿ’}, {๐Ÿ“}
(c) {๐Ÿ, ๐Ÿ’, ๐Ÿ”}, {๐Ÿ, ๐Ÿ‘, ๐Ÿ“}
4) What is the congruence class [๐Ÿ’]๐’Ž when m is
(a) 2?
(b) 3?
(c) 6?
64
(d) -3?
๐Ÿ
๐Ÿ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐ŸŽ]
๐ŸŽ
๐Ÿ
2.2.10 Partial ordering:
Def. (1): A relation R on a set S is called partial ordering if it is
reflexive, antisymmetric, and transitive. A set S together with a
partial ordering R is called a partially ordered set, or poset, and is
denoted by ๏€จS, R๏€ฉ . Members of S are called elements of the poset.
Example (1): Show that the "greater than or equal" relation ๏‚ณ
is a partial ordering on the set of integers.
Solution:
1) Because a ๏‚ณ a๏€ขa ๏ƒŽ Z , hence "๏‚ณ" is reflexive
2) If A ๏‚ณ b and b ๏‚ณ a , then a ๏€ฝ b , hence "๏‚ณ" is antisymmetric.
3) "๏‚ณ" is transitive since a ๏‚ณ b ๏ƒ™ b ๏‚ณ c implies a ๏‚ณ c . Hence "๏‚ณ" is
a partial ordering on the set of integers
( Z , ๏‚ณ)
is a poset.
Example (2):The divisibility relation | is a partial ordering
relation on Z ๏€ซ , because it is reflexive, antisymmetric and transitive
( ๐’+ , | ) is a poset.
Example (3): Show that the inclusion relation "๏ƒ" is a partial
ordering on the power set of a set S .
Solution
1) Since A ๏ƒ A when ever,
A ๏ƒ S , " ๏ƒ"
is reflexive.
2) It is antisymmetric because A ๏ƒ B ๏ƒ™ B ๏ƒ A imply that A ๏€ฝ B .
3) "๏ƒ" is transitive, because A ๏ƒ B ๏ƒ™ B ๏ƒ C imply that A ๏ƒ C .
Hence "๏ƒ" is a partial ordering on P(S), (P(S),๏ƒ) is a poset.
65
Def. (2): The elements a and b of a poset
( S , ๏‚ฃ)
are called
comparable if either a ๏‚ฃ b or b ๏‚ฃ a . When a and b are elements of
such that neither a ๏‚ฃ b nor b ๏‚ฃ a , a and b are called
S
incomparable.
Example (4): In the poset (Z ๏€ซ , ) are the integers 3 and 9
comparable? Are 5 and 7 comparable.
Solution : 3 and 9 are comparable since 3|9 .
The integers 5 and 7 are incomparable because ๐Ÿ“ โˆค ๐Ÿ•
and ๐Ÿ• โˆค ๐Ÿ“
2.2.11 Hasse diagrams: The resulting diagram contains sufficient
information to find the partial ordereing is called a Hasse diagram
Example (5): Draw the Hasse diagram representing the partial
ordering ๏ป(a, b) a divides b๏ฝ on ๏ป1,2,3,4,6,8,12๏ฝ.
Solution : Begin with the diagraph for the partial order as
shown in the figure.
8
12
4
2
2)Remove all loops, as
6
shown in figure 1(b)
8
3
4
2
1
1 (a)
1
1(b)
(b(a
Then delete all the edges implied by the transitive property.
)
66
1
2
2
6
2
2
2
3
2
2
2
2
8
These are (1,4), (1,6) (1,8),
1
2
4
(1,12), (2,8), (2,12) and (3,12)
Arrange all edges to point upward
And delete all arrows to obtain the
6
2
3
Hasse diagram as shown in the figure
(c)
1
Example (6): Draw the Hasse diagram for the partial ordering
{(๐‘จ, ๐‘ฉ)|๐‘จ ๏ƒ ๐‘ฉ} on the power set ๐‘ท(๐‘บ) where ๐‘บ = {๐’‚, ๐’ƒ, ๐’„}.
Solution: The Hasse diagram for this partial ordering is
obtained from the associated diagraph by deleting all the loops and
all the edges that occur from transitivity, namely (∅, {๐’‚, ๐’ƒ}),
(∅, {๐’‚, ๐’„}),
(∅, {๐’ƒ, ๐’„}),
({๐’„}, {๐’‚, ๐’ƒ, ๐’„}).
(∅, {๐’‚, ๐’ƒ, ๐’„}), ({๐’‚}, {๐’‚, ๐’ƒ, ๐’„}), ({๐’ƒ}, {๐’‚, ๐’ƒ, ๐’„}),
Finally all edges point upward, and arrows are
deleted as shown in figure 2.
Hasse diagram of (๐‘ท {๐’‚, ๐’ƒ, ๐’„}, ๏ƒ )
67
2.2.12 Maximal and Minimal Elements:
Def.(3): 1) An element of a poset is called maximal if it is not
less than any element of the poset.
1) An element of a poset is called minimal if it is not greater
than any
element
of the poset.
Maximal and minimal
elements are easy to spot using Hasse diagram. They are
“top” and “bottom” in the diagram.
Example (7): Which elements of the poset
({๐Ÿ, ๐Ÿ’, ๐Ÿ“, ๐Ÿ๐ŸŽ, ๐Ÿ๐Ÿ, ๐Ÿ๐ŸŽ, ๐Ÿ๐Ÿ“}, โ”‚) are maximal, and which are minimal?
Solution:
20
12
For this poset shows that
10
the maximal elements
4
are 12, 20 and 25 and
the minimal elements
25
5
2
are 2 and 5.
2.2.13 The greatest element and the least element:
Def.(8):1) An element ๐’ƒ in the poset (๐‘บ, ≤) is called the greatest
element
of
(๐‘บ, ≤) if ๐’ƒ ≤ ๐’‚
∀ ๐’‚ ∈ ๐‘บ.
The greatest element is
unique.
2)An element ๐’‚ in the poset (๐‘บ, ≤) is called the least element of
(๐‘บ, ≤) if ๐’‚ ≤ ๐’ƒ
∀ ๐’ƒ ∈ ๐‘บ. The least element is unique.
68
Example (8): Determine whether the posets represented by each of
the Hasse diagram in the figure have greatest element and least
element.
b
c
d
d
e
d
d
b
c
a
a
a
(a)
b
(b)
a
b
(c)
(d)
Solution:
1) The least element of the poset with Hasse diagram (a) is a. this
poset has no greatest element.
2) The poset with Hasse diagram (b) has neither a least nor a
greatest element.
3) The poset with Hasse diagram (c) has no least element.
Its
greatest element is d.
4) The poset with Hasse diagram (d) has least element a and
greatest element d.
Example (9): Let ๐‘บ be a set. Determine whether there is a
greatest element and a least element in the poset (๐‘ท(๐‘บ), ๏ƒ.)
Solution: The least element is the empty set, because
∅ ๏ƒ T , ∀T∈S. The set ๐‘บ is the greatest element in this poset, because
๐‘ป ๏ƒ ๐‘บ whenever ๐‘ป is a subset of ๐‘บ.
69
Example (10): Is there a greatest element and least element in
the poset (โ„ค+ , โ”‚).
Solution: The integer 1 is the least element because 1โ”‚๐’, ∀ ๐’ ∈
โ„ค+ , there is no integer that divide all positive integers, there is no
greatest element.
Def.(4): 1) An element ๐’– ∈ ๐‘บ is called an upper bound of ๐‘จ ๏ƒ ๐‘บ
if ๐’‚ ≤ ๐’– ∀๐’‚ ∈ ๐‘จ.
2) An element ๐‘ณ ∈ ๐‘บ is called a lower bound of ๐‘จ if
∀๐’‚ ∈ ๐‘จ , ๐‘ณ ≤ ๐’‚.
Example (11): Find the lower and upper bounds of the subsets
{๐’‚, ๐’ƒ, ๐’„}, {๐’‹, ๐’‰} and {๐’‚, ๐’„, ๐’…, ๐’‡} in the poset with the given Hasse
diagram.
Solution:
j
h
1) The
g
upper
bounds
{๐’‚, ๐’ƒ, ๐’„} are ๐’†, ๐’‡, ๐’‹ and
f
of
and
its only lower bound is ๐’‚.
d
2) There are no upper bounds
e
of
b
{๐’‹, ๐’‰}, and its lower
pounds are ๐’‚, ๐’ƒ, ๐’„, ๐’…, ๐’† and
c
๐’‡.
a
3) The
upper
bounds
{๐’‚, ๐’„, ๐’…, ๐’‡} are ๐’‡, ๐’‰
and ๐’‹,
and its lower bound is ๐’‚.
70
of
Def.(5):
1) The element ๐’™ is called the least upper bound of the subset ๐‘จ
if ๐’™ is an upper bound that is less than every other upper
bound of ๐‘จ.
2) The element ๐’š is called the greatest lower bound of ๐‘จ if ๐’š is
the lower bound of ๐‘จ.
Example (12): Find the greatest lower bound and the least upper
bound of {๐’ƒ, ๐’…, ๐’ˆ}, if they exist in the poset shown in example (11).
Solution:
1) The upper bounds of ๐’ƒ, ๐’…, ๐’ˆ are ๐’ˆ and
because ๐’ˆ < โ„Ž, ๐’ˆ is the
least upper bound.
2) The lower bounds of {๐’ƒ, ๐’…, ๐’…} are ๐’‚, and ๐’ƒ, because ๐’‚ < ๐‘, ๐‘ is the
greatest lower bound.
Example (13):
Find the greatest lower bound and the least upper bound of the
sets {๐Ÿ‘, ๐Ÿ—, ๐Ÿ๐Ÿ} and {๐Ÿ, ๐Ÿ, ๐Ÿ’, ๐Ÿ“, ๐Ÿ๐ŸŽ} if they exist, in the poset (โ„ค+ , โ”‚).
Solution:
1)
An integer is a lower bound of {๐Ÿ‘, ๐Ÿ—, ๐Ÿ๐Ÿ} if ๐Ÿ‘, ๐Ÿ— and ๐Ÿ๐Ÿ is
divisible by this integer. The only such integers are 1 and 3.
Since 1โ”‚3, 3 is the greatest lower bound of {๐Ÿ‘, ๐Ÿ—, ๐Ÿ๐Ÿ}.
2) The only lower bound for the set {๐Ÿ, ๐Ÿ, ๐Ÿ’, ๐Ÿ“, ๐Ÿ๐ŸŽ} with respect
to โ”‚ is the element 1. Hence 1 is the greatest lower bound for
{๐Ÿ, ๐Ÿ, ๐Ÿ’, ๐Ÿ“, ๐Ÿ๐ŸŽ}.
71
3) An integer is an upper bound for {๐Ÿ‘, ๐Ÿ—, ๐Ÿ๐Ÿ} iff it is divisible by
3, 9 and 12.
The integers with this property are those
divisible by LCm (3, 9, 12) which is 36. Hence 36 is the least
upper bound of {๐Ÿ‘, ๐Ÿ—, ๐Ÿ๐Ÿ}.
4) A positive integer is an upper bound for {๐Ÿ, ๐Ÿ, ๐Ÿ’, ๐Ÿ“, ๐Ÿ๐ŸŽ} iff it is
divisible by 1, 2, 4, 5 and 10. The integers with this property
are those integers divisible by LCm (1, 2, 4, 5, 10) which is
20. Hence 20 is the least upper bound of {๐Ÿ, ๐Ÿ, ๐Ÿ’, ๐Ÿ“, ๐Ÿ๐ŸŽ}.
2.2 .14 Lattices :
Def.(6): A partially ordered set in which every pair of elements
has both least upper bound and greatest lower bound is called a
lattice.
Example (14): Determine whether the posets represented by
each of the Hasse diagrams in the figure are lattices.
f
f
Solution:
h
e
e
c
e
d
d
b
d
d
c
b
b
a
a
(a)
a
(b)
(c)
1) The posets represented by the Hasse diagrams in (a), (c) are
both lattices because in each poset every pair of elements has
72
both a least upper bound and a greatest lower bound.
(verify).
2) The poset with the Hasse diagram in (b) is not lattice, because
the elements b and c have no least upper bound.
Example (15): Is the poset (โ„ค+ , โ”‚) a lattice?
๐’‚, ๐’ƒ ∈ โ„ค+ . the least upper bound and greatest
Solution: Let
lower bound of these two integers are the least common multiple and
the greatest common divisor of these integers resp. (verify). Hence
(โ„ค+ , โ”‚) is a lattice
.
Example (16): Determine whether (๐‘ท(๐’™), ๏ƒ) is a lattice where ๐‘บ
is a set?
Solution: Let ๐‘จ and ๐‘ฉ be two subsets of ๐‘บ.
The least upper
bound and the greatest lower bound of ๐‘จ and ๐‘ฉ are ๐‘จ๏ƒˆ๐‘ฉ and ๐‘จ๏ƒ‡๐‘ฉ
respectively. Hence (๐‘ท(๐‘บ), ๏ƒ) is a lattice.
Exercises:
1) Which of these are posets?
(a) (โ„ค, =)
(b) (โ„ค, ≠)
(c) (โ„ค, ≥)
(d) (โ„ค, โˆค)
2) Which of these pairs of elements in these posets?
(a) ๐‘ท({๐ŸŽ, ๐Ÿ, ๐Ÿ}, ๏ƒ)
(b) ({๐Ÿ, ๐Ÿ, ๐Ÿ’, ๐Ÿ”, ๐Ÿ–}, โ”‚)
3) Draw the Hasse diagram for the “less than or equal to relation on
{๐ŸŽ, ๐Ÿ, ๐Ÿ“, ๐Ÿ๐ŸŽ, ๐Ÿ๐Ÿ, ๐Ÿ๐Ÿ“}
4) answer these questions for the poset ({๐Ÿ‘, ๐Ÿ“, ๐Ÿ—, ๐Ÿ๐Ÿ“, ๐Ÿ๐Ÿ’, ๐Ÿ’๐Ÿ“}, โ”‚)
(a) Find the maximal elements.
(b) Find the minimal elements.
(c) Is there a greater elements.
73
(d) Is there a least element?
(e) Find all upper bounds of {๐Ÿ‘, ๐Ÿ“}
(f) Find the least upper pound of {๐Ÿ‘, ๐Ÿ“}, if it exists
(g) Find all lower bounds of {๐Ÿ๐Ÿ“, ๐Ÿ’๐Ÿ“}
(h) Find the greatest lower pound of {๐Ÿ๐Ÿ“, ๐Ÿ’ ๐Ÿ“}, if it exists
5) Determine whether the posets with these Hasse diagrams are
lattices.
g
h
f
(a)
(b)
g
f
d
e
d
e
c
b
b
c
a
2.3 Functions:
Def. (1):
Let A and B be non empty sets, a function
f
from A to B is
an assignment of exactly one element of B to each element of A .
We write f(a) = b if b is the unique element of B assigned by the
function f to the element a of A . If f is a function from A to B , we
write
f :A๏‚ฎB
Remark : Functions are sometimes also called mappings or
transformations
๏‚ท
b
a
B
A
A function
f :A๏‚ฎB
f
can also be defined in terms of a relation
from A to B. A relation from A to B is just a subset of
74
A๏‚ด B .
A
relation from A to B that contains one and only one, ordered pair
( a, b), ๏€ขa ๏ƒŽ A
defines a function from A to B.
f (a) ๏€ฝ b ,
where ( a, b) is the unique ordered pair in the relation
that has a as its first element.
Def. (2): If a function from A to B, we say that A is the domain of
f. If
f (a) ๏€ฝ b
we say that b is the image of a and a is a preimage of b.
The range of f is the set of all images of elements of A. also, if f is a
function from A to B, we say that f maps A to B.
Two functions are equal when they have the same domain, have
the same codomain, and map elements of their common domain to
the same elements in their common codomain.
Example(1):
What are the domain, codomain and range of the function that
assigns grades to students shown in the figure
Ahmed
A
Ali
B
Fahad
C
Omer
D
Osman
F
Solution: Let g be the function that assigns a grade to a student
1) The domain f of g is {Ahmed, Ali, Fahad, Omer,
Osman}
2) The codomain of g is {A, B, C, D, F}
3) The range of g is {A, B, C, F}
Example(2):
Let f be the function that assigns the last two bits of length 2 or
greater to that string e.g. f(11010) = 10. Then, the domain of f is the
75
set of all bit strings of length 2 or greater, and both the codomain and
range are the set {00, 01, 10, 11}.
Example(3):
Let,
f:
Z→ Z assigns the square of an integer to this integer.
Then f ( x) ๏€ฝ x 2 the domain of f is the set of all integers ,the codomain
of f to be the set of all integers and the range of f is the set of all
integers that are perfect squares namely ๏ป0,1,4, ,9, ๏‹๏ฝ.
Example(4):
The domain and codomain of functions are often specified in
programming languages. For instance, the Java statement in t floor
(float real) ( …..) and the pascal statement function floor (x : real):
integer both state that the domain of the floor function is the set of
real numbers and its codomain is the set of integers.
Def.(3):
Let f1 + f2 be functions from A to IR then f1 + f2 and f1f2 are also
functions from A to IR defined by
(1) ๏€จ f1 ๏€ซ f 2 ๏€ฉ๏€จx๏€ฉ ๏€ฝ f1 ๏€จx๏€ฉ ๏€ซ f 2 ๏€จx๏€ฉ
(2) ๏€จ f1 f 2 ๏€ฉ๏€จx๏€ฉ ๏€ฝ f1 ๏€จx๏€ฉ๏‚ท f 2 ๏€จx๏€ฉ
Example(5):
Let f1 and f2 be functions from IR to IR such that
๏€จ f1 ๏€ฉ๏€จx ๏€ฉ ๏€ฝ x 2 ,
f 2 ๏€จx ๏€ฉ ๏€ฝ x ๏€ญ x 2 what are the functions
(1) f1 ๏€ซ f 2 (2) f1 f 2
Solution:
(1) ๏€จ f1 ๏€ซ f 2 ๏€ฉ๏€จx ๏€ฉ ๏€ฝ f1 ๏€จx ๏€ฉ ๏€ซ f 2 ๏€จx ๏€ฉ ๏€ฝ x 2 ๏€ซ ๏€จx ๏€ญ x 2 ๏€ฉ ๏€ฝ x
(2) ๏€จ f1. f 2 ๏€ฉ๏€จx ๏€ฉ ๏€ฝ f1 ๏€จx ๏€ฉ. f 2 ๏€จx ๏€ฉ ๏€ฝ x 2 .๏€จx ๏€ญ x 2 ๏€ฉ ๏€ฝ x3 ๏€ญ x 4
Def.(4): Let f be a function from the set A to the set B and let S
be a subset of A . the image of S under the function f is the subset of
76
B
that contains of the images of the elements of S we denote the
image of S by f ๏€จS ๏€ฉ
f ๏€จS ๏€ฉ ๏€ฝ ๏ปt ๏€คs ๏ƒŽ S ๏€จt ๏€ฝ f (s)๏€ฉ๏ฝ ๏€ฝ ๏ปf (s) s ๏ƒŽ S๏ฝ
Example(6):
Let A ๏€ฝ ๏ปa, b, c, d , e๏ฝ and B ๏€ฝ ๏ป1,2,3,4๏ฝ with
,
f (d ) ๏€ฝ 1
and
f (e) ๏€ฝ 1 .
f (a) ๏€ฝ 2 ,
f (b) ๏€ฝ 1 , f (c ) ๏€ฝ 4
The image of the subset S={b,c,e} is the set
f (S ) ๏€ฝ ๏ป1,4๏ฝ.
2.3.1 One-to-One and Onto functions:
Some functions never assign the same value to two different
domain elements.
These functions are said to be one-to-one
Def.(5): A function f is said to be one-to-one or injective, if and
only if
f (a) ๏€ฝ b
implies that a ๏€ฝ b for all a and b ๏ƒŽ D f . A function is
said to be injection if it is one-to-one. Note that a function
f
is one-
to-one if and only if ๐‘“(๐‘Ž) ≠ ๐‘“(๐‘) whenever ๐‘Ž ≠ ๐‘.
Remark:
We can express that
f
is one-to-one using quantifiers as
๏€ขa๏€ขb๏€จ f (a) ๏€ฝ f (b) ๏‚ฎ a ๏€ฝ b๏€ฉ or equivalently ∀๐‘Ž, ∀๐‘ ๐‘Ž ≠ ๐‘ → ๐‘“(๐‘Ž) ≠ ๐‘“(๐‘)
where the universe of discourse is the domain of the function.
Example(7):
Determine whether the function
with
f (a) ๏€ฝ 4 ,
f (b) ๏€ฝ 5 , f (c) ๏€ฝ 1
and
77
f
from ๏ปa, b, c, d ๏ฝ to ๏ป1,2,3,4,5๏ฝ
f (d ) ๏€ฝ 3
is one-to-one.
Solution:
The function
is one-to-one because
f
f
takes on different values
at the four elements of the domain as shown in the figure
.1
a
.
b.
.2
.3
.4
.5
c.
d.
Example(8):
Determine whether the function
f ( x) ๏€ฝ x ๏€ซ 1
from
IR
to IR is one-
to-one function.
Solution:
f ( x) ๏€ฝ x ๏€ซ 1
The function
is a One-to-One function , note that x+1
≠ y +1 when x≠y.
Def.(6):
A function
f
whose domain and codomain are subsets of the set
of real numbers is called increasing if
increasing if
domain of
f
f ( x) ๏ฐ f ( y )
. Similarly
whenever
f
stricktly decreasing if
f ( x) ๏ฆ f ( y )
f ( x) ๏‚ฃ f ( y )
and stricktly
x ๏ฐ y and x and y are in the
is called decreasing if
f ( x) ๏‚ณ f ( y ) and
f ( x) ๏ฆ f ( y )
and
stricktly decreasing if
where x ๏ฐ y and x and y are in the domain of
f
.
Def.(7):
A function from A to B is called onto or surjective if and only if
๏€ขb ๏ƒŽ B
๏€คa ๏ƒŽ A
with
f (a) ๏€ฝ b .
A function
onto.
78
is called surjective if it is
Example(9) :
Let
,
be the function from ๏ปa, b, c, d ๏ฝ to ๏ป1,2,3๏ฝ defined by
f
f (b) ๏€ฝ 2 , f (c) ๏€ฝ 1
and
f (d ) ๏€ฝ 3
f (a) ๏€ฝ 3
is onto function
a .
. 1
b .
. 2
c .
. 3
d .
An onto function
Example(10):
Is the function f ( x) ๏€ฝ x 2 from the set of integers to the set of
integers onto?
Solution:
The function
f
is not onto because there is no an integer x with
๐‘ฅ 2 = −1 for instance.
Example (11):
Is the function ๐‘“(๐‘ฅ) = ๐‘ฅ + 1 from the set of integers to the set of
integers onto?
Solution:
This function is onto, because
this, note that
f ( x) ๏€ฝ y
if and only if
๏€ขy ๏ƒŽ Z
๏€คx ๏ƒŽ Z
x ๏€ซ1 ๏€ฝ y ,
f ( x) ๏€ฝ y .
To see
which holds if and only
if x=y - 1.
Def.(8): The function is a one-to-one correspondence or
bijective, if it is both one-to-one and onto.
Example(12):
Let
f (b) ๏€ฝ 2 ,
f
be the function from ๏ปa, b, c, d๏ฝ to ๏ป1,2,3,4๏ฝ with
f (c ) ๏€ฝ 1
and
f (d ) ๏€ฝ 3
is
f
79
a bijection?
f (a) ๏€ฝ 4 ,
Solution:
The function is one-to-one and onto. It is one-to-one because no
two values in the domain are assigned the same function value. It is
onto because all the four elements of the codomain are integers of
elements in the domain.
Hence
f
is a bijection.
Example(13):
Let A be a set. The identity function on A
is the function
I A : A ๏‚ฎ A where I A ( x) ๏€ฝ x the function I A is bijection function.
2.3.2 Inverse functions and compositions of functions:
Def.(9):
let
B.
be a one-to-one correspondence from the set A to the set
f
The inverse function of
the unique element a ๏ƒŽ A
is the function assigns to an element
f (a) ๏€ฝ b .
denoted by f ๏€ญ1 (b) ๏€ฝ a when
The inverse function of
f
is
f (a) ๏€ฝ b .
Example(14):
Let
and
be the function from ๏ปa, b, c๏ฝ to ๏ป1,2,3๏ฝ
f
f (c ) ๏€ฝ 1
is
f
f (a ) ๏€ฝ 2 , f (b) ๏€ฝ 3
invertable, and if it is what is its inverse.
Solution:
The function
correspondence.
f
The
is invertable because it is one-to-one
inverse
f ๏€ญ1
function
correspondence given by so f ๏€ญ1 (1) ๏€ฝ c , f ๏€ญ1 (2) ๏€ฝ a and
reverses
the
f ๏€ญ1 (3) ๏€ฝ b .
Example(15) :
Let
f
: R ๏‚ฎ R be such that
it is what is its inverse?
80
f ( x) ๏€ฝ x ๏€ซ 1 .
Is
f
invertable, and if
Solution:
The function
f
has an inverse because it is a one-to-one
correspondence, as we have shown in example (10) it is invertible. To
find its inverse let
y ๏€ฝ x ๏€ซ1
๏ƒž x ๏€ฝ y ๏€ญ1
๏ƒž f ( y) ๏€ฝ y ๏€ญ 1
Def.(10).:
Let g be a function from the set A to the set B and let
f
be a
function from the set B to the set C . The composition of the function
and denoted by
( fog )( a) ๏€ฝ f ( g (a ))
is defined by .
Example(16):
Let g be the function from the set ๏ปa, b, c๏ฝ to itself
g (b) ๏€ฝ c
and
set ๏ป1,2,3๏ฝ
f
g (c ) ๏€ฝ a
let
f
g (a) ๏€ฝ b ,
be the function from the set ๏ปa, b, c๏ฝ to the
f ( a) ๏€ฝ 3 , f (b) ๏€ฝ 2
and
f (c ) ๏€ฝ 1
what is the composition of
and g , and what is the composition of g and
f
?
Solution:
The composition is denoted by
( fog )( a) ๏€ฝ f ( g (a)) =
f (b) ๏€ฝ 2 ,
( fog )(b) ๏€ฝ f ( g (b)) ๏€ฝ f (c) ๏€ฝ 1 and ( fog )(c) ๏€ฝ f ( g (c)) ๏€ฝ f (a) ๏€ฝ 3 .
Example(17):
Let
f,g
be the functions from Z to Z defined by
and g(x)=3x+2 what is the composition of
composition of g and
f
f
f ( x) ๏€ฝ 2 x ๏€ซ 3
and g and what is the
?
Solution:
(1) (๐‘“°๐‘”)(๐‘ฅ) = ๐‘“(๐‘”(๐‘ฅ)) = ๐‘“(3๐‘ฅ + 2) = 2(3๐‘ฅ + 2) = 6๐‘ฅ + 4
(2)
( gof )( x) ๏€ฝ g ( f ( x)) ๏€ฝ g (2 x ๏€ซ 3) ๏€ฝ 3(2 x ๏€ซ 3) ๏€ซ 2 ๏€ฝ 6 x ๏€ซ 11
81
Remark:
Note that
fog ๏‚น gof
if
๏€จf
๏€ญ1
๏€ฉ
f (a) ๏€ฝ f ๏€ญ1 ( f (a)) ๏€ฝ f ๏€ญ1 (b) ๏€ฝ a if f (a ) ๏€ฝ b
and ๏€จ fof ๏€ญ1 ๏€ฉ(b) ๏€ฝ f ๏€จ f ๏€ญ1 (b)๏€ฉ ๏€ฝ f (a) ๏€ฝ b
2.3.3 Some important functions:
Def.(11):
The floor function assigns to the real number x
the largest
integer that is less than or equal to x and is defined by ๏ƒซx๏ƒป . The
ceiling function assigns to the real number x the smallest integer that
is greater than or equal to x .
The value of the ceiling function at x is denoted by ⌈๐’™⌉
3
o
3
o
2
1
1
-3 -2 -1
-1 o
o
2
1o
o
-3 -2 -1
3
o
o -2
o
o
2
o
-3
1
2
3
-1
-2
-3
The graph of a floor function
The graph of the ceiling function.
82
Example(18) :
There are some values of the floor and ceiling functions
๏ƒช1๏ƒบ
๏ƒช2๏ƒบ ๏€ฝ 0 ,
๏ƒซ ๏ƒป
๏ƒช ๏€ญ 1๏ƒบ
๏ƒฉ1๏ƒน
๏ƒฉ ๏€ญ 1๏ƒน
๏ƒช 2๏ƒบ ๏€ฝ 1 , ๏ƒช 2 ๏ƒบ ๏€ฝ ๏€ญ1 , ๏ƒช 2 ๏ƒบ ๏€ฝ 0 ,
๏ƒซ ๏ƒป
๏ƒช ๏ƒบ
๏ƒช ๏ƒบ
๏ƒซ3.1๏ƒป ๏€ฝ 3 , ๏ƒฉ3.1๏ƒน ๏€ฝ 4 , ๏ƒฉ7๏ƒน ๏€ฝ 7
Example(19) :
Data stored on a computer disk or transmitted over a data
network are usually represented as a string of bytes. Each byte is
made up of 8 bits. How many bytes are required to encode 100 bits
of data?
Solution:
To determine the number of bytes needed, we determine the
smallest integer that is at least as large as the quotient when 100 is
divided by 8, the number of bits is a byte.
๏›100 8 ๏ ๏€ฝ 12.5 ๏€ฝ 13 bytes are required.
Consequently,
Exercises :
1) Why is ๐’‡ not a function from โ„ ๐’•๐’โ„ if :
a) ๐’‡(๐’™) =
๐Ÿ
๐’™
? ( b) ๐’‡(๐’™) = √๐’™ ? (c) ๐’‡(๐’™) = ±√๐’™๐Ÿ + ๐Ÿ
2)Determine whether each of these functions from Z to Z is
one- to-one
๐’
a) ๐’‡(๐’) = ๐’ − ๐Ÿ (b) ๐’‡(๐’) = ๐’๐Ÿ + ๐Ÿ (c) ๐’‡(๐’) = ๐’๐Ÿ‘ (d) ๐’‡(๐’) = ⌈ ⌉
๐Ÿ
3) Find these values :
๐’‚)⌊๐Ÿ. ๐Ÿ⌋
๐Ÿ‘
(e) ⌈ ⌉
๐Ÿ’
(b) ⌈๐Ÿ. ๐Ÿ⌉ ( c) ⌊−๐ŸŽ. ๐Ÿ⌋ (d) ⌈−๐ŸŽ. ๐Ÿ⌉
๐Ÿ•
(f) ⌊ ⌋
๐Ÿ–
(g) ⌈๐Ÿ‘⌉
(h) ⌊−๐Ÿ⌋
4) Find ๐’‡°๐’ˆ where๐’‡(๐’™) = ๐’™๐Ÿ + ๐Ÿ and ๐’ˆ(๐’™) = ๐’™ + ๐Ÿ, are functions
from R to R.
83
5) Find ๐’‡ + ๐’ˆ and ๐’‡. ๐’ˆ for the functions ๐’‡ ๐’‚๐’๐’… ๐’ˆ given in Exercise
(4).
6) Let ๐’‡ be the function from R to R denoted by๐’‡(๐’™) = ๐’™๐Ÿ .Find :
a)
๐’‡−๐Ÿ ({๐Ÿ})
(b) ๐’‡−๐Ÿ ({๐’™|๐ŸŽ < ๐‘ฅ < 1})
84
Chapter 3
Algorithms, the integers and matrices
3.1 Algorithms:
Def.(1): An algorithm is a finite set of precise instructions for
performing a computation or for solving a problem.
Example(1):
Describe an algorithm for finding the maximum (largest) value
in a finite sequence of integers.
Solution:
We perform the following steps :
1- Set the temporary maximum equal to the first integer in the
sequence.
2- Compare the next integer in the sequence to the temporary
maximum, and if it is larger than temporary maximum, set
the temporary maximum equal to this integer.
3- Repeat the previous step if there are more integers in the
sequence.
4- Stop when there are no integers left in the sequence. The
temporary maximum at this point is the largest integer in the
sequence.
Algorithm (1):
Finding the maximum element in a finite
sequence.
Procedure max ( a1 , a2 , ๏‹ , an : integers)
max : = a1
for i: = 2 to n
if max < ai then max : = ai
{max is the largest element}
85
There are several properties that algorithms generally share.
They are useful to keep in mind when algorithms are describes these
properties are:
๏‚ท
Input. An algorithms has input values from a specified set.
๏‚ท
Output.
From each set of input values an algorithm
produces output values from a specified set.
The output
values are the solution to the problem.
๏‚ท
Definiteness. The steps of an algorithm must be defined
precisely.
๏‚ท
Correctness.
An algorithm should produce the correct
output values for each set input values.
๏‚ท
Finiteness.
An algorithm should produce the described
output after a finite (but perhaps large) number of steps for
any input in the set.
๏‚ท
Effectiveness. It must be possible to perform each step of an
algorithm exactly and into a finite amount of time.
๏‚ท Generality.
The procedure should be applicable for all
problems of the desired farm, not just for a particular set of
input values.
86
3.2 The Number Theory
3.2.1 The integers and division:
Def. (2):
if a and b are integers with a ๏‚น 0 , we say a that divides b if
there is an integer c (such that b ๏€ฝ ac when a divides b we say that a
is a factor of b
and that b is a multiple of a . The notation a b
denoted that a divides b . We write
๐’‚โˆค๐’ƒ
when a doesnot divide b .
Example(2):
Determine whether 3 7 and 312 .
Solution:
because 7 3 is not an integer
1)
๐Ÿ‘โˆค๐Ÿ•
2)
312 because 12 3 ๏€ฝ 4 .
Example(3) :
Let n and d be positive integers. Howmany positive integers not
exceeding n are divisible by d ?
Solution:
The positive integers divisible by d are all integers of the form
dk , where k is a positive integer.
Hence, the number of positive
integers divisible by d that donot exceed n equals the number of
integers k with 0 ๏‚ฃ dk ๏‚ฃ n or with
0 ๏‚ฃ k ๏‚ฃ n d . Therefore, there are
positive integer not exceeding n that are divisible by d .
Theorem (1):
Let
a, b ,
and c be integers. Then
1- if a b and a c , then a (b ๏€ซ c)
2- if a b , then a bc for all integers c .
3- if a b and b c , then a c .
87
Proof:
Using direct proof of (1) suppose that a b and a c . Then, from
the definition of divisibility, it follows that there
are integers s and t with
b = as and c = st hence
b ๏€ซ c ๏€ฝ as ๏€ซ at ๏€ฝ a( s ๏€ซ t )
Therefore, a divides b ๏€ซ c .
The proof of (2) and (3) are left as exercise for the reader.
Corollary(1):
If
a, b
and c are integers such that a b and a c , then a mb ๏€ซ nc
whenever m and n are integers.
Proof:
We will give a direct proof. By part (2) of theorem (1) it follows
that a mc and a nc whenever m and n are integers. By part (1) of
theorem (1) it follows that a mb ๏€ซ nc .
3 .2.2 The division algorithm:
Theorem (2): The division algorithm let a be an integer and d a
positive integer.
Then there are unique integers q and r with
0 ๏‚ฃ r ๏ฐ d such that a ๏€ฝ dq ๏€ซ r .
Def.(3): In the equality in the division algorithm, d is called the
divisor, a is called the divided, q is called the quotient, and r is
called the remainder. This notation is used to express the quotient
and remainder. q ๏€ฝ a div d,
r ๏‚บ a mod d
Example (4): What are the quotient and remainder when 101 is
divisible by 11?
Solution: We have
101 = 11*9 + 2
9 = 101 div 11
2 ๏‚บ 101 mod 11
88
Example (5):
What are the quotient and remainder when -11 is divisible by 3.
Solution:
-11 = 3(-4) + 1
๏œ q = - 4 and r = 1
๏œ - 4 = - 11 div 3
1 ๏‚บ -11 mod 3
3.3 Modular Arithmetic:
Def.(4):
If a and b are integers and m is a positive integer, then a is
congruent to b modulo m if m divides a ๏€ญ b . we use the notation
a ๏‚บ b mod m to indicate that a is congruent to b modulo m . If a
and b are not congruent modulo m , we write a ๏‚น b mod m .
Theorem( 3):
Let a and b be integers, and let m be a positive integer. then
mod if and only if a mod = b mod .
Example (6):
Determine whether 17 is congruent to 5 modulo 6 and whether
24 and 14 are not congruent modulo 6.
Solution:
Since 6 divides 17-5 = 12, we say that 17 ≡ 5 mod 6.
Since 24 – 14 = 10 is not divisible by 6
24 โ‰ข 14 mod 6.
Theorem (4):
Let m be a positive integer. The integers a and b are congruent
modulo m iff there is an integer k such that a ๏€ฝ b ๏€ซ km .
Theorem (5):
Let m be a positive integer if a ๏‚บ b mod and c ๏‚บ d (mod m ), then
a ๏€ซ c ๏‚บ b ๏€ซ d (mod m ) and
ac ๏‚บ bd (mod m ).
89
Proof;
Since
a ๏‚บ b (mod m ) and
c ๏‚บ d (mod
m ) ๏€คs, t ๏ƒŽ
with b ๏€ฝ a ๏€ซ sm and d ๏€ฝ c ๏€ซ tm .
Hence
b ๏€ซ d ๏€ฝ ๏€จa ๏€ซ sm๏€ฉ ๏€ซ ๏€จc ๏€ซ tm๏€ฉ ๏€ฝ ๏€จa ๏€ซ c๏€ฉ ๏€ซ m๏€จs ๏€ซ t ๏€ฉ .
and bd ๏€ฝ ๏€จa ๏€ซ sm๏€ฉ๏€จc ๏€ซ tm๏€ฉ ๏€ฝ ac ๏€ซ m๏€จat ๏€ซ cs ๏€ซ stm๏€ฉ .
Hence a ๏€ซ c ๏‚บ b ๏€ซ d (mod m ) and ac ๏‚บ bd (mod m ).
Example(7) :
Since 7 ≡ 2 mod 5 and 11 ≡ 1 mod 5
hence 18 = 7 + 11 ≡ 2 + 1 = 3 (mod 5)
and 77 = 7*11 , 2.1 ≡ 2 (mod 5)
Corollary (2);
Let m be a positive integer and let a and b be integers. Then
๏€จa ๏€ซ b๏€ฉ mod m = (( a mod m ) + ( b mod m ))
and ab mod m = (( a mod m ) ( b mod m )) mod m .
Proof:
By the definition mod m and the definition of congruence
modulo m , we know that
a ๏€ซ b ๏‚บ ( a mod m ) (mod m ) and b ๏‚บ ( b mod m ) (mod m )
Hence, from theorem (5) tells us that
a ๏€ซ b ๏‚บ ( a mod m ) + ( b mod m ) (mod m )
and ab ๏‚บ ( a mod m ) ( b mod m ) (mod m )
3.4 Primes and greater common divisor primes:
Def.(4):
A positive integer p greater than 1 is called prime if the only
positive factors of p are 1 and p . A positive integer that is greater
than 1 and is not prime is called composite.
90
Example(8):
The integer 7 is prime since its only positive factors are 1 and 7,
where the integer 9 is composite because it is divisible by 3.
The primes less than 100 are
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
79, 83, 89 , and 97.
Theorem (6): ( The fundamental theorem of arithmetic)
Every positive integer greater than 1 can be written uniquely in
a prime or as the product of two or more primes where the prime
factors are written in order of non decreasing size.
Example(9): Give the prime factorizations of 100, 64, 999 and
1024
Solution:
1.
100 = 2.2.5.5 = 22.52
2. 641 = 641
3. 999 = 3.3.3.37 = 33.37
4. 1024 = 2.2.2.2.2.2.2.2.2.2 = 210
Theorem (7): If n is a composite integer, then has a prime less
than or equal to
n.
Example(10): Show that 101 is prime
Solution:
The only are exceeding 101 are 2, 3, 5 and 7. Because 101 is
not divisible by 2, 3, 5 and 7 it follows that 101 is prime.
3.5 Greatest common divisor and least common multiple:
Def.(5):
Let a and b be integers, not both zero. The largest integer
such that d a and d b is called the greatest common divisor of a and
b and is denoted by gcd( a, b) .
91
Example(11) :
What is the greatest common divisor of 24 and 36?
Solution:
The positive common divisors of 24 and 36 are
1, 2, 3, 4, 6 and 12,
Hence
gcd (24, 36) = 12.
Example(12) :
What is the greatest common divisor of 17 and 22?
Solution:
The integers 17 and 22 have no positive common divisors other
than 1, so that gcd (17, 22) = 1.
Def.(6):
The integers a and b are relatively prime of their greatest
common divisor is 1.
gcd (17, 22) = 1
Example(12):
Determine whether the integers 10, 17 and 21
are pairwise
relatively prime and whether the integers 10, 19 and 24 are pairwise
relatively prime?
Solution:
gcd (10, 17) = 1,
gcd (17, 21) = 1
(10, 21) = 1,
hence 10, 17 and 21 are pairwise relatively prime.
Example (13):
1)gcd(300,18)= gcd(12,18)= gcd(12,6)=6
2)gcd(101,100)=gcd(1,100)=1
3)gcd(89,55)=gcd(34,55)= gcd(34,21)=gcd(13,21)=gcd(13,8)
=gcd(5,8 )=gcd(5,3)=gcd(2,3)=gcd(2,1)=1
You can check in each case (using a prime factorization of
the numbers ).
92
Example(14):
The prime factorization of 120 and 500 are 120 = 23 . 3 . 5 and
500 = 22. 53.
๏œ
the
gcd (120, 500) = 2 min( 3, 2). 3min(1,0). 5min(1,3)
=
22.30.51 = 20
Def.(7):
The least common multiple of the positive integers a and b is
the smallest positive integer that is divisible by both a and b . The
least common multiple of a and b denoted by
max ๏€จ a1 , b1 ๏€ฉ
. P2max ๏€จa 2 , b2 ๏€ฉ.... Pnmax ๏€จa n , bn ๏€ฉ
Lcm( a, b) ๏€ฝ P1
Example(15):
Find Lcm (23.35.72, 24.33) = 2max(3,4).3max(5,3).7max(0,2) = 24.35.72
Theorem(8) :
Let a and b be positive integers. Then
ab ๏€ฝ gcd( a, b). Lcm(a, b)
Exercises:
1) Does 17 divides each of these numbers :
a) 68 (b) 84 (c) 357 (d) 1001
2) Show that if a is an integer other than 0 , then :
a) 1 divides a (b) a divides 0
3) What are the quotient and remainder when :
a) 19 is divisible by 7?
b) -111 is divisible by 11 ?
c) 789 is divisible by 23 ?
d) 1001 is divisible by 13 ?
4) Evaluate these quantities:
a) – 17mod 2
(b) 144mod 7
(c) -101mod13 (d) 199mod19
5) List five integers that are congruent to 4modulo12
6) Decide whether which each of these integers is congruent to
5 modulo17 :
93
a) 80 (b)103 (c)-29 (d) -122
7) Determine whether each of these integers is prime :
a) 21 (b) 29 (c) 71 (d) 97 (e) 111 (f) 143 (g) 113 (h) 107.
8) Determine whether the integers in each of these sets are
pairwise relatively prime :
a) 21 , 34 , 55 (b) 14 , 17 ,85 (c) 25 ,41,49 ,64 (d) 17 ,18 ,19 ,23.
9) Find gcd(1000,625) and lcm(1000,625) and verify that
gcd(1000,625).lcm(1000,625)= 1000.625.
10)
What are the greatest common divisors of these pairs of
integers:
a) ๐Ÿ‘๐Ÿ• . ๐Ÿ“๐Ÿ‘ . ๐Ÿ•๐Ÿ‘ , ๐Ÿ๐Ÿ๐Ÿ . ๐Ÿ‘๐Ÿ“ . ๐Ÿ“๐Ÿ—
b) 2.3.5.7.11.13, ๐Ÿ๐Ÿ๐Ÿ . ๐Ÿ‘๐Ÿ— . ๐Ÿ๐Ÿ. ๐Ÿ๐Ÿ•๐Ÿ๐Ÿ’
c) 17, ๐Ÿ๐Ÿ•๐Ÿ๐Ÿ•
d) ๐Ÿ๐Ÿ . ๐Ÿ•, ๐Ÿ“๐Ÿ‘ . ๐Ÿ๐Ÿ‘
3.6 Integers and algorithms:
3.6.1 Representation of integers:
In every day life we used decimal notation to express integers.
For example, 965 is used to denote 9.102 + 6.10 + 5.
However, it is often convenient to use bases other than 10. In
particular computers usually use binary notation (with 2 as a base)
when carrying out arithmetic, and octal (base 8) or hexadecimal
(base 16).
Theorem(9) :
Let b be a positive integer greater than 1. Then if n is positive
integer, it can be expressed uniquely in the form
n ๏€ฝ ak b k ๏€ซ ak ๏€ญ1b k ๏€ญ1 ๏€ซ ๏‹ ๏€ซ a1b ๏€ซ a0
94
Example(16):
What is the decimal expansion of the integer that has (1 0101 111)2
as its binary expansion?
Solution:
(1 0101 111)2 = 1.28 + 0.27 + 1.26 + 0.25 + 1.24 + 1.23 +1.22 + 1.21
+ 1.20 = 351
Usually, the hexadecimal digits used are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C , D, E
and F , where the letters A through F represent the
digits corresponding to the numbers 10 through 15 (in decimal
notation).
Example(17):
What is the decimal expansion of the hexadecimal expansion
๏€จ2AEOB ๏€ฉ16
Solution:
We have
๏€จ2AEOB ๏€ฉ16
= 2.164 + 10.163 + 14. 162 + 0.161 + 11 = (175627)10
3.6.2 Base conversion:
We will now describe an algorithm for constructing the base
expansion of an integer n . First, divide n by b to obtain a quotient
and remainder, that is to obtain
q0 ๏€ฝ bq1 ๏€ซ a1
0 ๏‚ฃ a1 ๏ฐ b
We see that a1 is the second digit from the right in the base b
expansion of n .
Continue this process, successively dividing the
quotient by b , obtaining additional base b digits as the remainders.
This process terminates when we obtain a quotient equal to zero.
Example(18) :
Find the base 8, or octal, expansion of (12345)10
95
Solution:
First, divide 12345 by 8 to obtain
12345 = 8.1543 + 1
1543 = 8.192 + 7
192 = 8.24 + 0
24 = 8.3 + 0
3 = 8.0 + 3
๏œ (12345)10 = (30071)8
Example(19) :
Find the hexadecimal expansion of (177130)10
Solution:
177130 = 16.11070 + 10
11070 = 16.691 + 14
691 = 16.43 + 3
43 = 16.2 + 11
2 = 16.0 + 2
(177130)10 = ๏€จ2 B3EA๏€ฉ16
Example(20):
Find the binary expansion of (241)10
Solution:
241 = 2.120 + 1
120 = 2.60 + 0
60 = 2.30 + 0
30 = 2.15 + 0
15
= 2.7 + 1
7 = 2.3 + 1
3 = 2.1 + 1
1 = 2.0 +1
๏œ (241)10 = (111 1001)2
Example(21): Find the binary form of the non negative integers
up to 10 ?
96
Solution:
0 = (0)2
1 = (1)2
2 = (10)2
3 = 2+ 1 = (11)2
2
= 3 + 1 = (100)2
3 = 4+ 1 = (101)2
4 = 4+2+1 = (110)2
5 = 4 + 2 + 1 =(111)2
6 = 7+1 = (1000)2
7 = 8 + 1 = (1001)2
8
= 8 + 2 = (1010)2
Example(22) :
Find the hexadecimal expansion of
(11 1110 1011 11 00)2
and binary
expansion of ๏€จ A8D ๏€ฉ16
Solution:
To convert (11 1110 1011 1100)2 into hexadecimal notation we
group the binary digits into blocks of four adding initial zeros at the
start of the leftmost block if necessary. These blocks are 0011, 1110,
1011 and 1100 which correspond to the hexadecimal digits 3, E, B and
C respectively consequently (11 110 1011 1100)2 = (3EBC )
Algorithm(1): constructing base
expansion ( n : positive integer)
q :๏€ฝ n
k :๏€ฝ 0
While
q๏‚น0
Begin
ak :๏€ฝ q mod b
97
expansion procedure base
q :๏€ฝ Lq / b
k :๏€ฝ k ๏€ซ 1
end {the base b expansion of n is ๏€จak ๏€ญ1 ๏‹ a1a0 ๏€ฉb }
Hexadecimal octal and binary representation of the integers 0 -15
Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Hexadecimal
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Octal
0
1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
Binary
0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
3.6.3 Algorithms for integers operations:
The algorithms for performing operations with integers using
their binary expansions are extremely important in computer
arithmetic.
We will describe algorithms for the additional and
multiplication of two integers expressed in binary notation. We will
also analyze the computational complexity of these algorithms, in
terms of the actual number of bit operations used. Throughout this
discussion, suppose that the binary expansion of a and b are
a ๏€ฝ ๏€จan๏€ญ1an๏€ญ2 ๏‹ a1a0 ๏€ฉ2
, b ๏€ฝ ๏€จbn๏€ญ1bn๏€ญ2 ๏‹ b1b0 ๏€ฉ2
So that a and b each have bits (putting bits equal to 0 at the
beginning of one of these expansions if necessary).
To add a and b , first add their right most bits a0 ๏€ซ b0 ๏€ฝ c0 .2 ๏€ซ s0
Where s0 is the rightmost bit in the binary expansion of a ๏€ซ b
and c0 is the carry, which is either 0 or 1 .
Then
a1 ๏€ซ b1 ๏€ซ c0 ๏€ฝ c1.2 ๏€ซ s1
Where s1 , is the next bit (from the right in the binary expansion
of
a ๏€ซ b and c1 is the carry.
Continue this process, adding the
corresponding bits in the two binary expansions and the carry to
determine the next bit from the right in the binary expansion of a ๏€ซ b .
98
At the last stage, add an๏€ญ1 , bn๏€ญ1 and cn๏€ญ2 to obtain cn๏€ญ1.2 ๏€ซ sn๏€ญ1 . The
leading bit of the sum is
sn ๏€ฝ cn๏€ญ1 .
This procedure produces the
binary expansion of the sum, namely, a ๏€ซ b ๏€ฝ ๏€จsn sn๏€ญ1 ๏‹ s1s0 ๏€ฉ
Example(23) : Add a ๏€ฝ ๏€จ11101๏€ฉ2 and b ๏€ฝ ๏€จ11101๏€ฉ2
Solution :
a0 ๏€ซ b0 ๏€ฝ 0 ๏€ซ 1 ๏€ฝ 0.2 ๏€ซ 1
So that c0 ๏€ฝ 0 and s0 ๏€ฝ 1
a1 ๏€ซ b1 ๏€ซ c1 ๏€ฝ 1 ๏€ซ 1 ๏€ซ 0 ๏€ฝ 1.2 ๏€ซ 0
๏œc1 ๏€ฝ 1 and s1 ๏€ฝ 0
a2 ๏€ซ b2 ๏€ซ c2 ๏€ฝ 1 ๏€ซ 1 ๏€ซ 1 ๏€ฝ 1.2 ๏€ซ 0
๏œc2 ๏€ฝ 1 and s2 ๏€ฝ 0
a3 ๏€ซ b3 ๏€ซ c3 ๏€ฝ 1 ๏€ซ 1 ๏€ซ 1 ๏€ฝ 1.2 ๏€ซ 1
it follow that c3 ๏€ฝ 1 and s3 ๏€ฝ 1
s4 ๏€ฝ c3 ๏€ฝ 1
๏œ s ๏€ฝ a ๏€ซ b ๏€ฝ ๏€จ11001๏€ฉ2
111
1110
1011
11001
Algorithm (2) Addition of integers:
Procedure add ( a,b : positive integers)
{ the binary expansions of a and b are ๏€จan ๏€ญ1an ๏€ญ 2 ๏‹ a1a0 ๏€ฉ2 and
๏€จbn ๏€ญ1bn ๏€ญ 2 ๏‹ b1b0 ๏€ฉ2 respectively}
c :๏€ฝ 0
for
j :๏€ฝ 0
to n ๏€ญ 1
begin
99
d :๏€ฝ L๏€จa j ๏€ซ b j ๏€ซ c ๏€ฉ/ 2
s j :๏€ฝ a j ๏€ซ b j ๏€ซ c ๏€ญ 2d
c :๏€ฝ d
end
sn :๏€ฝ c
{the binary expansion of the sum is ๏€จsn sn ๏€ญ1 ๏‹ s0 ๏€ฉ2 }
Multiplication of two n -bit integers a and b
The conventional algorithm (used when multiplying with pencil
and paper) works as follows:
๏€จ
๏€ฉ
๏€ฝ a๏€จb 2 ๏€ฉ ๏€ซ a๏€จb 2 ๏€ฉ ๏€ซ ๏‹ ๏€ซ a๏€จb 2 ๏€ฉ
ab ๏€ฝ a b0 20 ๏€ซ b1 21 ๏€ซ ๏‹ ๏€ซ bn ๏€ญ1 2n ๏€ญ1
0
0
1
1
n ๏€ญ1
n ๏€ญ1
Algorithm (3) Multiplying integers:
Procedure multiply ( a,b : positive integers)
{the binary expansions of a and b are
๏€จan ๏€ญ1an ๏€ญ 2 ๏‹ a1a0 ๏€ฉ2 and
๏€จbn ๏€ญ1bn ๏€ญ 2 ๏‹ b1b0 ๏€ฉ2 , respectively}
for
j :๏€ฝ 0
to n ๏€ญ 1
begin
if b j ๏€ฝ 1 then c j :๏€ฝ a shifted j places
else c j ๏€ฝ 0
end
{ c0 , c1, ๏‹ , cn ๏€ญ1 and partial products}
p :๏€ฝ 0
for
j :๏€ฝ 0
to n ๏€ญ 1
p :๏€ฝ p ๏€ซ c j
{ p is the value of ab }
Example (24): Find the product of a ๏€ฝ ๏€จ110๏€ฉ2 and b ๏€ฝ ๏€จ101๏€ฉ2
100
Solution ;
ab0 .20 ๏€ฝ ๏€จ110๏€ฉ2 .1.20 ๏€ฝ ๏€จ110๏€ฉ2
ab1.21 ๏€ฝ ๏€จ110๏€ฉ2 .0.21 ๏€ฝ ๏€จ0000๏€ฉ2
ab2 .2 2 ๏€ฝ ๏€จ110 ๏€ฉ2 .1.2 2 ๏€ฝ ๏€จ11000 ๏€ฉ2
To find the product add ๏€จ110 ๏€ฉ2 and ๏€จ11000 ๏€ฉ2
๏œab ๏€ฝ ๏€จ1.1110๏€ฉ2
3.6.4 The Euclidean Algorithm:
The method described in section 3.5 for computing the greatest
common divisor of two integers , using the prime factorization of
these integers is inefficient. We will give a more efficient method of
finding the greatest common divisor ,called the Euclidean algorithm .
Before describing the Euclidean algorithm , we will show how it
is used to find gcd(91,287). First ,divide 287 by 91 (the larger of the
two integers by the smaller) to obtain
287 = 91*3+14
Any divisor of 91 and 287 must also be a divisor of 287- 91*3 =
14. Also,any divisor of 91 and 14 must also be a divisor of 287 = 91*3
+ 14. Hence , the greatest common divisor of 91 and 287 is the same
as the greatest common divisor of 91 and 14 . This means that the
problem of finding gcd(91 ,287) has been reduced to the problem of
finding gcd(91,14).
Next ,divide 91 by 14 to obtain
91 = 14*6 + 7
Because any common divisor of 91 – 14*6 = 7 and any common
divisor of 14 and 7 divides 91 , it follows that gcd(91,14) = gcd(14,7)
Continuing by dividing 14 by 7, to obtain
14 = 7*2
Because 7 divides 14 ,it follows that gcd(14,7 ) = 7
101
Hence gcd(287,91) = gcd(91,14) = gcd(14,7) = 7
Lemma:
Let a = bq +r , where a ,b and r are integers . Then
gcd(a,b) = gcd(b,r).
Example (25):
Find gcd(414,662) using the Euclidean algorithm.
Solution:
662 = 414*1+ 248
414 = 248*1 + 166
248 = 166*1 + 82
166 = 82*2 + 2
82 = 2*41
Hence , gcd(414,662) = 2
Algorithm (4) The Eculidean Algorithm:
Procedure gcd(a,b: positive integers )
x :=a
y :=b
while y ≠ 0
begin
r := x mod y
x := y
y := r
end {gcd(a,b) is x }
Exercises:
1) Convert these integers from decimal notation to binary
notation :
a) 231
(b) 4532
(c) 97644 (d) 321
102
(e) 1023 (f) 100632
2) Convert these integers from binary notation to decimal
notation :
a)
1 1111 (b) 10 0000 0001 (c) 1 0 101 0101
d) 110 1001 0001 (e) 1 1011 (f) 10 1011 0101
3) Convert these integers from hexadecimal notation to binary
notation :
a) 80E (b) 135AB (c) ABBA (d) DEFACED
4) Convert (๐‘ฉ๐‘จ๐‘ซ๐‘ญ๐‘จ๐‘ช๐‘ฌ๐‘ซ)๐Ÿ๐Ÿ” from its hexadecimal expansion to
its binary expansion .
5) Convert these integers from binary notation to its
hexadecimal notation :
a) 1111 0111
b) 1010 1010 1010
c) 111
0111 0111 0111
6)Convert (a) (๐Ÿ๐ŸŽ๐Ÿ๐Ÿ ๐ŸŽ๐Ÿ๐Ÿ๐Ÿ ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ)๐Ÿ (b) (๐Ÿ ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ ๐ŸŽ๐Ÿ๐Ÿ๐ŸŽ ๐ŸŽ๐ŸŽ๐Ÿ๐Ÿ)๐Ÿ
to their hexadecimal expansions.
7) Convert (๐Ÿ•๐Ÿ‘๐Ÿ’๐Ÿ“๐Ÿ‘๐Ÿ๐Ÿ)๐Ÿ– to its binary expansion and
(๐Ÿ๐ŸŽ ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ)๐Ÿ to its octal expansion .
8) Convert (๐Ÿ๐Ÿ๐Ÿ‘๐Ÿ’๐Ÿ“๐Ÿ”๐Ÿ•๐ŸŽ)๐Ÿ– to its hexadecimal expansion and
(๐‘จ๐‘ฉ๐‘ฉ๐ŸŽ๐Ÿ—๐Ÿ‘๐‘ฉ๐‘จ๐‘ฉ๐‘ฉ๐‘จ)๐Ÿ๐Ÿ” to its octal expansion .
9) Use the Euclidean algorithm to find :
(a) gcd(12,18)
(b) gcd(111,201)
103
(c) gcd(1001,1331)
( d) gcd(12345,54321)
(e) gcd(1000,5040)
(f) gcd(9888,6060)
104
Chapter 4
Boolean Algebra
4.1.1 Boolean Functions:
Introduction :
Boolean algebra provides the operations and the rules for
working with the set (0, 1). Electronic and optical switches can be
studied using this set and the rules of Boolean algebra. The three
operations
in
Boolean
algebra
that
will
use
most
are
complementation, the Boolean sum, and the Boolean product. The
complement of an element, denoted with a bar, is defined by ล = 1
and I = 0.
The Boolean sum, denoted by + or by OR, has the
following values:
1+1 = 1, 0+0=0 , 0+1=1+0 =1
1.1= 1, 1.0 = 0 = 0.1 = 0, 0.0 = 0 ,
Example (1):
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
Find the value of ๐Ÿ. ๐ŸŽ + (๐ŸŽ
+ ๐Ÿ)
Solution:
Using the definitions of complementation, the Boolean sum, and
the Boolean product, it follows that :
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
ฬ… =๐ŸŽ+๐ŸŽ= ๐ŸŽ
๐Ÿ. ๐ŸŽ + (๐ŸŽ
+ ๐Ÿ) = ๐ŸŽ + ๐Ÿ
The
complement,
Boolean
sum,
and
Boolean
product
correspond to the logical operators, ๏ƒ˜, ๏ƒš and ๏ƒ™ respectively where 0
corresponds to F (false) and 1 corresponds to T (true) Equalities in
Boolean algebra can be directly translated into equivalences of
compound propositions can be translated into equalities in Boolean
algebra.
105
Example (2): Translate
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
๐Ÿ. ๐ŸŽ + (๐ŸŽ
+ ๐Ÿ) = ๐ŸŽ,
into a logical
equivalence.
Solution:
We obtain a logical equivalence when we translate each 1 into a
T, each 0 into a F, each Boolean sum into disjunction, each Boolean
product into a conjunction and each complementation into negation,
we obtain
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
๐Ÿ. ๐ŸŽ + (๐ŸŽ
+ ๐Ÿ) = ๐ŸŽ ๏‚บ ๐‘ป๏ƒ™ ๐‘ญ๏ƒš๏ƒ˜ (๐‘ป ๏ƒš ๐‘ญ) ๏‚บ ๐‘ญ
Example (3): Translate the logical equivalence
(๐‘ป ๏ƒ™ ๐‘ป) ๏ƒš ๏ƒ˜ F ๏‚บ T into an identity in Boolean algebra.
Solution: (๐‘ป ๏ƒ™ ๐‘ป) ๏ƒš ๏ƒ˜ F ๏‚บ (1.1) + ล = 1
4.1.2 Boolean Expressions and Boolean Functions:
Def.(1): Let B = (0,1). Then
is the set of all possible n-tuples
of 0s and 1s. The variable x is called a Boolean variable if it assumes
values only from B, that is, if its only possible values are 0 and 1. A
function from to is called a Boolean function of degree ๐’.
๐’‡: ๐‘ฉ๐Ÿ → ๐‘ฉ
ฬ… from the set of ordered
Example (4): The function ๐’‡(๐’™, ๐’š) = ๐’™๐’š
pairs of Boolean variables to the set {๐ŸŽ, ๐Ÿ} is a Boolean function of
degree 2 ,๐’‡(๐Ÿ, ๐Ÿ) = ๐Ÿ. ๐‘ป = ๐Ÿ. ๐ŸŽ = ๐ŸŽ,
ฬ… = ๐Ÿ. ๐Ÿ = ๐Ÿ
๐’‡(๐Ÿ, ๐ŸŽ) = ๐Ÿ. ๐’
ฬ… = ๐ŸŽ. ๐Ÿ = ๐ŸŽ
๐’‡(๐ŸŽ, ๐Ÿ) = ๐ŸŽ. ๐‘ป = ๐ŸŽ. ๐ŸŽ = ๐ŸŽ and ๐’‡(๐ŸŽ, ๐ŸŽ) = ๐ŸŽ. ๐’
๐’™
๐’š
๐’‡(๐’™, ๐’š)
1
1
0
1
0
1
0
1
0
0
0
0
106
Example (5): Find the values of the Boolean function
represented by ๐’‡(๐’™, ๐’š, ๐’›) = ๐’™๐’š + ๐’›ฬ….
Solution: The values of this function are displayed in the given
table
๐’™
๐’š
๐’›
๐’™๐’š
๐’›ฬ…
๐’‡(๐’™, ๐’š, ๐’›) = ๐’™๐’š + ๐’›ฬ…
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
Example (6): The function ๐’‡(๐’™, ๐’š, ๐’›) = ๐’™๐’š + ๐’›ฬ… from ๐‘ฉ๐Ÿ‘ to ๐‘ฉ can
be represented by distinguishing the vertices that correspond to the
five 3-tuples (1,1,1) , (1,1,0), (1,0,0), (0,1,0) and (0,0,0) where
shown in the given figure
107
is
110
111
101
100
010
011
000
001
These vertices are displayed using solid black circles. The Boolean
sum of they function ๐’‡ and ๐’ˆ and Boolean product of ๐’‡ and ๐’ˆ are given
by
1) (๐’‡ + ๐’ˆ)(๐’™๐Ÿ , ๐’™๐Ÿ , … , ๐’™๐’ ) = ๐’‡(๐’™๐Ÿ , ๐’™๐Ÿ , … , ๐’™๐’ ) + ๐’ˆ(๐’™๐Ÿ , ๐’™๐Ÿ , … , ๐’™๐’ )
2) (๐’‡ + ๐’ˆ)(๐’™๐Ÿ , ๐’™๐Ÿ , … , ๐’™๐’ ) = ๐’‡(๐’™๐Ÿ , ๐’™๐Ÿ , ๐’™๐’ ) + ๐’ˆ(๐’™๐Ÿ , ๐’™๐Ÿ , … , ๐’™๐’ )
108
4.1.3 Identities of Boolean algebra:
Boolean identities:
Identity
Name
ฬฟ=๐’™
๐’™
Law of the double complement
๐’™+๐’™=๐’™,
๐’™. ๐’™ = ๐’™
Idempotent lows
๐’™ + ๐ŸŽ = ๐’™,
๐’™. ๐Ÿ = ๐’™
Identity laws
๐’™ + ๐Ÿ = ๐Ÿ,
๐’™. ๐ŸŽ = ๐ŸŽ
Domination laws
๐’™ + ๐’š = ๐’š + ๐’™,
๐’™๐’š = ๐’š๐’™
Commutative laws
๐’™ + (๐’š + ๐’›) = (๐’™ + ๐’š) + ๐’›
Associative laws
๐’™. (๐’š. ๐’›) = (๐’™. ๐’š). ๐’›
(๐’™ + ๐’š๐’›) = (๐’™ + ๐’š)(๐’™ + ๐’›)
Distributive laws
๐’™(๐’š + ๐’›) = ๐’™๐’š + ๐’™๐’›
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
(๐’™๐’š
ฬ…ฬ…ฬ…ฬ…) = ๐’™
ฬ…+๐’š
ฬ…, (๐’™
ฬ…. ๐’š
ฬ…
+ ๐’š) = ๐’™
๐’™ + ๐’™๐’š = ๐’™
Deomorgan’s laws
Absorption laws
๐’™(๐’™ + ๐’š) = ๐’™
ฬ…=๐Ÿ
๐’™+๐’™
Unit property
ฬ…=๐ŸŽ
๐’™. ๐’™
Zero property
109
Example (7):
Translate the distributive law๐’™ + ๐’š๐’› = (๐’™ + ๐’š)(๐’™ + ๐’›) into a
logical equivalenc
Solution :
๐’™ + ๐’š๐’› = (๐’™ + ๐’š)(๐’™ + ๐’›) ≡ ๐’‘๏ƒš(๐’’๏ƒ™๐’“) ≡ (๐’‘๏ƒš๐’’)๏ƒ™(๐’‘๏ƒš ๐’“)
Example (8):
Prove the absorption law ๐’™(๐’™ + ๐’š) = ๐’™ using the other identities
of Boolean algebra.
Solution:
๐’™(๐’™ + ๐’š) = (๐’™ + ๐ŸŽ)(๐’™ + ๐’š) identity law for the Boolean sum
= ๐’™ + ๐ŸŽ. ๐’š distributive law
= ๐’™ + ๐’š. ๐ŸŽ commutative law
=๐’™+๐ŸŽ
domination law
=๐’™
identity law
4.2 Duality:
Def.(2) The dual of a Boolean expression is obtained by
interchanging
Boolean
sums
and
Boolean
products
and
interchanging ๐ŸŽ๐’” and ๐Ÿ๐’” .
Example (9):
Find the duals of (1) ๐’™(๐’š + ๐ŸŽ)
ฬ…. ๐Ÿ + (๐’š
ฬ… + ๐’›)
(2) ๐’™
Solution:
1) ๐’™ + (๐’š. ๐Ÿ)
ฬ… + ๐ŸŽ)(๐’š
ฬ…. ๐’›)
2) (๐’™
Example (10): Construct an identity from the absorption law
๐’™(๐’™ + ๐’š) = ๐’™ by taking duals.
Solution : ๐’™ + ๐’™ . ๐’š = ๐’™
110
4 .3 The abstract definition of a Boolean algebra:
Def. (3): A Boolean algebra is a set
๐‘ฉ with two binary
operations ๐’— and ๐’, elements 0 and 1, and a unary operation such
that these properties hold
∀๐’™, ๐’š∀, ๐’› ∈ ๐‘ฉ
๐’™∨๐’™ = ๐’™
} identity law.
๐’™∧๐’™ = ๐’™
ฬ…=๐Ÿ
๐’™∨๐’™
} Commutative laws.
ฬ…=๐ŸŽ
๐’™∧๐’™
(๐’™๏ƒš๐’š)๏ƒš๐’› = ๐’™๏ƒš(๐’š๏ƒš๐’›)
} Associative laws.
(๐’™๏ƒ™๐’š)๏ƒ™๐’› = ๐’™๏ƒ™(๐’š๏ƒ™๐’›)
๐’™๏ƒš๐’š = ๐’š๏ƒš๐’™
๐’™๏ƒ™๐’š = ๐’š๏ƒ™๐’™} Commutative laws.
๐’™๏ƒš(๐’š๏ƒš ๐’›) = (๐’™๏ƒš ๐’š) ๏ƒ™ (๐’™๏ƒš๐’›)
} Distributive laws.
๐’™๏ƒ™(๐’š๏ƒš ๐’›) = (๐’™๏ƒ™ ๐’›)๏ƒš (๐’™๏ƒ™๐’›)
4.4 Representing Boolean Functions:
Example (11): Find Boolean expressions that represent the
functions ๐’‡(๐’™, ๐’š, ๐’›) and ๐’ˆ(๐’™, ๐’š, ๐’›), which are given in the table
๐’™
๐’š
๐’›
๐’‡
๐’ˆ
1
1
1
0
0
1
1
1
0
0
1
0
1
1
0
1
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
1
0
1
0
0
0
0
0
0
111
Solution :
1) An expression that has the value 1 when ๐’™ = ๐’› = ๐Ÿ and ๐’š =
๐ŸŽ and value
otherwise, is needed to represent ๐’‡. Such an
expression can be formed by taking the Boolean product of
ฬ… and ๐’›.
๐’™, ๐’š
ฬ…๐’› has the value
This product, ๐’™๐’š
ฬ…=
if ๐’™ = ๐’š
๐’› = ๐Ÿ which holds iff ๐’™ = ๐’› − ๐Ÿ and ๐’š = ๐ŸŽ.
2) To represent ๐’ˆ, we need an expression that equals 1 when
๐’™ = ๐’š = ๐Ÿ and ๐’› = ๐ŸŽ or when ๐’™ = ๐’› = ๐ŸŽ and ๐’š = ๐Ÿ. We can
form an expression with these values by taking the Boolean
sum of two different Boolean products. the Boolean product
๐’™๐’š๐’›ฬ… has the value 1 iff ๐’™ = ๐’š = ๐Ÿ and ๐’› = ๐ŸŽ. Similarly, the
ฬ…๐’š๐’›ฬ… has the value 1 iff ๐’™ = ๐’› = ๐ŸŽ and ๐’š = ๐Ÿ. The
product ๐’™
ฬ…๐’š๐’›ฬ… represents ๐’ˆ.
Boolean sum of these two products ๐’™๐’š๐’›ฬ… + ๐’™
Def.(4):
A literal is a Boolean variable or its complement. A
minterm of the Boolean variables ๐’™๐Ÿ , ๐’™๐Ÿ , … . , ๐’™๐’ is the Boolean
product ๐’š๐Ÿ ๐’š๐Ÿ …. ๐’š๐’ where ๐’™๐’Š = ๐’š๐’Š or ๐’š๐’Š = ฬ…
๐’™i. Hence a minterm is
a product of n literals, with one literal for each variable.
Example (12):
Find a minterm that equals 1 if ๐’™๐Ÿ = ๐’™๐Ÿ‘ = ๐ŸŽ
and ๐’™๐Ÿ = ๐’™๐Ÿ’ = ๐’™๐Ÿ“ = ๐Ÿ, and equals 0 otherwise.
Solution:
ฬ…๐Ÿ ๐’™๐Ÿ ๐’™
ฬ…3.๐’™๐Ÿ’ ๐’™๐Ÿ“ has the correct set of values.
The minterm ๐’™
Example (13):
Find the sum-of-products expansion of the function
๐’‡(๐’™, ๐’š, ๐’›) = (๐’™ + ๐’š)๐’›ฬ….
Solution:
๐’‡(๐’™, ๐’š, ๐’›) = (๐’™ + ๐’š)๐’›ฬ…
112
= ๐’™๐’›ฬ… + ๐’š๐’›ฬ… distributive law
= ๐’™๐Ÿ๐’›ฬ… + ๐Ÿ๐’š๐’›ฬ… identity law
ฬ…)๐’›ฬ… + (๐’™ + ๐’™
ฬ…)๐’š๐’›ฬ… unit property
= ๐’™(๐’š + ๐’š
ฬ…๐’›ฬ… + ๐’™๐’š๐’›ฬ… + ๐’™
ฬ…๐’š๐’›ฬ… distributive
= ๐’™๐’š๐’›ฬ… + ๐’™๐’š
law.
ฬ…๐’›ฬ… + ๐’™
ฬ…๐’š๐’›ฬ… idempotent law๐ฌ.
= ๐’™๐’š๐’›ฬ… + ๐’™๐’š
4.5 Logic gates:
Introduction: Boolean algebra is used to model the circuitry
electronic devices. Each input and each output of each device can be
thought of as a member of the set {๐ŸŽ, ๐Ÿ}. A computer, or other
electronic device, is made up of a number of circuits.
x
y
x
Inverter
OR gate
AND gate
X1
X2x
X1+x2+..+xn
Xn
gates with n inputs
4.6 Combinations of Gates:
Example (14):
Construct circuits that produce the following out puts:
ฬ…
(a) (๐’™ + ๐’š)๐’™
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
ฬ… (๐’š
ฬ…๐’š
ฬ…๐’›ฬ…)
(b) ๐’™
+ ๐’›ฬ…) (c) (๐’™ + ๐’š + ๐’›) (๐’™
113
Solution:
a)
(x ( x.y)๐‘ฅฬ…
x
b)
x
(
x
c)
x+y+z
x
Minimization of Circuits:
114
4.7 Minimization of Circuits:
Example (15):
ฬ…๐’›
Minimize and construct the out put circuit ๐’™๐’š๐’› + ๐’™๐’š
Solution:
ฬ…๐’› = (๐’š + ๐’š
ฬ…)๐’™๐’›
๐’™๐’š๐’› + ๐’™๐’š
= ๐Ÿ. ๐’™๐’›
= ๐’™๐’›
4.8 Karnaugh Maps:
To reduce the number of terms in a Boolean expression
representing a circuit, it is necessary to find terms to combine. There
is a graphical method, called a Karnaugh map or K-map for finding
terms to combine for Boolean functions involving a relatively small
number of variables.
Example (2): Find the K-maps for:
ฬ…๐’š
(a) ๐’™๐’š + ๐’™
ฬ…+๐’™
ฬ…๐’š
(b) ๐’™๐’š
ฬ…+๐’™
ฬ…๐’š + ๐’™
ฬ…๐’š
ฬ…
(c) ๐’™๐’š
115
Solution:
๐’š
ฬ…
๐’š
๐’™
1
1
ฬ…
๐’™
1
ฬ…
๐’š
๐’š
๐’™
๐’™
1
ฬ…
๐’™
ฬ…
๐’™
1
(a)
ฬ…
๐’š
๐’š
1
1
(b)
1
(c)
Example (16): Simplify the sum-of-products expansion for
ฬ…๐’š
(a) ๐’™๐’š + ๐’™
ฬ…+๐’™
ฬ…๐’š
(b) ๐’™๐’š
ฬ…+๐’™
ฬ…๐’š+ ๐’™
ฬ…๐’š
ฬ…
(c) ๐’™๐’š
ฬ…๐’š = (๐’™ + ๐’™
ฬ…)๐’š = ๐Ÿ. ๐’š = ๐’š
Solution : (a) ๐’™๐’š + ๐’™
ฬ…+ ๐’™
ฬ…๐’š = ๐’™๐’š
ฬ…+๐’™
ฬ…๐’š
b) ๐’™๐’š
ฬ…+๐’™
ฬ…๐’š + ๐’™
ฬ…๐’š
ฬ… = ๐’™๐’š
ฬ…+๐’™
ฬ…(๐’š + ๐’š
ฬ…)
c) ๐’™๐’š
ฬ…+๐’™
ฬ…. ๐Ÿ
= ๐’™๐’š
ฬ…+ ๐’š
ฬ…
= ๐’™
Example (17): Use the K-maps to minimize these sum-ofproducts expansions
ฬ…๐’›ฬ… + ๐’™
ฬ…๐’š๐’› + ๐’™
ฬ…๐’š
ฬ…๐’›ฬ…
a) ๐’™๐’š๐’›ฬ… + ๐’™๐’š
ฬ…๐’› + ๐’™๐’š
ฬ…๐’›ฬ… + ๐’™
ฬ…๐’š๐’› + ๐’™
ฬ…๐’š
ฬ…๐’› + ๐’™
ฬ…๐’š
ฬ…๐’›ฬ…
b) ๐’™๐’š
ฬ…๐’› + ๐’™๐’š
ฬ…๐’›ฬ… + ๐’™
ฬ…๐’š๐’› + ๐’™
ฬ…๐’š
ฬ…๐’› + ๐’™
ฬ…๐’š
ฬ…๐’›ฬ…
c) ๐’™๐’š๐’› + ๐’™๐’š๐’›ฬ… + ๐’™๐’š
ฬ…๐’›ฬ… + ๐’™
ฬ…๐’š
ฬ…๐’› + ๐’™
ฬ…๐’š
ฬ…๐’›ฬ…
d) ๐’™๐’š๐’›ฬ… + ๐’™๐’š
Solution:
๐’š๐’›
๐’™
ฬ…
๐’™
1
๐’š๐’›ฬ…
ฬ…๐’›ฬ…
๐’š
ฬ…๐’›
๐’š
1
1
๐’™
1
ฬ…
๐’™
๐’š๐’›
ฬ…๐’›ฬ… + ๐’™
ฬ…๐’š๐’›
(a) ๐’™๐’›ฬ… + ๐’š
๐’š๐’›ฬ…
1
ฬ…+๐’™
ฬ…๐’›
(b) ๐’š
116
ฬ…๐’›ฬ…
๐’š
ฬ…๐’›
๐’š
1
1
1
1
๐’š๐’›
๐’š๐’›ฬ…
ฬ…๐’›ฬ…
๐’š
ฬ…๐’›
๐’š
๐’™
1
1
1
1
๐’™
ฬ…
๐’™
1
1
1
ฬ…
๐’™
๐’š๐’›
ฬ…+ ๐’›
(c) ๐’™ + ๐’š
๐’š๐’›ฬ…
ฬ…๐’›ฬ…
๐’š
1
1
ฬ…๐’›
๐’š
1
1
ฬ…๐’š
ฬ…
(d) ๐’™๐’›ฬ… + ๐’™
Exercises:
1) Find the output of the given circuits:
x
y
a)
y
x
b)
y
x
y
c)
z
x
2) Construct circuits from inverters, AND gates and OR gates to
produce these out puts.
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
ฬ… + ๐’š (b) (๐’™
(a) ๐’™
+ ๐’š)๐’™
ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…ฬ…
ฬ…๐’š
ฬ…๐’›ฬ… (d) (๐’™
ฬ… + ๐’›)(๐’š + ๐’›ฬ…)
(c) ๐’™๐’š๐’› + ๐’™
117
3) Draw a k–map for a function in two variables and put a 1 in the
ฬ…๐’š
cell representing ๐’™
4) Draw the k–maps of these sum-of-products expansions in two
variables:
ฬ… (b) ๐’™๐’š + ๐’™
ฬ…๐’š
ฬ…
(a) ๐’™๐’š
ฬ…+๐’™
ฬ…๐’š + ๐’™
ฬ…๐’š
ฬ…
(c) ๐’™๐’š + ๐’™๐’š
118
Chapter 5
An Introduction to Graph Theory
Def.(1): A graph ๐‘ฎ = (๐‘ฝ, ๐‘ฌ) consists of ๐‘ฝ, a nonempty set of vertices
(nodes) and ๐‘ฌ, a set of edges. Each edge has either one or two vertices
associated with it , called its endpoints. An edge is said to connect the end
points.
Remark:
The set of vertices ๐‘ฝ of a graph ๐‘ฎ may be finite. A
graph with an infinite vertex set is called an infinite graph, and in
comparison, a graph with a finite vertex set is called a finite graph,
here we consider only finite graphs.
Now suppose that a network is made up of data centers and
communication links between computers.
We can represent the
location of each data center by a point and each communication link
by a line segment as shown in the figure
Hafralbatin
Demam
Riadh
Jedda
Medina
Hafoof
Mekka
This computer network can be modeled using a graph in which
the vertices of the graph represent the data centers and edges
represent communication links.
A graph in which each edge
connects two different vertices and where no two edges connect the
same pair of vertices is called a simple graph.
119
Def.(2): A directed graph (diagraph) (๐‘ฝ, ๐‘ฌ)consists of nonempty
set of vertices ๐‘ฝ and a set of directed edges (or arcs) ๐‘ฌ, each directed
edge is associated with an ordered pair of vertices. The directed edge
associated with the ordered pair (๐’–, ๐’—) is said to start a ๐’– and end at
๐’—.
A graph with no loops and has no simple directed edges is called
a simple directed graph.
5 .1 Basic Terminology:
Def.(3):
Two vertices ๐’– and ๐’— in an undirected graph ๐‘ฎ are called
adjacent (neighbours) in ๐‘ฎ if ๐’– and ๐’— are endpoints of an edge of ๐‘ฎ.
If ๐’† is associated with {๐’–, ๐’—} the edge e is called incident with the
vertices ๐’– and ๐’—. The edge ๐’† is also said to connect ๐’– and ๐’—. The
vertices ๐’– and ๐’— called end points of an edge associated with {๐’–, ๐’—}.
Def.(4):
The degree of a vertex in an undirected graph is the number of
edges incident with it, except that a loop at a vertex contributes twice
to the degree of that vertex. The degree of the vertex ๐’— is denoted by
deg (๐’—).
Example (1):
What are the degrees of the vertices in the graphs ๐‘ฎ and ๐‘ฏ in the
given figures
c
b
a
f
d
b
a
d
e
e
G
120
c
H
Solution:
In ๐‘ฎ โˆถ deg (๐’‚) = 2, deg (๐’ƒ) = deg (๐’„)= deg (๐’‡)= 4 , deg (๐’…) = 1
and deg (๐’ˆ) = 0.
In ๐‘ฏ โˆถ deg (๐’‚) = 4, deg (๐’ƒ) = deg (๐’†)= 6, deg (๐’„) = 1 and deg (๐’…) =
5.
A vertex of degree zero is called isolated, a vertex is pendant iff it
has degree one.
Example (2):
What does the degree of a vertex in a niche overlap graph
represents? Which vertices in this graph are pendant and which are
isolated in the given figure
Owl
Raccoon
Hawk
Squirrel
Opossum
Crow
Shrew
Mouse
Wood pecker
Solution:
There is an edge between two vertices in a niche overlap graph
iff the two species represented by these vertices complete. Hence, the
degree of a vertex in a niche overlap graph is the number of species
in the ecosystem that complete with the species represented by this
vertex.
121
The degree of the vertex representing the squirrel is 4 because
the squirrel competes with four other species:
the crow, the
opossum, the raccoon and the wood pecker. The mouse is the only
species represented by a pendant vertex. The vertex representing a
species is pendant if this species competes with only one other species.
There are no isolated vertices.
Theorem(1): (The handshaking theorem)
Let ๐‘ฎ = (๐‘ฝ, ๐‘ฌ) be an undirected graph with ๐’† edges. Then
๐Ÿ๐’† = ∑ ๐๐ž๐ (๐’—)
๐’—∈๐‘ฝ
Example (3): How many edges are there in a graph with 10
vertices each of degree 6?
Solution: Because the sum of the degrees of the vertices is 6.10
= 60, it follows that 2e = 60 ๏ƒž e = 30.
Theorem(2): An undirected graph has an even number of
vertices of odd degrees.
5 .2 Some Special Simple Graphs:
Example (4): (Complete graphs)
The complete graph on n
vertices, denoted by ๐’Œ๐’ , is the simple graph that contains exactly one
edge between each pair of district vertices as shown in the figures:
.
k1
.
.
k2
k3
k4
122
k5
k6
Example (5): (cycles)
The cycles ๐‘ช๐’ , ๐’ ≥ ๐Ÿ‘, consists of n vertices ๐’—๐Ÿ , ๐’—๐Ÿ … , ๐’—๐’ and
edges {๐’—๐Ÿ , ๐’—๐Ÿ } , {๐’—๐Ÿ , ๐’—๐Ÿ‘ } … , {๐’—๐’−๐Ÿ , ๐’—๐’ } ๐’‚๐’๐’… {๐’—๐’ , ๐’—๐Ÿ } .The cycles ๐‘ช๐Ÿ‘ , ๐‘ช๐Ÿ’ ,
๐‘ช๐Ÿ“ , ๐’‚๐’๐’… ๐‘ช๐Ÿ” , are displayed in the figure:
c3
c4
c5
c6
Example (6): (wheels) We obtain the wheel ๐‘พ๐’ when we add
additional vertex to the cycle ๐’„๐’ ๐’‡๐’๐’“ ๐’ ≥ ๐Ÿ‘ and connect this new
vertex to each of n vertices in ๐’„๐’ ,
by new edges th wheels
๐‘พ๐Ÿ‘ , ๐‘พ๐Ÿ’ , ๐‘พ๐Ÿ“ , ๐‘พ๐Ÿ” , are displayed in the figure:
๐‘พ๐Ÿ‘
๐‘พ๐Ÿ’
๐‘พ๐Ÿ“
๐‘พ๐Ÿ”
Example (7): (n-cubes)
The n-dimentional hypercuble or n-cube, denoted by ๐‘ธ๐’ is the
graph that has vertices representing the ๐Ÿ๐’ bit strings of length n.
110
0
๐‘ฎ๐Ÿ
1
111
11
10
101
100
010
011
01
00
000
๐‘ฎ๐Ÿ
001
๐‘ฎ๐Ÿ‘
123
5.3 Bipartite graphs:
Def.(5): A simple graph ๐‘ฎ is called bipartite if its vertex set V
can be partitioned into two disjoint sets ๐‘ฝ๐Ÿ and ๐‘ฝ๐Ÿ such that every
edge in the graph connects a vertex in ๐‘ฝ๐Ÿ and a vertex in ๐‘ฝ๐Ÿ . When
this condition holds, we call the pair (๐‘ฝ๐Ÿ , ๐‘ฝ๐Ÿ ) a bipartition of the
vertex set ๐‘ฝ of ๐‘ฎ.
In example (3) ๐’„๐Ÿ” is a bipartite.
Example (8):
๐’„๐Ÿ” in the given figure is
bipartite because its vertex
set can be partitioned into
the two sets ๐‘ฝ๐Ÿ = {๐’—๐Ÿ , ๐’—๐Ÿ‘ , ๐’—๐Ÿ“ }
and ๐‘ฝ๐Ÿ = {๐’—๐Ÿ , ๐’—๐Ÿ’ , ๐’—๐Ÿ” }
and
every edge of ๐’„๐Ÿ” connects a
vertex in ๐‘ฝ๐Ÿ and a vertex in
๐‘ฝ๐Ÿ .
Theorem(3):
In every graph , the number of nodes with odd degree is even .
Proof: We start with a graph with no edges in which every degree is 0
And so the number of nodes with odd degree is 0 , which is an even
number.
(1) If we connect two nodes by a new edge , we change the parity of
the degrees at these nodes . In particular, if both endpoints of
124
the new edge have even degree , we increase the number of
nodes with odd degree by 2 .
(2) If both endpoints of the new edge had odd degree , we decrease
the number of nodes with odd degree by 2. ,
(3) If one endpoint of the new edge had even degree and the other
had odd degree.
Thus if the number of nodes with odd degree was even before
adding the new edge, it remained even after this step .This proves
the theorem.
Theorem (4): (a) A graph G is a tree if and only if it is connected , but
deleting any of its edges , results in a disconnected graph .
(b) A graph G is a tree if and only if it contains no cycle , but
adding any new edge creates a cycle.
Theorem (5): Every tree on n nodes has n-1 edge.
5. 4 Representing Graphs and Graph Isomorphism:
Representing Graphs ; One way to represent a graph without
multiple edges is to list all the edges of this graph. Another way to
represent a graph with no multiple edges is to use adjacency lists,
which specify the vertices that are adjacent to each vertex of the
graph.
125
Table ( 1)An adjacency list for a simple graph
b
vertex
Adjacency
vertices
c
a
e
d
a
b, c, e
b
a
c
a, d, c
d
c, e
e
a, c, d
Example (9):
Use adjacency lists to describe the simple graph given in the
above figure.
Solution: Table 1 lists those vertices adjacent to each of the
vertices of the graph.
Example (10): Represent the directed graph shown in figure (2)
by listing all the vertices that are the terminal vertices of edges
starting at each vertex of the graph
Initial vertex Terminal
b
vertices
a
c
e
a
b, c, d, e
b
b, d
c
a, c, e
d
d
e
directed graph
Figure (2)
126
b, c, d
Solution: Table (2) represent the directed graph shown in figure
(2) above.
5.5 Adjacency Matrices:
The adjacency matrix ๐‘จ of ๐‘ฎ with respect to the listing of
vertices, is the
๐’ × ๐’ zero-one matrix with 1 as its (๐’Š, ๐’‹)๐’•๐’‰ entry
when ๐’—๐’Š and ๐’—๐’‹ are adjacent, and 0 as its (๐’Š, ๐’‹)๐’•๐’‰ entry when they are
not adjacent
๐Ÿ
๐’‚๐’Š๐’‹ = {
๐ŸŽ
๐‘จ = [๐’‚๐’Š๐’‹ ] , then
if {๐’—๐’Š , ๐’—๐’‹ } is edge of ๐‘ฎ
otherwise
Example (11): Use an adjacency matrix to represent the graph
shown in the figure :
a
b
c
d
Solution:
We order the vertices as a, b, c, d. The matrix representing this
graph is
0
1
1
[1
1
0
1
0
1
1
0
0
1
0
0
0]
Example (12):
Draw the graph with this adjacency matrix
0
1
1
[0
1
0
0
1
1
0
0
1
127
0
1
1
0]
with respect to the ordering of vertices a, b, c, d.
a
b
c
d
Figure (4)
Example (13):
Use an adjacency matrix to represent the pseudograph shown in
figure (5)
a
b
c
d
Figure (5)
A Pseudograph
Solution:
The adjacency matrix using the ordering of vertices a, b, c, d is
0
3
0
[2
3
0
1
1
0
1
1
2
2
1
2
0]
5.6 Incidence Matrices:
Another common way to represent graphs is to use incidence
matrices.
Let ๐‘ฎ = (๐‘ฝ, ๐‘ฌ) be an undirected graph.
Suppose that
๐’—๐Ÿ , ๐’—๐Ÿ , … , ๐’—๐’ are vertices and ๐’†๐Ÿ , ๐’†๐Ÿ , … , ๐’†๐’Ž are the edges of ๐‘ฎ. Then
128
the incidence matrix with respect to this ordering of ๐‘ฝ and ๐‘ฌ is the
๐’ × ๐’Ž matrix ๐‘ด = [๐’Ž๐’Š๐’‹ ], where
๐Ÿ ๐ฐ๐ก๐ž๐ง ๐ž๐๐ ๐ž ๐’†๐’‹ ๐ข๐ฌ ๐ข๐ง๐œ๐ข๐๐ž๐ง๐ญ ๐ฐ๐ข๐ญ๐ก ๐’—๐’Š
๐’Ž๐’Š๐’‹ = {
๐ŸŽ ๐จ๐ญ๐ก๐ž๐ซ๐ฐ๐ข๐ฌ๐ž
Example (14):
Represent the graph shown in figure 6 with an incidence matrix.
Solution:
The incidence matrix is:
๐’†๐Ÿ ๐’†๐Ÿ ๐’†๐Ÿ‘ ๐’†๐Ÿ’ ๐’†๐Ÿ“
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ
[๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐Ÿ
๐’†๐Ÿ”
๐ŸŽ
๐Ÿ
๐Ÿ
๐ŸŽ
๐ŸŽ]
Figure 7
A Pseudo graph
Example (15):
Represent the pseudo graph shown in the figure using incidence
matrix
v1 e2 v2
e1
e3
e4
e7
v3
e5
e6
v4
v5
e8
๐’†๐Ÿ ๐’†๐Ÿ ๐’†๐Ÿ‘ ๐’†๐Ÿ’ ๐’†๐Ÿ“
๐’†๐Ÿ” ๐’†๐Ÿ• ๐’†๐Ÿ–
๐Ÿ
๐ŸŽ
๐ŸŽ
๐ŸŽ
[๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐Ÿ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐ŸŽ]
A Pseudograph
5.7 Isomorphism of Graphs:
Def.(6):
The simple graphs ๐‘ฎ๐Ÿ = (๐‘ฝ๐Ÿ , ๐‘ฌ๐Ÿ ) and ๐‘ฎ๐Ÿ = (๐‘ฝ๐Ÿ , ๐‘ฌ๐Ÿ )
are isomorphic if there is a one-to-one and onto function from ๐‘ฝ๐Ÿ to
129
๐‘ฝ๐Ÿ with the property that ๐’‚ and ๐’ƒ are adjacent in ๐‘ฎ๐Ÿ iff ๐’‡(๐’‚) and
๐’‡(๐’ƒ) are adjacent in ๐‘ฎ๐Ÿ
∀๐’‚, ๐’ƒ ∈ ๐‘ฝ๐Ÿ .
such function f is called
isomorphism.
Example (16):
Show that the graphs ๐‘ฎ = (๐‘ฝ, ๐‘ฌ) and ๐‘ฏ = (๐‘พ, ๐‘ญ), displayed in
figure 8, are isomorphic.
G
Solution:
The
function
f
with
๐’‡(๐’–๐Ÿ ) = ๐’—๐Ÿ , ๐’‡(๐’–๐Ÿ ) = ๐’—๐Ÿ’ , ๐’‡(๐’–๐Ÿ‘ ) =
๐’—๐Ÿ‘ , ๐’‡(๐’–๐Ÿ’ ) = ๐’—๐Ÿ is one-to-one correspondence between V and W. To
see that this correspondence presents adjacency, note that adjacent
vertices in ๐‘ฎ are ๐’–๐Ÿ and ๐’–๐Ÿ , ๐’–๐Ÿ and ๐’–๐Ÿ‘ , ๐’–๐Ÿ and ๐’–๐Ÿ’ , and ๐’–๐Ÿ‘ and ๐’–๐Ÿ’ ,
and each of the pairs ๐’‡(๐’–๐Ÿ ) = ๐’—๐Ÿ and ๐’‡(๐’–๐Ÿ ) = ๐’—๐Ÿ’ , ๐’‡(๐’–๐Ÿ ) = ๐’—๐Ÿ and
๐’‡(๐’–๐Ÿ‘ ) = ๐’—๐Ÿ‘ ,
๐’‡(๐’–๐Ÿ ) = ๐’—๐Ÿ’ and ๐’‡(๐’–๐Ÿ’ ) = ๐’—๐Ÿ and ๐’‡(๐’–๐Ÿ‘ ) = ๐’—๐Ÿ‘ and
๐’‡(๐’–๐Ÿ’ ) = ๐’—๐Ÿ are adjacent in H .
Example (17):
Show that the graphs displayed in the figure
isomorphic.
G
H
130
are not
Solution:
Both G and H have five vertices and six edges. However, H has
a vertex of degree one, namely e, whereas G has no vertices of degree
one. It follows that G and H are not isomorphic.
Exercises:
In exercise 1 – 3 find the number of vertices, the number of edges,
and the degree of each vertex in the given undirected graph
b
a
a
c
b
1)
f
e
e
.d
a
.f
2)
c
b
i
h
d
c
.d
g
3)
4) Draw these graphs:
(a) ๐‘ฒ๐Ÿ•
(b) ๐‘ฒ๐Ÿ,๐Ÿ–
(c) ๐‘ฒ๐Ÿ’,๐Ÿ’
(d) ๐‘ช๐Ÿ•
(e) ๐‘พ๐Ÿ•
(f) ๐‘ธ๐Ÿ’
131
5) In Exercises 1 – 4 use an adjacency list to the given graph
a
c
b
a
d
d
b
c
1)
e
2)
a
c
b
a
b
3)
c
4)
e
d
d
6) Draw a graph with the given adjacency matrices
a)
๐ŸŽ ๐Ÿ
[๐Ÿ ๐ŸŽ
๐ŸŽ ๐Ÿ
๐ŸŽ
๐Ÿ]
๐ŸŽ
(b)
๐ŸŽ
[๐ŸŽ
๐Ÿ
๐Ÿ
๐ŸŽ
๐ŸŽ
๐Ÿ
๐Ÿ
๐Ÿ
๐Ÿ
๐ŸŽ
๐Ÿ
๐Ÿ
๐ŸŽ]
๐Ÿ
๐ŸŽ
5.8.1 Paths: A path is a sequence of edges that begins at a vertex
of a graph and travels from vertex to vertex along edges of the graph.
Def. (7):
Let n be a nonnegative integer and G an undirected
graph. A path of length n from u to v in G is a sequence of n edges
๐’†๐Ÿ , ๐’†๐Ÿ , … , ๐’†๐’ of G such that ๐’†๐Ÿ is associated with {๐’™๐ŸŽ , ๐’™๐Ÿ },
๐’†๐Ÿ is
associated with {๐’™๐Ÿ , ๐’™๐Ÿ } and so on, with ๐’†๐’ associated with {๐’™๐’−๐Ÿ , ๐’™๐’ }
where ๐’™๐ŸŽ = ๐’– and ๐’™๐’ = ๐’—. When the graph is simple we denote this
path by its vertex sequence ๐’™๐ŸŽ , ๐’™๐Ÿ , … , ๐’™๐’ . The path is a circuit if it
begins and end at the same vertex, that is, if u = v, and has length
greater than zero. The path or circuit is said to pass through the
vertices ๐’™๐Ÿ , ๐’™๐Ÿ , … , ๐’™๐’−๐Ÿ or traverse the edges ๐’†๐Ÿ , ๐’†๐Ÿ , … , ๐’†๐’ . A path or
circuit is simple if it does not contain the same edge more than once.
132
Example (18):
In the simple graph in the figure
a
b
c
d
e
f
Simple graph
a, d, c, e, f is a simple path of length 4, because {๐’‚, ๐’…}, {๐’…, ๐’„},
{๐’„, ๐’‡} and {๐’‡, ๐’†} are all edges.
However, d, e, c, a is not a path, because {๐’†, ๐’„} is not an edge. Note
that b, c, f, e, b is a circuit of length 4 because {๐’ƒ, ๐’„}, {๐’„, ๐’‡}, {๐’‡, ๐’†} and
{๐’†, ๐’ƒ} are edges, and this path begins and ends at b. The path a, b, e, d,
a, b which is of length 5, is not simple because it contains the edge
{๐’‚, ๐’ƒ} twice.
5.8.2 Connectedness in Undirected Graphs:
Def. (8): An undirected graph is called connected if there is a
path between every pair of distinct vertices of the graph.
Thus, any two computers in the network can communicate iff
the graph of this network is connected.
133
Example (19):
The graph ๐‘ฎ๐Ÿ in the given figure:
c
f
b
a
b
a
c
e
d
d
e
f
is connected, because for every pair of d distinct vertices there is a
path between them. However, the graph ๐‘ฎ๐Ÿ in the figure is not
connected. There is no path in ๐‘ฎ๐Ÿ between vertices a and d.
Theorem (3):
There is a simple path between every pair of distinct vertices of
a connected undirected graph.
A connected component of a graph G is a connected subgraph of
G that is not proper subgraph of another connected subgraph of G.
That is, a connected component of a graph G is a maximal connected
subgraph of G. a graph G that is not connected has two or more
connected components that are disjoint and have G as their union.
134
Example (20):
What are the connected components of the graph H shown in the
figure:
๐ป2
๐ป1
b
d
e
๐ป3
a
f
c
e
g
The connected components ๐‘ฏ๐Ÿ , ๐‘ฏ๐Ÿ and ๐‘ฏ๐Ÿ‘
Solution:
The graph H is the union of three disjoint connected subgraphs
๐‘ฏ๐Ÿ , ๐‘ฏ๐Ÿ and ๐‘ฏ๐Ÿ‘ .
These
three subgraphs are the connected
components of H.
5.8.3 Connectedness in directed graphs:
Def. (9): A directed graph is strongly connected if there is a
path from a to b and from b to a whenever a and b are vertices in the
graph.
Def. (10):
A directed graph is weakly connected if there is a
path between every two vertices in the underlying undirected graph.
That is, a directed graph is weakly connected iff there is always
a path between two vertices when the directions of the edges are
disregarded. Any strongly connected directed graph is also weakly
connected.
135
h
Example (21):
Are the directed graphs G and H shown in the figure:
a
b
b
a
c
e
G
c
e
d
H
d
The directed graphs G and H.
Strongly connected?. Are they weakly connected?
Solution:
G is strongly connected because there is a path between any two
vertices in this directed graph (verify).
Hence, G is also weakly
connected. The graph H is not strongly connected. There is no
directed path from a to b in this graph.
However, H is weakly
connected, because there is a path between any two vertices in the
underlying undirected graph of H (verify).
5.8.4 Counting paths between vertices:
The number of paths between two vertices in a graph can be
determined using its adjacency matrix.
Example (22):
Let G be a graph with adjacency matrix A with respect to the
ordering ๐’—๐Ÿ , ๐’—๐Ÿ , … , ๐’—๐’ (with directed or undirected edges, with
multiple edges and loops allowed). The number of different paths of
length ๐’“ from ๐’—๐’Š to ๐’—๐’‹ , where ๐’“ is a positive integer, equals the (i, j)th
entry of ๐‘จ๐’“ .
136
Example (23):
How many paths of length 4 are there from a to d in the simple
graph G in the figure
a
b
c
d
Figure
Solution:
The adjacency matrix of G (ordering the vertices as a, b, c, d) is
0
1
๐‘จ=
1
[0
1
0
0
1
1
0
0
1
0
1
1
0 ]
Hence, the number of paths of length 4 from a to d is the (1,4)th
entry of A4.
8
0
๐‘จ๐Ÿ’ =
0
[8
0
8
8
0
0
8
8
0
8
0
0
8 ]
Because there are exactly eight paths of length 4 from a to d. By
inspection of the graph, we see that a, b, a, b, d; a, b, a, c, d; a, b, d, b,
d; a, b, d, c, d; a, c, a, c, d; a, c, d, b, d; and a, c, d, c, d are the eight
paths from a to d.
137
5.9 .1 Eulr and Hamilton Paths:
Def. (11):
An Euler circuit in a graph G a simple circuit
containing every edge of G. An Euler path in G is a simple path
containing every edge of G.
Example(24):Which of the undirected graphs in the figure have
an Euler circuit? Of those that do not, which have an Euler path?
a
b
a
e
d
b
a
b
c
d
c
e
c
d
e
Solution: The graph ๐‘ฎ๐Ÿ has an Euler circuit, for example, a, e, c,
d, e, b, a.
Neither of the graphs ๐‘ฎ๐Ÿ or ๐‘ฎ๐Ÿ‘ has an Euler circuit
(verify). However, ๐‘ฎ๐Ÿ‘ has an Euler path, namely, a, c, d, e, b, d, a, b.
๐‘ฎ๐Ÿ does not have an Euler path (verify).
138
Example (25): Which of the directed graphs in the figure have
an Euler circuit? Of those that do not, which have an Euler path?
a
a
b
d
c
b
f
e
d
c
d
a
b
Solution: The graph H2 has an Euler circuit, for example, a, g, c,
b, g, e, d, f, a. Neither H1 nor H3 has an Euler circuit (verify). H3 has
an Euler path namely, c, a, b, c, d, b, but H1 does not (verify)
5.9.2 Hamilton Paths and Circuits:
Def.(12): A simple path in a graph G that passes through every
vertex exactly once is called a Hamilton path, and a simple circuit in
a graph G that passes through every vertex exactly once is called a
Hamilton circuit. That is, the simple path ๐’™๐ŸŽ , ๐’™๐Ÿ , … , ๐’™๐’ in the graph
๐‘ฎ = (๐‘ฝ, ๐‘ฌ) is a Hamilton path if ๐‘ฝ = {๐’™๐ŸŽ , ๐’™๐Ÿ , … , ๐’™๐’ } and ๐’™๐’Š ≠ ๐’™๐’‹ for
๐ŸŽ ≤ ๐’Š < ๐‘— ≤ ๐‘›, and the simple circuit๐’™๐ŸŽ , ๐’™๐Ÿ , … , ๐’™๐’ , (๐’ >
0)๐ข๐ฌ ๐š ๐‡๐š๐ฆ๐ข๐ฅ๐ญ๐จ๐ง ๐œ๐ข๐ซ๐œ๐ฎ๐ข๐ญ if ๐’™๐ŸŽ , ๐’™๐Ÿ , … , ๐’™๐’ is a Hamilton path.
Example (26): Which of the simple graphs in the figure have a
Hamilton circuit or, if not, a Hamilton path?
b
a
c
e
a
b
a
b
d
c
d
c
Simple graphs
d
139
e
f
Solution: ๐‘ฎ๐Ÿ has a Hamilton circuit a, b, c, d, e, a. There is no
Hamilton circuit in ๐‘ฎ๐Ÿ (this can be seen by noting that any circuit
containing every vertex must contain the edge {๐’‚, ๐’ƒ} twice), but
๐‘ฎ๐Ÿ does have a Hamilton path, namely, a, b, c, d. ๐‘ฎ๐Ÿ‘ has neither a
Hamilton circuit nor a Hamilton path, because any path containing
all vertices must contain one of the edges {๐’‚, ๐’ƒ}, {๐’†, ๐’‡} and {๐’„, ๐’…} more
than once.
Example (27): Show that neither graph displayed in the given
figure has aa Hamiltondcircuit. e
d
a
c
b
c
b
G
e
H
Solution: There is no Hamilton circuit in G because G has a
vertex of degree one, namely, e.
Now consider H.
Because the
degrees of vertices a, b, d and e are all two, every edge incident with
these vertices must be part of any Hamilton circuit. It is now easy to
see that no Hamilton circuit can exist in H, for any Hamilton circuit
would have to contain four edges incident with c, which is impossible.
Theorem (4): (Dirac’s Theorem) If G is a simple graph with n
vertices with ๐’ ≥ ๐Ÿ‘ such that the degree of every vertex in G is at
least ๐’/๐Ÿ , then G has a Hamilton circuit.
Theorem (5): (Ore’s Theorem) If G is a simple graph with n
vertices with ๐’ ≥ ๐Ÿ‘ such that deg(u) + deg(v)
n for every pair of
nonadjacent vertices u and v in G, then G has a Hamilton circuit.
140
5.10 Planar Graphs:
Def. (13):
A graph is called planar if it can be drawn in the plane without
any edges crossing (where a crossing of edges is the intersection of the
lines or arcs representing them at a point other than their common
endpoint). Such a drawing is called a planar representation of the
graph.
A graph may be planar even if it is usually drawn with
crossings, because it may be possible to draw it in a different way
without crossings.
Example (28):
Is K4 (shown in the given figure with two edges crossing)
planar?
K4
K4
drawn with no crossings.
Solution: K4 is planar because it can be drawn without crossings.
Example (29): Is Q3, shown in the given figure, planar?
Q3
Aplanar
representing of Q3
141
Solution:
Q3 is planar, because it can be drawn without any edges
crossing.
Theorem(6):
(Euler’s Formula): Let G be a connected planar simple graph
with e edges and v vertices. Let r be the number of regions in a
planar representation of G. Then r = e – v + 2.
Example (30):
Suppose that a connected planar simple graph has 20 vertices,
each of degree 3. Into how many regions does a representation of this
planar graph split the plane?
Solution:
This graph has 20 vertices, each of degree 3, so v = 20. Because
of the sum of the degrees of the vertices, 3v = 3.20 = 60, is equal to
twice the number of edges, 2e we have 2e = 60 ๏ƒž e = 30.
Consequently, from Euler’s formula, the number of regions is:
r = e – v + 2 = 30 – 20 + 2 = 12.
Corollary (1):
If G is a connected planar simple graph with e edges and v
vertices, where ๐’— ≥ ๐Ÿ‘, then ๐’† ≤ ๐Ÿ‘๐’— − ๐Ÿ”.
Corollary (2):
If G is a connected planar simple graph, then G has a vertex of
degree not exceeding five.
Example (31):
Show that K5 is nonplanar using corollary (1)
142
Solution:
The graph K5 has vertices and 10 edges.
However, the
inequality ๐’† ≤ ๐Ÿ‘๐’— − ๐Ÿ” is not satisfied for this graph because e = 10
and ๐Ÿ‘๐’— − ๐Ÿ” = ๐Ÿ— (๐Ÿ๐ŸŽ ≤ ๐Ÿ—). Therefore, K5 is not planar.
Corollary (3):
If a connected planar simple graph has e edges and v vertices
with ๐’— ≥ ๐Ÿ‘ and no circuits of length 3 , then
๐’† ≤ ๐Ÿ๐’— − ๐Ÿ’
Example (32):
Use corollary( 3) to show that K3.3 is nonplanar.
Solution:
Because K3.3 has no circuits of length 3 (this is easy to see
because it is bipartite), corollary (3) can be used. K3.3 has 6 vertices
and 9 edges. Because e=9 and 2v-4 = 8
K3.3 is non planar.
Exercises:
1) Does each of these lists of vertices form a path in the following
graphs? Which paths are simple? Which are circuits? What
are the lengths of those that are paths?
(a) a, e, b, c, b
(b) a, e, a, d, b, c, a
(c) e, b, a, d, b, e
(d) c, b, d, a, e, c
2) Determine whether the given graph is connected
143
3) Determine whether the given graph has an Euler circuit.
construct such a circuit when one exists. If no Euler circuit
exists, determine whether the graph has an Euler path and
construct such a path if one bexists.
c
a
d
e
4) Does the graph have a Hamilton path? If so find, such a path.
If it doesnot, give an argument to show why no such path exists
d
a
c
f
e
b
144
Chapter 6
Counting
6.1 Basic Counting Principles:
We will present two basic counting principles, the product rule
and the sum rule.
The Production Rule:
The product rule applies when a
procedure is made up to separate tasks.
Example (1)
There are 32 microcomputers in a computer centre.
microcomputer has 24 parts.
Each
How many different parts to a
microcomputer in the center are there?
Solution:
Because there are 32 ways to choose the microcomputer and 24
ways to choose the part no matter which microcomputer has been
selected, the product rule shows that there are 32*24 = 768 parts.
Example (2)
How many functions are there from a set with m elements to a
set with n elements?
Solution:
A function corresponds to a choice of one of the n elements in
the codomain for each of the m elements in the domain.
Hence by
the product rule there are n.n. ….. n = nm functions
From a set with m elements to one with n elements.
6.2 The Sum Rule:
If a task can be done either in one of n1 ways or in one of n2
ways, where none of the set of n1 ways is the same as any of the set of
n2 ways, there are n1 + n2 ways to do the task.
145
Example (3):
Suppose that either a member of the mathematics faculty or a
student who is a mathematics major is chosen as a representive to a
university committee. How many different choices are there for this
representive if there are 37 members of the mathematics faculty and
83 mathematics majors and no one is both a faculty member and a
student?
Solution:
There are 37 ways to choose a member of the mathematics
faculty and there are 83 ways to choose a student who is mathematics
major. Choosing a member of the mathematics faculty is never the
same as choosing a student who is a mathematics major because no
one is both a faculty member and a student. By the sum rule it
follows that there are 37 + 83 = 120 possible ways to pick this
representive.
Example (4):
A student can choose a computer project from one of three lists.
The three lists contain 23, 15 and 19 possible projects respectively.
No project is on more than one list. How many possible projects are
there to choose from?
Solution:
The student can choose a project by selecting a project from the
first list, the second list, or the third list. Because no project on more
than one list, by the sum rule there are 23 + 15 + 19 = 57 ways to
choose a project.
Exercises:
1) How many +ve integers between 50 and 1000
(a) are divisible by 7? Which integers are these?
146
(b) are divisible by 11? Which integers are there?
(c) are divisible by both 7 and 11? Which integers
2) How many +ve integers less than 1000 are there?
(a) are divisible by 7?
(b) are divisible by 7 but not by 11?
(c) are divisible by both 7 and 11?
3) How many +ve integers between 100 and 999
(a) are divisible by 7?
(b) are odd?
(c) Have the same three decimal digits?
(d) Are not divisible by 4?
(e) Are divisible by 3 or 4.
6.3 The Pigeonhole Principle:
Theorem(1):
If k is a positive integer and k+1 or more objects are placed into
k boxes, then there is at least one box containing two or more of the
objects.
Proof:
We will prove the pigeonhole
principle using a proof by
contraposition.
Suppose that none of the k boxes contains more than one object.
Then the total number of objects would be at most k.
this
contradiction, because there are at least k+1 objects.
Example (5):
Among any group of 367 people, there must be at least two with
the same birthday, because there are only 366 possible birthdays.
147
Example (6):
In any group of 27 English words, there must be at least two that
begin, with the same letter, because there are 26 letters in the English
alphabet.
Example (7):
How many students must be in a class to guarantee that at least
two students receive the same score on the final exam, if the exam
graded in a scale from 0 to 100 points.
Solution:
There are 101 possible scores on the final.
The pigeonhole
principle show that among any 102 students there must be at least 2
students with same score.
6. 4. Sequences and Summations:
6.4.1. Sequences:
A sequence is a discrete structure used to represent an ordered
list . For example ,1,2,3,5,8 is a sequence with five terms and
1,3 9,27,81,…is an infinite sequence .
Def.(1): A Sequence is a function from a subset of integers (usually
either the set {0,1,2,…} or the set {1,2,3,…}to the set S. We use the
notation ๐’‚๐’ to denote the image of the integer n . We call ๐’‚๐’ a term
of the sequence .
Example(1):
Consider the sequence {๐’‚๐’ } ,where ๐’‚๐’ =
๐Ÿ
๐’
The list of the terms of this sequence ,beginning with ๐’‚๐’ ,namely ,
๐’‚๐Ÿ , ๐’‚๐Ÿ , ๐’‚๐Ÿ‘ , …
Def.(2): A geometric progression is a sequence of the form
๐’‚, ๐’‚๐’“ , ๐’‚๐’“๐Ÿ , ๐’‚๐’“๐Ÿ‘ , … , ๐’‚๐’“๐’ , …
148
Where the initial term ๐’‚ and the common ratio ๐’“ are real numbers.
Example (2):
The sequence {๐’ƒ๐’ } with ๐’ƒ๐’ = (-1)๐’ , {๐’„๐’ } with
๐Ÿ
๐’„๐’ = ๐Ÿ. ๐Ÿ“๐’ and {๐’…๐’ } with ๐’…๐’ = 6 . ( )๐’ are geometric progressions
๐Ÿ‘
with initial term and common ratio equal to 1 and -1 ; 2and 5 ; and 6
and
๐Ÿ
๐Ÿ‘
, respectively , if we start at n=0 . The list of terms
๐’ƒ๐ŸŽ , ๐’ƒ๐Ÿ , ๐’ƒ๐Ÿ‘ , ๐’ƒ๐Ÿ’ ,…. begins with 1,-1, 1 ,-1 ,1,…;
The list of terms ๐’„๐ŸŽ , ๐’„๐Ÿ , ๐’„๐Ÿ , ๐’„๐Ÿ‘ , … begins with 2, 10, 50, 250, 1250, …;
And the list of terms ๐’…๐ŸŽ , ๐’…๐Ÿ , ๐’…๐Ÿ , ๐’…๐Ÿ‘ , … ๐’ƒ๐’†๐’ˆ๐’Š๐’๐’” ๐’˜๐’Š๐’•๐’‰
6, 2,
๐Ÿ
,
๐Ÿ‘
๐Ÿ
,
๐Ÿ—
๐Ÿ
๐Ÿ๐Ÿ•
,…
Def.(3): An arithmetic progressions is a sequence of the form :
๐’‚, ๐’‚ + ๐’…, ๐’‚ + ๐Ÿ๐’…, ๐’‚ + ๐Ÿ‘๐’…, … , ๐’‚ + ๐’๐’…, …
Where the initial term ๐’‚ and the common difference ๐’… are real
numbers.
Example(3):
The sequence {๐’”๐’ } with ๐’”๐’ = -1+4n and {๐’•๐’ } with
๐’•๐’ =7-3n are both arithmetic progressions with initial terms and
common differences equal to -1 and 4 ,and 7 and -3, respectively, if
we start at n=0 . The list of terms ๐’”๐ŸŽ , ๐’”๐Ÿ , ๐’”๐Ÿ , ๐’”๐Ÿ‘ , … begins with
-1,3,7,11,…
And the list of terms ๐’•๐ŸŽ , ๐’•๐Ÿ , ๐’•๐Ÿ , ๐’•๐Ÿ‘ , … begins with 7 ,4 ,1 ,-2,…
Example(4):
Find formula for the sequences with the following first five terms: (a)
1,
๐Ÿ
๐Ÿ
,
๐Ÿ
๐Ÿ’
,
๐Ÿ
๐Ÿ–
,
๐Ÿ
๐Ÿ๐Ÿ”
(b) 1 ,3 ,5 ,7 ,9 (c) 1 ,-1 , 1 ,-1 ,1.
149
Solution:
(a) We recognize that the denominators are powers of 2.
The sequence with ๐’”๐ŸŽ =
๐Ÿ
๐Ÿ๐’
, n = 0 ,1 ,2 , … is a possible match . The
proposed sequence is a geometric progression with ๐’‚ = ๐Ÿ ๐’‚๐’๐’… ๐’“ =
๐Ÿ
๐Ÿ
(b)We note that each term is obtained by adding 2 to the
previous term . The sequence with ๐’‚๐’ = 2n +1 , n= 0 ,1, 2 ,… is
a possible match . This proposed sequence is an arithmetic
progression with ๐’‚ = ๐Ÿ ๐’‚๐’๐’… ๐’… = ๐Ÿ.
(c) The terms alternate between 1 and -1 . The sequence with
๐’‚๐’ = (-1)๐’ ,n= 0 ,1, 2 ,… is possible match . This proposed
sequence is a geometric progression with ๐’‚ = ๐Ÿ ๐’‚๐’๐’… ๐’“ = −๐Ÿ.
Some Useful Sequences
nth Term
First 10 Terms
๐’๐Ÿ
1, 4 , 9 , 16 , 49 , 64 , 81 , 100 ,…
๐’๐Ÿ‘
1 , 8 ,27 , 64 , 125 , 216 , 343 , 512 , 729 , 100 ,…
๐’๐Ÿ’
1 , 16 , 81 , 256 , 625 , 1296 , 2401 , 4096 , 6561 , 10000,…
๐Ÿ๐’
2, 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024,…
๐Ÿ‘๐’
3 , 9 , 27 , 81 , 243 , 729 , 2187 , 6561 , 19683, 59049,…
n!
1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 , 362880, 3628800,…
6.4.2 Summations:
The sum of terms : ๐’‚๐’Ž , ๐’‚๐’Ž+๐Ÿ , ๐’‚๐’Ž+๐Ÿ, , ๐’‚๐’Ž+๐Ÿ‘ , … , ๐’‚๐’
sequence {๐’‚๐’ }. We use the notation : ∑๐’๐’‹=๐’Ž ๐’‚๐’‹ ,
to represent:
150
form the
๐’๐’“ ∑๐’Š≤๐’‹≤๐’ ๐’‚๐’‹
๐’‚๐’Ž +๐’‚๐’Ž+๐Ÿ + ๐’‚๐’Ž+๐Ÿ, + ๐’‚๐’Ž+๐Ÿ‘ + โ‹ฏ + ๐’‚๐’
. The variable j is called the
index of summation , and the choice of the letter j as the variable is
arbitrary ; that is , we could have used any other letter ,such as I or
k, in notation ∑๐’๐’‹=๐’Ž ๐’‚๐’‹ = ∑๐’๐’Š=๐’Ž ๐’‚๐’Š = ∑๐’๐’Œ=๐’Ž ๐’‚๐’Œ
Here , the index of summation runs through all integers starting with
lower limit m and ending with its upper limit n.
Example(1):
Express the sum of the first 100 terms of the sequence {๐’‚๐’ },
where ๐’‚๐’ =
๐Ÿ
๐’
, for n = 1 ,2 , 3, …
Solution:
The lower limit for the index of summation is 1 , and the
upper limit is 100 .We write the sum as: ∑๐Ÿ๐ŸŽ๐ŸŽ
๐’‹=๐Ÿ
๐Ÿ
๐’‹
.
Example(2):
What is the value of :
∑๐Ÿ“๐’‹=๐Ÿ ๐’‹๐Ÿ ?
Solution: ∑๐Ÿ“๐’‹=๐Ÿ ๐’‹๐Ÿ = ๐Ÿ๐Ÿ + ๐Ÿ๐Ÿ + ๐Ÿ‘๐Ÿ + ๐Ÿ’๐Ÿ + ๐Ÿ“๐Ÿ = 1+4+9+16+25 =55.
Example (3):
What is the value of :
∑๐Ÿ–๐’Œ=๐Ÿ’ (−๐Ÿ)๐’Œ ?
Solution : ∑๐Ÿ–๐’Œ=๐Ÿ’ (−๐Ÿ)๐’Œ = (−๐Ÿ)๐Ÿ’ + (−๐Ÿ)๐Ÿ“ + (−๐Ÿ)๐Ÿ” + (−๐Ÿ)๐Ÿ• + (−๐Ÿ)๐Ÿ–
= 1+(-1 )+1+(-1)+ 1
= 1.
Example (4):
Suppose we have the sum : ∑๐Ÿ“๐’‹=๐Ÿ ๐’‹๐Ÿ
But we want the index of summation to run from 0 and 4 rather
than 1 to 5 . To do this ,we let k= j-1 . Then the new summation
index runs from 0 to 4 , and the term ๐’‹๐Ÿ becomes (๐’Œ + ๐Ÿ)๐Ÿ .
Hence ,
151
∑๐Ÿ“๐’‹=๐Ÿ ๐’‹๐Ÿ
= ∑๐Ÿ’๐’Œ=๐ŸŽ (๐’Œ + ๐Ÿ)๐Ÿ
.
It is easily checked that both sums are 1+4+9+16+25 = 55.
Theorem(1): (Formula for the sum of terms of geometric progression).
๐’‚๐’“๐’+๐Ÿ −๐’‚
∑๐’๐’‹=๐ŸŽ ๐’‚๐’“๐’‹
, ๐’Š๐’‡ ๐’“ ≠ ๐Ÿ
= { ๐’“−๐Ÿ
(๐’ + ๐Ÿ)๐’‚ , ๐’Š๐’‡ ๐’“ = ๐Ÿ
Example(5):(Double summations)
∑๐Ÿ’๐’Š=๐Ÿ ∑๐Ÿ‘๐’‹=๐Ÿ ๐’Š ๐’‹.
To evaluate the double sum, first expand the inner summation and
then continue by computing the outer summation :
๐Ÿ’
๐Ÿ‘
๐Ÿ’
๐Ÿ’
∑ ∑ ๐’Š ๐’‹ = ∑(๐’Š + ๐Ÿ๐’Š + ๐Ÿ‘๐’Š) = ∑ ๐Ÿ”๐’Š = ๐Ÿ” + ๐Ÿ๐Ÿ + ๐Ÿ๐Ÿ– + ๐Ÿ๐Ÿ’ = ๐Ÿ”๐ŸŽ .
๐’Š=๐Ÿ ๐’‹=๐Ÿ
๐’Š=๐Ÿ
๐’Š=๐Ÿ
Exercises:
1) What are the terms ๐’‚๐ŸŽ , ๐’‚๐Ÿ , ๐’‚๐Ÿ , ๐’‚๐’๐’… ๐’‚๐Ÿ‘ of the sequence { ๐’‚๐’ }
Where ๐’‚๐’ equals :
(a) ๐Ÿ๐’ + ๐Ÿ?
(b) (n +1)๐’+๐Ÿ ?
(c) ⌊๐’⁄๐Ÿ⌋ ?
(d) ⌊๐’⁄๐Ÿ⌋ + ⌈๐’⁄๐Ÿ⌉ ?
2) What are the terms ๐’‚๐ŸŽ , ๐’‚๐Ÿ , ๐’‚๐Ÿ , and ๐’‚๐Ÿ‘ of the sequence :
{ ๐’‚๐’ } Where ๐’‚๐’ equals :
(a) (-2)๐’ ? (b) 3 ? (c) 7 + ๐Ÿ’๐’ ? (d) ๐Ÿ๐’ + (− ๐Ÿ)๐’ ?
3) List the first 10 terms of each of these sequences :
(a) The sequence that
begins with
2 and in which each
successive term is 3 more than preceding term.
(b) The sequence that lists each positive integer three times ,
in increesing order .
152
(c)
The sequence
that lists
the odd positive
integers in
increasing order , listing each odd integer twice .
(d) The sequenc whose nth term is ๐’! − ๐Ÿ๐’ .
4) List the first 10 terms of these sequences :
(a) The sequence obtained by starting with 10 and obtaining
each term by subtracting 3 from the previous term.
(b) the sequence whose nth term is the sum of the first n positive
integers .
(c) The sequence whose nth term is ๐Ÿ‘๐’ − ๐Ÿ๐’ .
(d) The sequence whose terms are constructed sequentially as
follows : start with 1 , then add 1 , then multiply 1 , then add 2 ,
then multiply by 2 , and so on.
5) What are the values of these sums :
(a)∑๐Ÿ“๐’Œ=๐Ÿ(๐’Œ + ๐Ÿ)
(b) ∑๐Ÿ’๐’‹=๐ŸŽ(−๐Ÿ)๐’‹ (c) ∑๐Ÿ๐ŸŽ
๐’Š=๐Ÿ ๐Ÿ‘
(d) ∑๐Ÿ–๐’‹=๐ŸŽ(๐Ÿ๐’‹+๐Ÿ − ๐Ÿ๐’‹ )
6) Compute each of these double sums:
(a) ∑๐Ÿ๐’Š=๐Ÿ ∑๐Ÿ‘๐’‹=๐Ÿ( ๐’Š + ๐’‹) (b) ∑๐Ÿ๐’Š=๐ŸŽ ∑๐Ÿ‘๐’‹=๐ŸŽ( ๐Ÿ๐’Š + ๐Ÿ‘๐’‹)
(c) ∑๐Ÿ‘๐’Š=๐Ÿ ∑๐Ÿ๐’‹=๐ŸŽ ๐’Š ∑๐Ÿ๐’Š=๐ŸŽ ∑๐Ÿ‘๐’‹=๐Ÿ ๐’Š๐’‹
153
6. 5. Discrete Probability:
6.5.1: Random variables and sample spaces:
Def.(1):
Suppose we have an experiment whose outcome depends on
chance .We represent the outcome of the experiment by a capital
letter ,such that as X called a random variable . The sample space of
the experiment is the set of all possible outcomes . If the sample
space is either finite or countable infinite , the random variable is
called discrete .
We generally denote a sample space by the capital Greek letter ๐›€ .
Example(1):
A die is rolled once , let X denote the out come of this
experiment is the 6- element set , ๐›€ = { 1 , 2 , 3 , 4 , 5 , 6 } where
each outcome i , for i = 1 , … ,6 correspond to the number of dots
on the face which turns up . The event E = { 2 ,4 , 6 }corresponds to
the statement that the result is an even number . The event E can
also be described by saying that X is even . Unless there is
reason to believe the die is loaded , the natural assumption is
that every outcome is equally likely . A dopting this convention
means that we assign a probability of
i. e , m(i) =
๐Ÿ
๐Ÿ”
๐Ÿ
๐Ÿ”
to each of the outcomes,
for 1≤ ๐’Š ≤ ๐Ÿ”.
Example (2):
Consider an experiment in which a coin is tossed twice .
Let X be the random variable which corresponds to theis
experiment . We note that there are several ways to record the
154
outcomes of this experiment . We could , for example record the
two tosses , in the order in which they occurred . In this case ,
we have
๐›€ = { HH , HT , TH , TT }. We also could record the outcomes by
simply noting the number of heads that appeard. In this case ,
we have ๐›€ = { 0 , 1 , 2 }. Finally , we could record the two
outcomes , outcomes , without regard to the order in which they
occurred . In this case , we have ๐›€ = { HH , HT , TT }.
We will use , for the moment , the first of the sample spaces
given above , we will assume that all four outcomes are
generally likely , and define the distribution function m( ๐’˜) by :
m(HH) = m(HT) = m(TH) = m(TT) =
๐Ÿ
๐Ÿ’
Let E = { HH , HT, TH } be the event that at least one head
comes up .. Then , the probability of E can be calculated as
follows:
P(E) = m(HH) + m(HT) +m(TH) =
๐Ÿ
๐Ÿ’
+
๐Ÿ
๐Ÿ’
+
๐Ÿ
๐Ÿ’
=
๐Ÿ‘
๐Ÿ’
Similarly , if F = { HH , HT } is the event that heads comes up
on the first toss , then we have :
P(F) = m(HH) + m(HT) =
๐Ÿ
๐Ÿ’
+
๐Ÿ
๐Ÿ’
=
๐Ÿ
๐Ÿ
Example (3):
Three people A, B and C , are running for the office ,
and we assume that one and only one of them wins . The sa
sample space may be taken as the 3- element set ๐›€= { A , B , C}.
155
Where each element corresponds to the outcome of that
candidates winning , suppose that A and B have the same
chance of winning , but C has only
๐Ÿ
๐Ÿ
the chance of A and B .
Then we assign :
m(A) = m(B) =2 m( C)
since m(A) + m(B)+m(C)= 1, we see that 5m(C) =1 .
Hence m(A) =
๐Ÿ
๐Ÿ“
, m(B) =
๐Ÿ
๐Ÿ“
, m(C) =
๐Ÿ
๐Ÿ“
.
Let E be the event that either A or C wins , then E = { A ,C }
and P(E) = m(A) + m(C) =
๐Ÿ
๐Ÿ“
+
๐Ÿ
๐Ÿ“
=
๐Ÿ‘
๐Ÿ“
.
Theorem(1) :
The probabilities assigned to events by a distribution
function on a sample space ๐›€ satisfy the following properties :
(1) ๐ŸŽ ≤ ๐‘ท(๐‘ฌ) ≤ ๐Ÿ , ∀ ๐‘ฌ ⊂ ๐›€ .
(2) P(๐›€) = ๐Ÿ.
(3) If E ⊆ ๐‘ญ ⊆ ๐›€ , then P(E) ≤ P(F) .
(4) If A and B are disjoint subsets of ๐›€ , then
P(A∪ ๐‘ฉ) = P(A) + P(B).
ฬ… ) = 1 – P(A) , ∀ ๐‘จ ⊂ ๐›€ .
(5) P( ๐‘จ
Theorem(2):
If ๐‘จ๐Ÿ , ๐‘จ๐Ÿ , ๐‘จ๐Ÿ‘ , … , ๐‘จ๐’ are pairwise disjoint subsets of ๐›€ ,
then P( ๐‘จ๐Ÿ ∪ ๐‘จ๐Ÿ ∪ ๐‘จ๐Ÿ‘ ∪ … ∪ ๐‘จ๐’ ) = ∑๐’๐’Š=๐Ÿ ๐‘ท(๐‘จ๐’Š ).
156
Theorem(3):
Let ๐‘จ๐Ÿ , ๐‘จ๐Ÿ , ๐‘จ๐Ÿ‘ , … , ๐‘จ๐’ be pairwise disjoint events with
๐›€ = ๐‘จ๐Ÿ ∪ ๐‘จ๐Ÿ ∪ ๐‘จ๐Ÿ‘ ∪ … ∪ ๐‘จ๐’ and let E be any event . Then
P(E) = ∑๐’๐’Š=๐Ÿ ๐‘ท(๐‘ฌ ∩ ๐‘จ๐’Š ).
Corrllary:
For any two event A and B
ฬ…) .
P(A) = P(๐‘จ ∩ ๐‘ฉ) + P(๐‘จ ∩ ๐‘ฉ
Theorem(4):
If A and B are subsets of ๐›€ , then
P( A∪ ๐‘ฉ) = P(A) + P(B) – P(๐‘จ ∩ ๐‘ฉ).
Exercises:
1) Let ๐›€ = { a , b , c } be a sample space , let m(a) =
and m(c) =
๐Ÿ
๐Ÿ”
๐Ÿ
๐Ÿ
, m(b) =
๐Ÿ
๐Ÿ‘
. Find the probabilities of all eight subsets of ๐›€ .
2) Describe in words the events specified by the following subsets
of ๐›€ = { HHH , HHT , HTH , HTT, THH , THT, TTH , TTT }
a) E = { HHH , HHT , HTH , HTT}.
b) E = { HHH, TTT}.
c) E = { HHT, HTH , THH}.
d) E = { HHT, HTH , HTT, THH, THT ,TTH}.
3) What are the probabilities of the events described in
157
exercise (2)?
4) Let A and B be events such that P(๐‘จ ∩ ๐‘ฉ) =
and P(B) =
๐Ÿ
๐Ÿ
๐Ÿ
๐Ÿ’
ฬ…) =
, ๐‘ท(๐‘จ
๐Ÿ
๐Ÿ‘
.What is P( A∪ ๐‘ฉ) ?
6.6 Permutations and Combinations:
6.6.1 Permutations:
Example (8):
In how many ways can we select three students from a group of
five students to stand in line for a picture?
Solution:
There are 5 ways to select the first student to stand at the start
of the line there are 4 ways to select the 2nd student there are 3 ways
to select the 3rd student in the line. Hence there are 5 – 4 – 3 = 50
ways to select three students from a group of 5 students to stand for a
picture.
Example (9):
Let S = {1, 2, 3}. There ordered arrangement 3,1,2 is a
permutation of S. The ordered arrangement 3,2 is a 2 – permutation
of S.
The number of r-permutations of a
set with n elements is
denoted by P(n,r).
Theorem(2):
๐’!
If n and r are integers with ๐ŸŽ ≤ ๐’“ ≤ then ๐‘ท(๐’, ๐’“) = (๐’−๐’“)!
Example (10):
How many ways are there to select a first-prize winner, a
second-prize winner, and a third-prize winner from 100 different
people who have entered a contest?
158
Solution :
The number of 3-permutations of a set of 100 elements.
๐Ÿ๐ŸŽ๐ŸŽ!
๐‘ท(๐Ÿ๐ŸŽ๐ŸŽ, ๐Ÿ‘) = (๐Ÿ๐ŸŽ๐ŸŽ−๐Ÿ‘)! =
=
๐Ÿ๐ŸŽ๐ŸŽ.๐Ÿ—๐Ÿ—.๐Ÿ—๐Ÿ—.๐Ÿ—๐Ÿ–.๐Ÿ—๐Ÿ•!
๐Ÿ—๐Ÿ•!
๐Ÿ๐ŸŽ๐ŸŽ!
๐Ÿ—๐Ÿ•!
= ๐Ÿ—๐Ÿ•๐ŸŽ๐Ÿ๐ŸŽ๐ŸŽ
Example (11):
Suppose that there are eight runners in a race. The winner
receives a gold medal, the second-place finisher receives a silver
medal, and the third-place finisher receives a bronze medal. How
many different ways are there to a word these medals, if all possible
outcomes of the race can occur and there are no ties?
Solution:
The number of different ways to a word the medals is the
number of 3-penmutations of a set with 8 elements. Hence there are
๐‘ท(๐Ÿ–, ๐Ÿ‘) =
๐Ÿ–!
๐Ÿ“!
= 336 possible ways to a ward the medals.
6.6.2 Combinations:
Def .(1): The number of r-combinations of a set with n distinct
๐’
elements is denoted by ๐‘ช(๐’, ๐’“) = ( ).
๐’“
Example (12): c(4,2) = 4!
Theorem (3):
The number of r-combinations of a set with n elements, where n
is a nonnegative integer and r is an integer ๐ŸŽ ≤ ๐’“ ≤ ๐’ equals
๐‘ช(๐’, ๐’“) =
๐’!
๐’“! (๐’ − ๐’“)!
Proof :
๐‘ท(๐’, ๐’“) =
๐’!
๐’“!(๐’−๐’“)!
159
๏ƒž ๐‘ช(๐’, ๐’“) =
๐‘ท(๐’,๐’“)
๐‘ท(๐’“−๐’“)
=
๐’!(๐’−๐’“)!
๐’“!/(๐’“−๐’“)!
=
๐’!
๐’“!(๐’−๐’“)!
Example (13):
How many poker hands of five cards can be dealt from a
standard deck of 52 cards? Also, How many ways are there to select
37 cards from a standard deck of 52 cards?
Solution:
The order in which the 5 cards are dealt from a deck of 52 cards
does not matter, are
1) ๐‘ช(๐Ÿ“๐Ÿ, ๐Ÿ“) =
๐Ÿ“๐Ÿ!
๐Ÿ“!.๐Ÿ’๐Ÿ•!
2) ๐‘ช(๐Ÿ“๐Ÿ, ๐Ÿ’๐Ÿ•) =
=
๐Ÿ“๐Ÿ!
๐Ÿ’๐Ÿ•!.๐Ÿ“!
๐Ÿ“๐Ÿ.๐Ÿ“๐Ÿ.๐Ÿ“๐ŸŽ.๐Ÿ’๐Ÿ—.๐Ÿ’๐Ÿ–.๐Ÿ’๐Ÿ•!
๐Ÿ“.๐Ÿ’.๐Ÿ‘.๐Ÿ.๐Ÿ.๐Ÿ’๐Ÿ•!
= ๐Ÿ๐Ÿ“๐Ÿ—๐Ÿ–๐Ÿ—๐Ÿ”๐ŸŽ
= = ๐Ÿ๐Ÿ“๐Ÿ—๐Ÿ–๐Ÿ—๐Ÿ”๐ŸŽ
Corollary(1): Let n and r be nonnegative integers ๐’“ ≤ ๐’. Then
๐’„(๐’, ๐’“) = ๐’„(๐’, ๐’ − ๐’“)
Proof: From theorem (2) it follows that
๐’„(๐’, ๐’“) =
๐’!
๐’“! (๐’ − ๐’“)
๐’!
๐’!
and ๐’„(๐’, ๐’ − ๐’“) = (๐’−๐’“!)(๐’−(๐’−๐’“))! = (๐’−๐’“)!.๐’“!
Hence, ๐’„(๐’, ๐’“) = ๐’„(๐’, ๐’ − ๐’“)
Example (14):
How many ways are there to select 5 players from a 10-member
tennis team to make a trip to match at another school?
Solution:
By theorem (2)
๐’„(๐Ÿ๐ŸŽ, ๐Ÿ“) =
๐Ÿ๐ŸŽ!
= ๐Ÿ๐Ÿ“๐Ÿ
๐Ÿ“! ๐Ÿ“!
6.6.3 The Binomial Theorem:
The expansion of (๐’™ + ๐’š)๐Ÿ‘ = (๐’™ + ๐’š)(๐’™ + ๐’š)(๐’™ + ๐’š)
= ๐’™๐Ÿ‘ + ๐’™๐Ÿ ๐’š + ๐’™๐Ÿ ๐’š + ๐’™๐’š๐Ÿ + ๐’š๐’™๐Ÿ + ๐’™๐’š๐Ÿ + ๐’™๐’š๐Ÿ + ๐’š๐Ÿ‘
160
= ๐’™๐Ÿ‘ + ๐Ÿ‘๐’™๐Ÿ ๐’š + ๐Ÿ‘๐’™๐’š๐Ÿ + ๐’š๐Ÿ‘
Theorem (4): (The Binomial Theorem)
Let x and y be variables, and let n be a non negative integer.
Then
๐’
๐’
(๐’™ + ๐’š)๐’ = ∑ ( ๐’‹ ) ๐’™๐’−๐’‹ ๐’š๐’‹
๐’‹=๐ŸŽ
๐’
๐’
๐’
๐’
= ( ) ๐’™๐’ + ( ) ๐’™๐’−๐Ÿ ๐’š + ( ) ๐’™๐’−๐Ÿ ๐’š๐Ÿ + โ‹ฏ + ( ) ๐’š๐’
๐ŸŽ
๐’
๐Ÿ
๐Ÿ
Proof:
Using the mathematical induction form:
๐’
Let p(n)= (๐’™ + ๐’š)๐’ , ๐’‘(๐’) = ∑๐’๐’‹=๐ŸŽ ( ๐’‹ ) ๐’™๐’−๐’‹ ๐’š๐’‹
Basic step:
1) Let n = 1, p(1) = (๐’™ + ๐’š)๐Ÿ = ๐’™ + ๐’š
p(1) is true.
๐ฆ ๐ฆ−๐ฃ ๐ฃ
2) Assume that ๐ฉ(๐ฆ) = (๐ฑ + ๐ฒ)๐ฆ = ∑๐ฆ
๐ฒ is true
(
๐ฃ−๐ŸŽ ๐ฃ ) ๐ฑ
3) The inductive step ๐’‘(๐’Ž) → ๐’‘(๐’Ž + ๐Ÿ)
๐’‘(๐’Ž + ๐Ÿ) = (๐’™ + ๐’š)๐’Ž+๐Ÿ = (๐’™ + ๐’š)(๐’™ + ๐’š)๐’Ž
๐’Ž
๐’Ž
= (๐’™ + ๐’š) ∑ ( ๐’‹ ) ๐’™๐’Ž−๐’‹ ๐’š๐’‹
๐’‹=๐ŸŽ
๐’Ž
๐’Ž
๐’‹=๐ŸŽ
๐’‹=๐ŸŽ
๐’Ž
๐’Ž
= ∑ ( ๐’‹ ) ๐’™๐’Ž−๐’Œ+๐Ÿ ๐’š๐’‹ + ∑ ( ๐’‹ ) ๐’™๐’Ž−๐’‹ ๐’š๐’‹+๐Ÿ
๐’Ž
๐’Ž−๐Ÿ
๐’‹=๐Ÿ
๐’‹=๐Ÿ
๐’Ž
๐’Ž
๐’Ž
๐’Ž
= ( ) ๐’™๐’Ž+๐Ÿ ∑ ( ๐’‹ ) ๐’™๐’Ž−๐Ÿ+๐’‹ ๐’š๐’‹ + ∑ ( ๐’‹ ) ๐’™๐’Ž−๐’‹ ๐’š๐’‹+๐Ÿ + ( ) ๐’š๐’Ž+๐Ÿ
๐ŸŽ
๐’Ž
๐’Ž
๐’Ž
๐’‹=๐Ÿ
๐’‹=๐Ÿ
๐’Ž
๐’Ž
= ๐’™๐’Ž+๐Ÿ ∑ ( ๐’‹ ) ๐’™๐’Ž+๐Ÿ−๐’‹ ๐’š๐’‹ + ∑ (๐’‹ − ๐Ÿ) ๐’™๐’Ž+๐Ÿ−๐’‹ ๐’š๐’‹ + ๐’š๐’Ž+๐Ÿ
161
๐’Ž
๐’Ž
๐’Ž
= ๐’™๐’Ž+๐Ÿ ∑ [( ๐’‹ ) ∗ (๐’‹ − ๐Ÿ)] ๐’™๐’Ž+๐Ÿ−๐’‹ ๐’š๐’‹ + ๐’š๐’Ž+๐Ÿ
๐’‹=๐Ÿ
๐’Ž
๐’Ž + ๐Ÿ ๐’Ž+๐Ÿ−๐’‹
๐’Ž + ๐Ÿ ๐’Ž+๐Ÿ
๐’Ž + ๐Ÿ ๐’Ž+๐Ÿ
=(
+ ∑(
+(
)๐’™
)๐’™
)๐’š
๐’‹
๐’Ž+๐Ÿ
๐’
๐’‹=๐Ÿ
๐’Ž+๐Ÿ
= ∑(
๐’‹=๐ŸŽ
๐’Ž + ๐Ÿ ๐’Ž+๐Ÿ−๐’‹ ๐’‹
๐’š
)๐’™
๐’‹
Hence p(m+1) is true
P(n) is true, ∀๐’ ∈ ๐œจ
Example (15): What is the expansion of (x+y)4?
Solution: From the Binomial theorem
๐Ÿ’
๐Ÿ’
(๐’™ + ๐’š)๐Ÿ’ = ∑ ( ) ๐’™๐Ÿ’−๐’‹ ๐’š๐’‹
๐’‹
๐’‹=๐ŸŽ
๐Ÿ’
๐Ÿ’
๐Ÿ’
๐Ÿ’
๐Ÿ’
= ( ) ๐’™๐Ÿ’ + ( ) ๐’™๐Ÿ‘ ๐’š + ( ) ๐’™๐Ÿ ๐’š๐Ÿ + ( ) ๐’™๐’š๐Ÿ‘ + ( ) ๐’š๐Ÿ’
๐ŸŽ
๐Ÿ
๐Ÿ
๐Ÿ‘
๐Ÿ’
= ๐’™๐Ÿ’ + ๐Ÿ’๐’™๐Ÿ‘ ๐’š + ๐Ÿ”๐’™๐Ÿ ๐’š๐Ÿ + ๐Ÿ’๐’™๐’š๐Ÿ‘ + ๐’š๐Ÿ’
Example (16):
What is the coefficient of ๐’™๐Ÿ๐Ÿ ๐’š๐Ÿ๐Ÿ‘ in the expansion of (๐’™ + ๐’š)๐Ÿ๐Ÿ“?
Solution:
From the Binomial theorem it follows that this coefficient is
๐Ÿ๐Ÿ“!
๐Ÿ๐Ÿ“
= ๐Ÿ“๐Ÿ๐ŸŽ๐ŸŽ๐Ÿ‘๐ŸŽ๐ŸŽ
( )=
๐Ÿ๐Ÿ‘
๐Ÿ๐Ÿ‘!. ๐Ÿ๐Ÿ!
Example (17):
What is the coefficient of ๐’™๐Ÿ๐Ÿ ๐’š๐Ÿ๐Ÿ‘ in the expansion of (๐Ÿ๐’™ −
๐Ÿ‘๐’š)๐Ÿ๐Ÿ“?
Solution:
(๐Ÿ๐’™ − ๐Ÿ‘๐’š)๐Ÿ๐Ÿ“ = (๐Ÿ๐’™ + (−๐Ÿ‘๐’š))
162
๐Ÿ๐Ÿ“
๐Ÿ๐Ÿ“
∴ (๐Ÿ๐’™ + (−๐Ÿ‘๐’š))
๐Ÿ๐Ÿ“
= ∑(
๐’‹=๐ŸŽ
๐Ÿ๐Ÿ“
) (๐Ÿ๐’™)๐Ÿ๐Ÿ (−๐Ÿ‘๐’š)๐Ÿ๐Ÿ‘
๐’‹
The coefficient of ๐’™๐Ÿ๐Ÿ ๐’š๐Ÿ๐Ÿ‘ in the expansion is obtained when j =
13, namely
๐Ÿ๐Ÿ“!
๐Ÿ๐Ÿ“
๐Ÿ๐Ÿ๐Ÿ‘ . ๐Ÿ‘๐Ÿ๐Ÿ‘
( ) ๐Ÿ๐Ÿ๐Ÿ (−๐Ÿ‘)๐Ÿ๐Ÿ‘ = −
๐Ÿ๐Ÿ‘
๐Ÿ๐Ÿ‘!. ๐Ÿ๐Ÿ!
Corollary (2): Let n be nonnegative integer, then
๐’
๐’
∑ ( ) = ๐Ÿ๐’
๐’Œ
๐’Œ=๐ŸŽ
Proof: Using the Binomial theorem with x = 1 and y = 1, we see
that
๐’
๐’
๐’Œ=๐ŸŽ
๐’Œ=๐ŸŽ
๐’
๐’
๐Ÿ๐’ = (๐Ÿ + ๐Ÿ)๐’ = ∑ ( ) ๐Ÿ๐’Œ . ๐Ÿ๐’−๐’Œ = ∑ ( )
๐’Œ
๐’Œ
Corollary (3): Let n be a positive integer, then
๐’
๐’
∑(−๐Ÿ)๐’Œ ( ) = ๐ŸŽ
๐’Œ
๐’Œ=๐ŸŽ
Proof: Using the Binomial theorem with x = -1 and y = 1, we see
๐’
๐’
that ๐ŸŽ = ๐ŸŽ๐’ = ((๐Ÿ − ๐Ÿ) + ๐Ÿ) = ∑๐’๐’Œ=๐ŸŽ ( ) (−๐Ÿ)๐’Œ ๐Ÿ๐’−๐’Œ
๐’Œ
๐’
๐’
= ∑ ( ) (−๐Ÿ)๐’Œ
๐’Œ
๐’Œ=๐ŸŽ
Corollary (4): Let n be a nonnegative integer, then
๐’
๐’
∑ ๐Ÿ๐’Œ ( ) = ๐Ÿ‘๐’
๐’Œ
๐’Œ=๐ŸŽ
๐’
๐’
Proof: ๐Ÿ‘๐’ = (๐Ÿ + ๐Ÿ)๐’ = ∑๐’๐’Œ=๐ŸŽ ( ) ๐Ÿ๐’−๐’Œ ๐Ÿ๐’Œ = ∑๐’๐’Œ=๐ŸŽ ( ) ๐Ÿ๐’Œ
๐’Œ
๐’Œ
163
Theorem (5) : Pascal’s identity
Let n and k be positive integers with ๐’ ≥ ๐’Œ, then
(
๐’
๐’
๐’+๐Ÿ
)=(
)+( )
๐’Œ−๐Ÿ
๐’Œ
๐’Œ
Example(18):
Prove the identity:
๐’+๐Ÿ
๐’+๐’Œ
๐’+๐’Œ+๐Ÿ
(๐’๐ŸŽ) + (๐’+๐Ÿ
)
+
(
)
+
โ‹ฏ
+
(
)
=
(
)……..(*)
๐Ÿ
๐Ÿ
๐’Œ
๐’Œ
Proof:
We use the mathematical induction on k.
If k = 0 (Basis step):
The identity just says 1=1
So it is trivially true.( we can check it also for k =
1).
n+1 = n+1
The inductive step:
Assume that the identity (*) is true for a given value
k
We want to prove that it also holds for k+1 in place
of k , we want to prove that:
๐’+๐Ÿ
๐’+๐’Œ
๐’
๐’+๐’Œ+๐Ÿ
(๐’๐ŸŽ) + (๐’+๐Ÿ
)
+
(
)
+
โ‹ฏ
+
(
)
+
(
)
=
(
)
๐Ÿ
๐Ÿ
๐’Œ
๐’Œ+๐Ÿ
๐’Œ+๐Ÿ
Here the sum of the first k terms on the left hand
side is: (๐’+๐’Œ+๐Ÿ
) by induction hypothesis , and so the
๐’Œ
left hand side equal to (๐’+๐’Œ+๐Ÿ
) + (๐’+๐’Œ+๐Ÿ
)
๐’Œ
๐’Œ+๐Ÿ
But this is indeed equal to (๐’+๐’Œ+๐Ÿ
)
๐’Œ+๐Ÿ
164
By the fundamental property of Pascal triangle this
complete the proof by induction.
6.7. Pascal’s triangle:
1
11
121
1331
14641
1 5 10 10 5 1
1 6 15 20 15 61
1 7 21 35 35 21 71
1 8 28 36 70 56 2881
(b)
(a)
6.8. 1 Recurrence Relations:
Def.(1):
A recurrence relation for the sequence {๐’‚๐’ } is an equation
that express ๐’‚๐’ in terms of one or more of the previous
terms of the sequence , namely , ๐’‚๐ŸŽ , ๐’‚๐Ÿ , ๐’‚๐Ÿ , … , ๐’‚๐’−๐Ÿ , for all
integers n with
n ≥ ๐’๐ŸŽ , where ๐’๐ŸŽ is non negative integer . A sequence is
called a solution of a recurrence relation if its terms satisfy
the recurrence relation .
165
Example(1):
Let {๐’‚๐’ } be a sequence that satisfies the recurrence relation
๐’‚๐’ = ๐’‚๐’−๐Ÿ − ๐’‚๐’−๐Ÿ ๐’‡๐’๐’“ ๐’ = ๐Ÿ, ๐Ÿ‘ , ๐Ÿ’ , … , and suppose that
๐’‚๐ŸŽ = ๐Ÿ‘ ๐’‚๐’๐’… ๐’‚๐Ÿ = ๐Ÿ“ . What are ๐’‚๐Ÿ ๐’‚๐’๐’… ๐’‚๐Ÿ‘ ?
Solution :
We see from the recurrence relation that
๐’‚๐Ÿ = ๐’‚๐Ÿ − ๐’‚๐ŸŽ = ๐Ÿ“ − ๐Ÿ‘ = ๐Ÿ ๐’‚๐’๐’… ๐’‚๐Ÿ‘ = ๐’‚๐Ÿ − ๐’‚๐Ÿ = ๐Ÿ − ๐Ÿ“ =
−๐Ÿ‘
We can find ๐’‚๐Ÿ’ ๐’‚๐’๐’… ๐’‚๐Ÿ“ , and each successive term in a
similar way.
Example (2):
The recurrence relation ๐‘ท๐’ = (๐Ÿ. ๐Ÿ๐Ÿ)๐‘ท๐’−๐Ÿ is a linear
homogenous relation of degree one . The recurrence relation
๐‘ญ๐’ = ๐‘ญ๐’−๐Ÿ + ๐‘ญ๐’−๐Ÿ The recurrence relation ๐’‚๐’ = ๐’‚๐’−๐Ÿ“ is a
linear homogenous recurrence relation of degree five.
Example(3):
Determine whether the sequence {๐’‚๐’ } , where
๐’‚๐’ = ๐Ÿ‘๐’ ๐’‡๐’๐’“ ๐’†๐’—๐’†๐’“๐’š nonnegative integer n , is a solution of
the recurrence relation ๐’‚๐’ = ๐Ÿ ๐’‚๐’−๐Ÿ – ๐’‚๐’−๐Ÿ ๐’‡๐’๐’“ ๐’ =
๐Ÿ , ๐Ÿ‘ , ๐Ÿ’ ….
๐‘จ๐’๐’”๐’˜๐’†๐’“ the same question where ๐’‚๐’ = ๐Ÿ๐’ and ๐’‚๐’ = ๐Ÿ“.
Solution:
Suppose that ๐’‚๐’ = ๐Ÿ‘๐’ for every nonnegative integer n.Then ,
for n ≥ ๐Ÿ , we see that 2 ๐’‚๐’−๐Ÿ − ๐’‚๐’−๐Ÿ = ๐Ÿ [๐Ÿ‘(๐’ − ๐Ÿ)] − ๐Ÿ‘ (๐’ − ๐Ÿ) =
๐Ÿ‘๐’ = ๐’‚๐’
Therefore, {๐’‚๐’ } , where ๐’‚๐’ = ๐Ÿ‘๐’ , ๐ข๐ฌ ๐š ๐ฌ๐จ๐ฅ๐ฎ๐ญ๐ข๐จ๐ง for the recurrence
relation .
166
Suppose that ๐’‚๐’ = ๐Ÿ๐’ for every nonnegative integer n . Note
that ๐’‚๐ŸŽ = ๐Ÿ, ๐’‚๐Ÿ = ๐Ÿ , ๐š๐ง๐ ๐’‚๐Ÿ = ๐Ÿ’. Because ๐Ÿ๐’‚๐Ÿ − ๐’‚๐ŸŽ = 2.2 -1=3 ≠
๐’‚๐Ÿ ,
we see that {๐’‚๐’ }, where ๐’‚๐’ = ๐Ÿ๐’ , is not a solution of the recurrence
relation.
Suppose that ๐’‚๐’ = ๐Ÿ“ for every nonnegative integer n . Then for
n ≥ ๐Ÿ , we see that ๐’‚๐’ = ๐Ÿ๐’‚๐’−๐Ÿ − ๐’‚๐’−๐Ÿ = ๐Ÿ. ๐Ÿ“ − ๐Ÿ“ = ๐Ÿ“ = ๐’‚๐’ .
Therefore , {๐’‚๐’ }, where ๐’‚๐’ = ๐Ÿ“ ,is a solution of the recurrence
relation.
Example (4):The recurrence relation ๐’‚๐’ = ๐’‚๐’−๐Ÿ − ๐’‚๐Ÿ ๐’−๐Ÿ is non
linear . The recurrence relation ๐‘ฏ๐’ = ๐Ÿ๐‘ฏ๐’−๐Ÿ + ๐Ÿ is not
homogeneous. The recurrence relation ๐‘ฉ๐’ = ๐’๐‘ฉ๐’−๐Ÿ does not have
constant coefficients.
Example(5):
an = 2 an-1 + 3 an-2 and a0 = a1 = 1
Solution by use of the characteristic equation:
1. Substitute rn for an (rn-1 for an-1, etc.) and simplify the result. For this
example the characteristic equation is rn = 2rn-1 + 3rn-2 which
simplifies to: r2 = 2r + 3
2. Find the roots of the characteristic equation:
r2 - 2r - 3 = 0 factors as (r - 3)(r + 1) giving roots r1 = 3 and r2 = -1
When there are two distinct roots, the general form of the solution is:
an = ๏ก1•r1n + ๏ก2•r2n
where ๏ก1 and ๏ก2 are constants. In this case, we have:
an = ๏ก1•3n + ๏ก2•(-1)n
167
3. Using the initial conditions we can find the constants ๏ก1 and ๏ก2
a 0 = 1 = ๏ก1 + ๏ก2
a1 = 1 = 3๏ก1 - ๏ก2
so ๏ก1 = 1/2 and ๏ก2 = 1/2 and the final solution is
an = (1/2)•3n + (1/2)•(-1)n.
If a characteristic equation has equal roots, (i.e. r1 =r2), then the general
solution has the form:
an = ๏ก1•rn + ๏ก2•n•rn
Example( 6): an = 2an-2 – an-4 with a0 = 0, a1 = -2, a2 = 4 and a3 = -4.
In this case, we have a degree four linear homogeneous recurrence whose
characteristic equation is r4 = 2 r2 - 1 or r4 -2 r2 + 1 = 0. This factors as:
(r2 - 1)( r2 - 1) = 0 so the roots are r1 = r2 = 1 and
r3 = r4 = -1. (The order of the roots is arbitrary.)
Note there are two pairs of equal roots so there will be two terms each with n
as a factor.
The form of the general solution is: an = ๏ก1•r1n + ๏ก2•n•r2n + ๏ก3•r3n +
๏ก4•n•r4n
Setting up the equations we have:
a 0 = 0 = ๏ก1 + ๏ก3
a1 = -2 = ๏ก1 + ๏ก2 - ๏ก3 - ๏ก4
168
a2 = 4 = ๏ก1 + 2๏ก2 + ๏ก3 + 2๏ก4
a3 = -4 = ๏ก1 +3๏ก2 - ๏ก3 - 3๏ก4
so ๏ก1 = -1/2, ๏ก2 = 1/2, ๏ก3 = 1/2 and ๏ก4 = 3/2 and the final solution is:
an = (-1/2)•1n + (1/2)•n•1n + (1/2)• (-1)n + (3/2)•n•(-1)n
= -1/2 + n/2 + (1/2)•(-1)n + (3/2)•n•(-1)n
Example( 7): Draw n straight lines on a paper so that every pair of
lines intersect, but no three lines intersect at a common point.
Determine how many regions the plane is divided into if n lines are
used. (Draw yourself some pictures.)
If n = 0 then there is 1 region.
If n = 1 there are 2 regions.
If n = 2 there are 4 regions.
If n = 3 there are 7 regions.
In general, the nth line intersects n -1 others and each intersection
subdivides a region, so the number of regions that are subdivided by
the nth line is: 1 before the first line, 1 after the last line, and n - 2
regions between the n -1 lines. This gives us the following recurrence
relation:
an = an-1 + n
This can be solved iteratively by backward
substitution. Specifically,
= an-2 + (n - 1) + n
= an-3 + (n - 2) + (n - 1) + n
169
•
•
•
= a0 + 1 + 2 + ... + (n - 2) + (n - 1) + n = a0 + ๏ƒฅ i = 1 + n(n + 1)/2
Example( 8): Consider the relation an2 = 5(an-1) 2 where an > 0 and
a0 = 2.
Make the following change of variable: let bn = an2. Then, b0 = 4 and bn
= 5 bn-1.
Since this is a geometric series, its solution is bn = 4•5n. Now
substituting back,
an = √bn = 2√5n for n ๏‚ณ 0.
6.8.2.Inhomogeneous Recurrence Relations:
We now turn to inhomogeneous recurrence relations and look at
two distinct methods of solving them. These recurrence relations in
general have the form an = cn-1an-1 + g(n) where g(n) is a function of n.
(g(n) could be a constant)
One of the first examples of these recurrences usually encountered is
the tower of Hanoi recurrence relation: H(n) = 2H(n-1) + 1 which has
as its solution H(n) = 2n – 1. One way to solve this is by use of
backward substitution as above. We’ll see another method shortly.
Example( 9): Consider the Tower of Hanoi recurrence: H(n) = 2H(n1) + 1 with H(1) = 1. The solution to the homogeneous part is ๏ก•2n.
Since g(n) = 1 is a constant, the particular solution has the form
170
p(n) = ๏ข. Substituting into the original recurrence to solve for ๏ข we
get: ๏ข = 2๏ข +1 so that ๏ข = -1. Thus, p(n) = -1. This means that
H(n) = ๏ก•2n – 1. Using the fact that H(1) = 1, gives 1 = ๏ก•2 –1 so ๏ก = 1.
Thus, the solution to the original recurrence is H(n) = 2n – 1. (Note
that alternative ways to get this solution are backward substitution and
the method shown below.)
Example( 10): an = 2an-1 + n2 with a1 = 3.
The homogeneous part an = 2an-1 has a root of 2, so f(n) = ๏ก•2n. The
particular solution should have the form an = ๏ข2•n2 + ๏ข1•n + ๏ข0.
Substituting this into the original recurrence gives
๏ข2n2 + ๏ข1n + ๏ข0 = 2[๏ข2(n-1)2 + ๏ข1(n-1) + ๏ข0] + n2. Expanding and
combining like terms gives us
0 = n2(๏ข2 + 1) + n(-4๏ข2 + ๏ข1) + (2๏ข2 - 2๏ข1 + ๏ข0). Notice that each
parenthesized expression must evaluate to 0 since the left hand side of
the equation is 0. This gives us the following values for the constants:
๏ข2 = -1, ๏ข1 = -4 and ๏ข0 = -6. Thus, p(n) = -n2 -4n - 6. Then we have
an = ๏ก•2n -n2 -4n - 6. This gives us ๏ก = 7 and the final solution is
an = 7•2n -n2 - 4n - 6.
If g(n) consists of two or more terms, then each term is handled
separately using the table above. For example, solving an = 3 an-1 + 6n –
2n, requires finding particular solutions for two recurrences—
an = 3 an-1 + 6n and
an = 3 an-1 – 2n.
171
There is one case in which the particular solutions above will not work.
This happens when the particular solution is a solution of the
homogeneous recurrence. Then, the particular solution that should be
tried is a higher degree polynomial. For example. if g(n) = dn and d is a
solution of the homogeneous part then try ๏ข•n•dn as the particular
solution.
Example( 11): an = 3an-1 + 2n with a1 = 5.
The homogeneous part an = 3an-1 has a root of 3, so f(n) = ๏ก•3n. The
particular solution should have the form an = ๏ข•2n. Substituting this
into the original recurrence gives ๏ข•2n = 3 ๏ข•2n-1 + 2n. Solving this
equation for ๏ข gives us the particular solution p(n) = -2n+1. Thus the
solution has the form an = ๏ก•3n - 2n+1. Using the initial condition that
a1 = 5 we get 5 = 3๏ก - 4 which gives ๏ก = 3. Thus, the final solution is
an = 3n+1 - 2n+1.
6.8.3 A nother method of solving inhomogeneous recurrence relations:
Let’s consider the Tower of Hanoi recurrence again: H(n) = 2H(n-1)
+ 1 or H(n) – 2H(n-1) = 1. Substitute n – 1 for n in this equation to get
H(n-1) – 2 H(n-2) = 1. Notice what happens if we subtract the second
equation from the first: H(n) – 2H(n-1) – H(n-1) +2H(n-2) = 1 – 1,
or H(n) – 3H(n-1) + 2H(n-2) = 0, a homogeneous linear recurrence
relation. The characteristic equation x2 – 3x + 2 = 0 factors as
(x-2)(x-1) = 0 so the general form of the solution is
H(n) = ๏ก1• 2n + ๏ก2•1n = ๏ก1• 2n + ๏ก2. Using the initial conditions to
obtain the constants we find that ๏ก1 = 1 and ๏ก2 = -1 and thus we have
172
H(n) = 2n – 1 as we found before.
Example (12): an – an-1 = 2n with a0 = 0
Using the same method as above we find that an-1 - an-2 = 2(n-1). Now,
subtracting we get
an – an-1
= 2n
-an-1 + an-2 = -2(n-1)
an -2an-1 + an-2 = 2
This is not yet a homogeneous recurrence but one more application of
the method will give us a linear homogeneous recurrence relation.
an -2an-1 + an-2
=2
-an-1 + 2an-2 – an-3 = -2
an -3an-1 +3an-2 –an-3 = 0 has characteristic equation
x3 – 3x2 + 3x - 1 = 0 that factors as (x – 1)3.
The general form of the answer must be an = ๏ก1•1n +๏ก2•n•1n + ๏ก3•n2•1n
or ๏ก1 + ๏ก2•n + ๏ก3•n2. Since a0=0 we immediately get that ๏ก1 = 0. a1 = 2
and a2 = 6 giving us
2 = ๏ก2 + ๏ก3 and 6 = 2๏ก2 + 4 ๏ก3. Solving for ๏ก2 and ๏ก3 we get ๏ก2 = 1 and
๏ก3 = 1 so the solution to the recurrence is an = n + n2 or n(n + 1).
The same method can be used to solve recurrence relations in which
g(n) is a higher order polynomial. The substitute n – 1 for n and
subtract may have to be used several times, but eventually you will
173
obtain a linear homogeneous recurrence relation. (However, factoring
the characteristic equation could turn into a challenge.)
A similar method can be used if the function g(n) is an exponential.
Example( 13): an = 3an-1 + 2n with a1 = 5.
Rewriting the recurrence relation gives us an - 3an-1 = 2n. First we
multiply by 2 to get
2an - 6an-1 = 2n+1. Now substitute n – 1 for n in this new equation to
get:
2an-1 - 6an-2 = 2n. Now, subtracting this new recurrence from the
original one we get:
an - 3an-1
= 2n
-2an-1 + 6an-2 = -2n
an – 5an-1 + 6an-2 = 0.
The characteristic equation is x2 – 5x + 6 = 0 which factors as (x - 3)(x
– 2) = 0, so the answer has the form an = ๏ก1•3n + ๏ก2•2n. Using the facts
that a1 = 5 and a2 = 19 we get
5 = 3๏ก1 + 2 ๏ก2 and 19 = 9๏ก1 + 4๏ก2. Solving for the constants we get:
๏ก1 = 3 and ๏ก2 = -2 giving us the solution an = 3•3n + (-2)•2n = 3n+1 –
2n+1
6.8.4 .A formula for Fibonacci numbers:
๐‘ญ๐’+๐Ÿ = ๐‘ญ๐’ + ๐‘ญ๐’−๐Ÿ , n= 2 ,3 ,4 ,…
(*)
๐‘ญ๐Ÿ = ๐Ÿ , ๐‘ญ๐Ÿ = ๐Ÿ , ๐‘ญ๐Ÿ‘ = ๐Ÿ , ๐‘ญ๐Ÿ’ = ๐Ÿ‘ , ๐‘ญ๐Ÿ“ = ๐Ÿ“ , ๐‘ญ๐ŸŽ = ๐ŸŽ
174
Using the equation (*) we can easily determine any number of terms
in this sequence numbers :
0 , 1 ,1 2,3, 5,8,13,21,34, 55, 89,144, 233, 377, 610, 987,1597,…
The numbers in this sequence are called Fibonacci numbers .
Example(3): What is the sum of the first n Fibonacci numbers
0=0
0+1=1
0 + 1 +1 = 2
0 +1 + 1+ 2 = 4
0 + 1 +1 + 2 + 3 = 7
0 + 1 + 1 + 2 + 3 + 5 =12
0 + 1 + 1 + 2 + 3 + 5 + 8 = 20
0 + 1 + 1 + 2 + 3 + 5 + 8 + 13 = 33
……….
๐‘ญ๐ŸŽ + ๐‘ญ๐Ÿ + ๐‘ญ๐Ÿ + ๐‘ญ๐Ÿ‘ + โ‹ฏ + ๐‘ญ๐’ = ๐‘ญ๐’+๐Ÿ − ๐Ÿ
๐‘ญ๐ŸŽ + ๐‘ญ๐Ÿ + โ‹ฏ + ๐‘ญ๐’ = (๐‘ญ๐ŸŽ + ๐‘ญ๐Ÿ + โ‹ฏ + ๐‘ญ๐’−๐Ÿ ) + ๐‘ญ๐’
= (๐‘ญ๐’+๐Ÿ − ๐Ÿ) + ๐‘ญ๐’
= ๐‘ญ๐’+๐Ÿ − ๐Ÿ
Exercises: 1)Find the value of each of these quantities:
a) P(6,3)
(b)P(6,5)
(c) P(8,1)
(d) P(8,5)
e) C(5,1)
(f) C(5,3)
(g) C(12,6)
(h) C(8,8)
2 )Find the number of
5- permutations of a set with nine
elements
3) What is the row of Pascal 's triangle containing the binomial
coefficients (๐Ÿ—๐’Œ) , 0≤ k ≤ 9 ?.
3) Find the expansion of (๐’™ + ๐’š)๐Ÿ’ .
4) What is the coefficient of ๐’™๐Ÿ– ๐’š๐Ÿ— in the expansion of
5) (๐Ÿ‘๐’™ + ๐Ÿ๐’š)๐Ÿ๐Ÿ• .
175
๐’“
6) Prove that ∑
(๐’+๐’Œ
) =(๐’+๐’“+๐Ÿ
).
๐’Œ
๐’“
๐’Œ=๐ŸŽ
7) Find recurrenc relations that are satisfied by the sequences
formed from the following functions :
(i)
๐’‚๐’ = ๐’๐Ÿ − ๐Ÿ”๐’ + ๐Ÿ–
(ii)
๐’‚๐’ =
๐’!
๐Ÿ๐Ÿ“!
(iii)
๐’‚๐’ =
176
๐’!
[๐Ÿ๐Ÿ“!(๐’−๐Ÿ๐Ÿ“ )!]
for n ๏€พ 14
References:
[1] AL Doerr, Ken Levasseur (2003) .Applied Discrete Mathematics.
[2] Charles M. Grinslead Swarthamore College .Introduction to
Probability.
[3] James L. Hein (2003) Discrete Mathematics .Jones and Bartlett
learning.
[4] Kenneth H. Rosen (2007) Discrete Mathematics and its
Applications . Sixth Edition . McGROW Hill.
[5] Laszlo Lovasz and Katlin Vesztergombi, (1999), Discrete
Mathematics Yale University.
[6] L. Lovaszan K. Vesztergombi(1979).Discrete Mathematics.
Elsevier ,Amesterdam.
[7] Migual A.Lerma Noteson (2005). Discrete Mathematics.
Northwestern University.
[8] M .O. Albertson , (1988) .Discrete Mathematics with Algorithms.
John Wiley and Sons
[9] Richard Johnsonbough .(2007).Applied Discrete Mathematics.
Prentice Hall Amazon .com.
[10] Susanna S. EPP . Discrete Mathematics with Applications.
Fourth Edition. De Paul University .Amazon .com.
[11] Tucker,Alan,Applied combinatorics,2nd ed.
[12]http://www.answers.com/topic/recurrence-relations.
[13]http://mathcircle.berkeley.edu/BMC3/Bjorn1/node10htm1
177
178
Download