7/25/2019 Discrete Mathematics - week14
1/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Week 14: ReviewLecture notes in Discrete Mathematics
Hiqmet Kamberaj, Ph.D.
Faculty of EngineeringInternational Balkan University
December 21, 2015
7/25/2019 Discrete Mathematics - week14
2/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Outline
1 Sequences
2 Summations
3 Number theory
4 Matrices
5 Mathematical Induction
6 Recursive
7 Relations
8 Graphs
7/25/2019 Discrete Mathematics - week14
3/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Sequences
Definition
A sequence is a function from a subset of the set of integers (usually either the set{0, 1, 2, } or the set{1, 2, 3, }) to a set S. We use the notation an to denote theimage of the integer n. We call an a term of the sequence.
Definition
A geometric progression is a sequence of the form a, ar, ar2, , arn, where theinitial term a and the common ratio rare real numbers.
Remark: A geometric progression is a discrete analogue of the exponential functionf(x) =arx.
Definition
An arithmetic progression is a sequence of the form
a, a+d, a+ 2d, , a+nd,
where the initial term a and the common difference dare real numbers.
Remark: An arithmetic progression is a discrete analogue of the linear function:f(x) =dx+a.
7/25/2019 Discrete Mathematics - week14
4/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Special Integer Sequences
When trying to deduce a possible formula or rule for the terms of a sequencefrom the initial terms, try to find a pattern in these terms.
You might also see whether you can determine how a term might have been
produced from those preceding it.There are many questions you could ask, but some of the more useful are:
1 Are there runs of the same value? That is, does the same value occur many times in arow?
2 Are terms obtained from previous terms by adding the same amount or an amount thatdepends on the position in the sequence?
3 Are terms obtained from previous terms by multiplying by a particular amount?4 Are terms obtained by combining previous terms in a certain way?5 Are there cycles among the terms?
S S i N b h M i M h i l I d i R i R l i G h
7/25/2019 Discrete Mathematics - week14
5/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Examples
Example
Find formulas for the sequences with the following first five terms: (a)1, 1/2, 1/4, 1/8, 1/16; (b) 1, 3, 5, 7, 9; (c) 1,1, 1,1, 1.
Solution: (a) We recognize that the denominators are powers of 2. The sequence withan = 1/2n, n= 0, 1, 2, is a possible match. This proposed sequence is a geometricprogression with a= 1 and r= 1/2.(b) We note that each term is obtained by adding 2 to the previous term. Thesequence with an = 2n+ 1, n= 0, 1, 2, is a possible match. This proposedsequence is an arithmetic progression with a= 1 and d= 2.(c) The terms alternate between 1 and
1. The sequence with an = (
1)n,
n= 0, 1, 2, is a possible match. This proposed sequence is a geometric progressionwith a= 1 and r=1.
Seq ences S mmations N mber theor Matrices Mathematical Ind ction Rec rsi e Relations Graphs
7/25/2019 Discrete Mathematics - week14
6/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Summations
Summation used to express the sum of the terms am, am+1, , an from the sequence
{a
n}. We use the notation
nj=m
aj,
1jn
aj
to represent am+ am+1+ +an. Here, the variable jis called the index ofsummation, and the choice of the letter jas the variable is arbitrary; that is, we couldhave used any other letter, such as i ork. Or, in notation,
nj=m
aj =n
i=m
ai =n
k=m
ak.
Here, the index of summation runs through all integers starting with its lower limit mand ending with its upper limit n. A large uppercase Greek letter sigma,
, is used to
denote summation.The usual laws for arithmetic apply to summations. For example, when a and barereal numbers, we have
nj=1
(axj+byj) = an
j=1
xj+bn
j=1
yj,
where x1, x2, , xn and y1, y2, , yn are real numbers.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
7/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Exercises at the end of Week 6
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
8/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Division
Definition
Ifa and bare integers with a= 0, we say that a divides b if there is an integer c such
that b=ac. When a divides bwe say that a is a factor ofband that b is a multipleofa. The notation a|bdenotes that a divides b, and abwhen a does not divide b.Theorem
Let a, b and c be integers. Then
(i) if a
|b and a
|c, then a
|(b+ c);
(ii) if a|b, then a|bc for all integers c;(iii) if a|b and b|c, then a|cProof.
(i) Suppose that a|band a|care true. Then, it follows that
s(as= b),
t(at= c) Form these two expressions, b+ c=a(t+s)
ar where
r= t+ s is an integer as well. Thus,r(ar =b+ c) Therefore, we can saya|(b+ c).
(ii) Suppose that a|b, thenr(ar=b) where r is an integer. Multiply both sideswith c integer, we getr(acr=bc) Denoting t=cr, which also is an integer, wegett(at=bc) Therefore, we get a|bc.
(iii) Suppose that a
|band b
|c, then
s(as=b),
t(bt=c) Replacing the first
expression for b in the second expression, we get (as)t= c a(st) =cDenotingst=r, where r is another integer, we get ar=cwhich indicates that a|c.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
9/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Theorem
Let a be an integer and d a positive integer. Then, there are unique integers q and r,
such that0r
7/25/2019 Discrete Mathematics - week14
10/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
11/50
q y p
Theorem
Let m be a positive integer. The integers a and b are congruent modulo m if and only
if there is an integer k such that a= b+ km.
Proof.
Ifab(mod b)
then m|(a b) That is, there is an integer ksuch thata b=km
so thata= b+km
If there is an integer ksuch that
a= b+km
thenkm= a b
Thus, m divides a b, that is ab(mod m)
7/25/2019 Discrete Mathematics - week14
12/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
13/50
Theorem
Let m be a positive integer and let a and b be integers. Then
(a+b) mod m= ((a mod m) + (bmod m)) mod m
and
(ab) mod m= ((a mod m)(bmod m)) mod m
Proof.
Using the definition ofmod m and the definition of the congruence modulo m, we have
a(a mod m)(mod m)
andb(bmod m)(mod m)
Therefore, from previous theorem, we have
a+b((a mod m) + (bmod m))(mod m)
andab((a mod m)(bmod m))(mod m)
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
14/50
Definition
A positive integer pgreater than 1 is called prime if the only positive factors ofpare 1and p. A positive integer that is greater than 1 and is not prime is called composite.
Note that the integer n is composite if and only if there is an integer a such that a|nand 1< a< n.
Theorem
The fundamental theorem of arithmetic: Every positive integer greater than 1 can be
written uniquely as a prime or as the product of two or more primes where the prime
factors are written in order of nondecreasing size.
Example
The prime factorisations of 100, 641, 999 and 1024 are given by
100 = 2
2
5
5 = 22
52
641 = 641
999 = 3 3 3 37 = 33 37
1024 = 2 2 2 2 2 2 2 2 2 2 = 210
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
15/50
Theorem
If n is a composite integer, then n has a prime divisor less than or equal to
n.
Proof.
Ifn is a composite, by definition, there is a factor a with 1< a< n, and by definitionof a factor of a positive integer, we get
n=ab
where b is a positive integer, such that b>1. Lets show now that
a norb n
Suppose that this is not true, that is suppose that
a> nandb> n
thenab>n
which is a contradiction, Therefore, we conclude that anor bn
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
16/50
Definition
A matrix is a rectangular array of numbers. A matrix with m rows and n columns iscalled an m n matrix. The plural of matrix is matrices. A matrix with the samenumber of rows as columns is called square. Two matrices are equal if they have the
same number of rows and the same number of columns and the corresponding entriesin every position are equal.
The (i,j)th element or entry ofAis the element aij, that is, the number in the ith rowand jth column ofA. A convenient shorthand notation for expressing the matrix A isto write A=
aij
, which indicates that A is the matrix with its (i,j)th element equalto aij.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
17/50
Definition
Let A=
aij
and B=
bij
be m n matrices. The sum ofA and B, denoted byA+B, is the m n matrix that has aij+bijas its (i,j)th element. In other words,A+B = aij+bij.Definition
Let Abe an m kmatrix and Bbe a k n matrix. The product ofAand B, denotedbyAB, is the m n matrix with its (i,j)th entry equal to the sum of the products ofthe corresponding elements from the ith row ofA and the jth column ofB. In otherwords, ifAB=
cij
, then
cij =ai1b1j+ai2b2j+ +aikbkj
a11 a12 a1ka21 a22 a2k ai1 ai2
aik
am1 am2 amk
b11 b12 b1j b1nb21 b22 b2j b2n
bk1 bk2 bkj bkn
=
c11 c12 c1nc21 c22 c2n
cij
cm1 cm2 cmk
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
18/50
Definition
The identity matrix of order n is the n n matrix In =ij
, where
ij =
1 if i=j
0 if i=j
Hence
In =
1 0 00 1 0
0 0 1
Definition
Let A=
aij
be an m n matrix. The transpose ofA, denoted by At, is the n mmatrix obtained by interchanging the rows and columns ofA. In other words, if
At =
bij
, then bij =aji for i= 1, 2, , n and j= 1, 2, ,m.
Definition
A square matrix A is called symmetric ifA= At. Thus A=
aij
is symmetric if
1i
n; 1
j
n
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
19/50
Exercises at the end of Week 8
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
20/50
Mathematical Induction
Principle of mathematical inductionTo prove that P(n) is true for all positive integers n, where P(n) is a propositionalfunction, we complete two steps:
Basis step:
Verify that P(1) is true.
Inductive step:
We show that the conditional statement P(k)P(k+ 1) is true for all positiveintegers k:
1 We first assume thatP(k) is true, which is also called the inductive hypothesis.
2 Under this assumption we must prove that also P(k+ 1) is true.
Expressed as a rule of inference, this prove technique can be sated as:
[P(1) k(P(k)P(k+ 1))] nP(n), (n> 0).
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
21/50
Example
Example 1
Show that ifn is a positive integer, then 1 + 2 + +n = n(n+ 1)2
.
Solution: Let P(n) be the proposition that the sum of the first n positive integers isn(n+ 1)/2. We must do two things to prove that P(n) is true for n= 1, 2, 3,
Basis step: P(1) is true because 1 = 1(1 + 1)/2 = 1.
Inductive step: We first assume that P(k) is true, that is
1 + 2 + + k= k(k+ 1)2
, is true. Now, we have to show that P(k+ 1) is true,
that is, we have to show that
1 + 2 + + (k+ 1) = (k+ 1)((k+ 1) + 1)2
is true. Last equation can be written as:
(1 + 2 + +k) + 1 = k(k+ 1)2
+ 1 = (k+ 1)((k+ 1) + 1)
2 .
which is the proof.
7/25/2019 Discrete Mathematics - week14
22/50
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
23/50
Exercises at the end of Week 9
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
24/50
Recursive definitions
Definition
The process of defining an object in terms of itself is called recursion.
We use two steps to define a function with the set of nonnegative integers as itsdomain:
Basis step: Specify the value of the function at zero.
Recursive step: Give a rule for finding its value at an integer from its values atsmaller integers.
Example
Suppose that f is defined recursively by: f(0) = 3, f(n+ 1) = 2f(n) + 3. Findf(1), f(2), f(3), and f(4).Solution: From the recursive definition it follows:
f(1) = 2f(0) + 3 = 6 + 3 = 9,
f(2) = 2f(1) + 3 = 18 + 3 = 21,
f(3) = 2f(2) + 3 = 42 + 3 = 45,
f(4) = 2f(3) + 3 = 90 + 3 = 93.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
25/50
Exercises at the end of Week 10
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
26/50
Definition
Definition
Let A and Bbe two sets. Binary relation from A to B is a subset ofA B(R A B).
Example
Let A={0, 1, 2} and B={a, b}.Solution: The{(0, a), (0, b), (1, a), (2, b)} is a relation A to B. That is, 0Ra, but1Rb. Figure below gives a graphical representation of relation.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
27/50
Reflexive relations
Definition
A relation Ron a set A is calledreflexiveif (a, a)Rfor every element aA.a((a, a)R)
Definition
A relation Ron set A is called symmetric if (b, a)Rwhenever (a, b)R, forall a, bA.ab((a, b)R (b, a)R);A relation Ron set A such that for all a, bA, if (a, b)Rand (b, a)R, thena= b is called antisymmetric.ab(((a, b)R (b, a)R)(a= b));A relation Ron set A is called asymmetric ifa is related to bthen b is notrelated to a for all (a, b).ab((a, b)R (b, a) / R) (a((a, a) / R));
Definition
A relation Ron a set A is called transitive if whenever (a, b)Rand (b, c)R, then(a, c)R, for all a, b, c A.abc(((a, b)R (b, c)R)(a, c)R)
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
28/50
Example
Consider the following relations 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 is reflexive?
Solution: The relations R3 and R5 are reflexive because they both contain all pairs ofthe form (a, a), e.g. (1,1), (2,2), (3,3) and (4,4).
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
29/50
Example
Example
Consider the following relations 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 is symmetric, asymmetric and which is antisymmetric?
Solution:
The relations R2 and R3 are symmetric, because in each case (b, a) belongs tothe relation whenever (a, b) does.
R4, R5 and R6 are antisymmetric, because there is no pair of elements a and bwith a= bsuch that both (a, b) and (b, a) belong to relation.R4, and R6 are asymmetric, because whenever (a, b)R, then (b, a) / R.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
30/50
Example
Example
Consider the following relations on{1, 2, 3, 4}. Which of them are transitive?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)}
SolutionR4 is transitive, because (3,2) and (2,1); (4,2) and (2,1); (4,3) and (3,1); (4,3)and (3,2) are a set of pairs and (3,1), (4,1), (4,2) belong to R4 too.
R5: (1, 3) and (3, 4), but also (1,4) belong to R5; (2,3) and (3,4), also (2,4)
belong to R5; (1,2) and (2,4), also (1,4).
R1 is not transitive, because (3,4) and (4,1) belong to R1 but not (3,1);
R2 is not transitive, because (2,1) and (1,2) belong to R2, but not (2,2).
R3 is not transitive, because (4,1) and (1,2) belong to R3, but (4,2) does not.
R6 is transitive, because (F F = T)
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
31/50
Composite of two relations
Definition
Let Rbe a relation from a set A to a set B and Sa relation from a set Bto a set C.The composite ofR and S is the relation consisting of ordered pairs (a, c), whereaA, c C, and for which there exists an element bBsuch that (a, b)R and(b, c)
S. We denote the composite ofR and S byS
R.
Definition
Let Rbe a relation on the set A. The powers Rn, n= 1, 2, 3, , are definedrecursively by
R1 = R
andRn+1 =Rn R.
The definition shows that R2 =R R, R3 =R2 R= (R R) R, and so on.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
32/50
Example
What is the composite of the relations R and S, where R is the 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 the relation from{1, 2, 3, 4} to{0, 1, 2} with S={(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)}?Solution: S R is constructed using all ordered pairs in Rand ordered pairs in S,where the second element of the ordered pair in Ragrees with the first element of theordered pair in S:
S R={(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}.
Example
Let R={(1, 1), (2, 1), (3, 2), (4, 3)}. Find the powers Rn, n= 2, 3, 4, .
Solution: Because R2 = R R, we find that R2 ={(1, 1), (2, 1), (3, 1), (4, 2)}.Furthermore, because R3 =R2 R, R3 ={(1, 1), (2, 1), (3, 1), (4, 1)}. Additionalcomputation shows that R4 is the same as R3, so R4 ={(1, 1), (2, 1), (3, 1), (4, 1)}. Italso follows that Rn = R3 forn= 5, 6, 7, .
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
33/50
Representing relations using matrices
A relation between finite sets can be represented using a zero-one matrix. Suppose Ris a relation from A={a1, a2, , am} to B={b1, b2, , bn}. The relation R canbe represented by the matrix MR = [Mij] where
mij =
1 If (ai, bj)R
0 If (ai, bj) /R.
Example
Suppose that A={1, 2, 3} and B={1, 2}. Let Rbe the relation from A to Bcontaining (a, b) ifaA, bB, and a> b. What is the matrix representing R ifai = 1, a2 = 2, and a3 = 3, b1 = 1, b2 = 2?
Solution: Because R=
{(2, 1), (3, 1), (3, 2)
}, the matrix for R is
MR =
0 01 0
1 1
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
34/50
Combining relations: via Boolean operators
The boolean operations join and meet can be used to find the matrices representingthe union and intersection of two relations. Suppose that R1, R2 are two relations onthe set A represented by the matrices MR1 and MR2 , respectively:
The matrix representing the union of these relations has a 1 in the positions
where either MR1 orMR2 has a 1.
MR1R2 =MR1 MR2The matrix representing the intersection of these relations has a 1 in the positionswhere both MR1 and MR2 has a 1.
MR1
R2
=MR1
MR2
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
35/50
Example
Example
Suppose that relations R1 and R2 in set A are represented by the matrices:
MR1 =
1 0 11 0 0
0 1 0
MR2 =
1 0 10 1 1
1 0 0
What are matrices representing R1 R2 and R1 R2?Solution: The matrices of these relations are:
MR1R2 =MR1 MR2 =
1 0 11 1 11 1 0
MR1R2 =MR1 MR2 =
1 0 10 0 0
0 0 0
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
C
7/25/2019 Discrete Mathematics - week14
36/50
Combining relations: via relation composition
The Boolean product of matrices can be used to represent the matrix for thecomposite of relations. Suppose that R is a relation from A to B and S is a relationfrom B to C. Suppose that A, B and C have m, n, pelements respectively. Let beMSR =
tij
, MR =
rij
, MS =
sij
with sizes m p, m n and n p, respectively.The ordered pair (ai, cj)S R if and only if there is bksuch that (ai, bk)R and(bk, cj)S. It follows that tij= 1 if and only if rik =skj= 1 for some k.
MSR =MR MS.
Example
Find the matrix representing the relation S R, where the matrices representing R andS are:
MR =
1 0 11 1 0
0 0 0
MS =
0 1 00 0 1
1 0 1
Solution: The matrix for S R is
MSR= MR MS = 1 1 10 1 1
0 0 0
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
E i l l i
7/25/2019 Discrete Mathematics - week14
37/50
Equivalence relations
Definition
A relation Ron a set A is anequivalence relationif and only ifR is reflexive,symmetric and transitive.
Definition
Two elements a and bthat are related by an equivalence relation are called equivalent.
The notation ab is often used to denote that a and bare equivalent elements withrespect to a particular equivalence relation.
Example
Let Rbe the relation on the set of real numbers such that aRb if and only ifa b is
an integer. IsR
an equivalence relation?Solution: Because a a= 0 is an integer for all a, then aRa for all real numbers, thusR is reflexive. Suppose now that aRb, then a b is integer. From this, b a is alsointeger, thus, bRa. Hence, R is symmetric. IfaRband bRc, then a binteger andb c integer; their sum is a cwhich also integer, hence aRc, so R is transitive.Then, R is equivalence relation.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
E i l l
7/25/2019 Discrete Mathematics - week14
38/50
Equivalence classes
Definition
Let Rbe an equivalence relation on a set A. The set of all elements that are relatedto an element a ofA is called the equivalence class ofa. The equivalence class ofa
with respect to R is denoted by [a]R. When only one relation is under consideration,we can delete the subscript Rand write [a] for this equivalence class.
In other words, ifR is an equivalence relation on a set A, the equivalence class of theelement a is
[a]R ={s|(a, s)R}.
Ifb[a]R, then b is called a representativeof this equivalence class.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Cl f R l ti
7/25/2019 Discrete Mathematics - week14
39/50
Closures of Relations
Suppose we have a relation Ron a set A, where Rmay or may not have someproperty P, such as reflexivity, symmetry, ortransitivity. If there is a relation S withproperty P containing Rsuch that S is a subset of every relation with property PcontainingR, then S is called the closure ofRwith respect to property P.
If the property P is the reflexivity property, then S is called reflexive closure ofR.
If the property P is the symmetric property, then S is called symmetric closure ofR.
If the property P is the transitivity property, then S is called transitive closure ofR.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
40/50
In general, for a given relation Ron a set A, reflexive closure ofRcan be formedby adding to Rall pairs of the form (a, a) with aA, not already in R.Therefore, the reflexive closure ofRequals R
IA, where
IA ={(a, a)|aA}
is the diagonal relation on A.
In general, the symmetric closure of a relation Ron a set A can be obtained bytaking the union of the relation Rwith its inverse, R1, where
R1 ={(b, a)|(a, b)R}
Example
Suppose R={(1, 1), (1, 2), (2, 1), (3, 2)} on the set A={1, 2, 3} is not reflexive. Howcan we produce a reflexive relation containing R that is as small as possible?
Solution: This can be done by adding (2, 2) and (3, 3) to R, since these are the twomissing pairs on R in order for it to have the reflexivity property. Thus, Scan be
S={(1, 1), (1, 2), (2, 2), (2, 1), (3, 2), (3, 3)}
where S is reflexive and contains R. Therefore, S is reflexive closure ofR.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
41/50
Example
Suppose we have the relation R={(1, 1), (1, 2), (2, 2), (2, 3), (3, 1), (3, 2)} on the setA={1, 2, 3}. How can we produce a symmetric relation that is as small as possibleand contains R?Solution: As we can see, Rcontains (1, 2), but not (2, 1), and it contains (3, 1) butnot (1, 3). Therefore, R is not symmetric. To make it symmetric, we must add thepairs (2, 1) and (1, 3), to obtain S
S={(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2)}
Now, S is symmetric and is the symmetric closure ofR.
Example
Suppose we have the relation R={(1, 3), (1, 4), (2, 1), (3, 2)} on the setA={1, 2, 3, 4}. How can we produce a transitive relation that is as small as possibleand contains R?Solution: As we can see, R contains: (1, 3) and (3, 2), but not (1, 2); (2, 1) and (1, 3)
but not (2, 3); (2, 1) and (1, 4), but not (2, 4); (3, 2) and (2, 1) but not (3, 1).Therefore, R is not transitive. To make it transitive, we must add the pairs (1, 2),(2, 3), (2, 4) and (3, 1), to obtain S
S={(1, 3), (1, 4), (2, 1), (3, 2), (1, 2), (2, 3), (2, 4), (3, 1)}
Now, S is symmetric and is the transitive closure ofR.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
42/50
Exercises at the end of Week 11
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Graphs
7/25/2019 Discrete Mathematics - week14
43/50
Graphs
DefinitionA graph G= (V, E) consists ofV, a nonempty set of vertices (or nodes) and E, a setof edges. Each edge has either one or two vertices associated with it, called endpoints.An edge is said to connect its endpoints.
Definition
Two vertices uand v in an undirected graph Gare called adjacent (or neighbors) in Gifuand vare endpoints of an edge ofG. Ife is associated with{u, v}, the edge e iscalled incident with the vertices uand v. The edge e is also said to connect uand v.The vertices uand vare called endpoints of an edge associated with{u, v}.
Definition
The degree of a vertex in an undirected graph is the number of edges incident with it,except that a loop at a vertex contributes twice to the degree of that vertex. Thedegree of the vertex v is denoted by deg(v).
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
44/50
Example
What are the degrees of the vertices in the graph G and Hdisplayed in Figure?Answer:
a
b c d
e
a
b
c
de
G H
f g
In G
deg(a) = 2, deg(b) =deg(c) =deg(f) = 4, deg(d) = 1, deg(e) = 3, deg(g) = 0
In H,deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, deg(d) = 5
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Some other definitions
7/25/2019 Discrete Mathematics - week14
45/50
Some other definitions
Definition
A directed graph (or a digraph) (V, E) consists of a nonempty set of vertices V and aset of directed edges (or arcs) E. Each directed edge is associated with an orderedpair of vertices. The directed edge associated with the ordered pair (u, v) is said tostart at uand end at v.
DefinitionWhen (u,v) is an edge of the graph G with directed edges, u is said to be adjacent tov and v is said to be adjacent from u. The vertex u is called initial vertex of (u,v), andv is called the terminal or end vertex of (v,u). The initial vertex and terminal vertex ofa loop are the same.
Definition
In a graph with directed edges the in-degree of a vertexv, denoted by deg(v), is thenumber of edges with v as their terminal vertex. The out-degree ofv, denoteddeg+(v), is the number of edges with v as their initial vertex. Note that a loop at avertex contributes 1 to both the in-degree and out-degree of this vertex.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
46/50
Example
Find the in-degree and out-degree of each vertex in the graph G with directed edgesshown in Figure.
Answer:
a
c
d
b
e f
The in-degrees in G are
deg(a) = 2, deg(b) = 2, deg(c) = 3, deg(d) = 2, deg(e) = 3, deg(f) = 0
The out-degrees are
deg+(a) = 4, deg+(b) = 1, deg+(c) = 2, deg+(d) = 2, deg+(e) = 3, deg+(f) = 0
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Matrix representation
7/25/2019 Discrete Mathematics - week14
47/50
Matrix representation
Theadjacency matrix AofG, A=
aij
, is:
aij =
1 if (vi, vj) is an edge ofG,
0 otherwise
Example
Use an adjacency matrix to represent the graph in figure below:
a
cd
b
Solution:
0 3 0 23 0 0 10 0 1 22 1 2 0
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
Incidence matrices
7/25/2019 Discrete Mathematics - week14
48/50
Another common way to represent graphs is to use incidence matrices. LetG = (V, E) be an undirected graph. Suppose that v1, v2, , vn are the vertices ande1, e2, , em are edges ofG. Then the incidence matrix with respect to this orderingofV and E is the n m matrix M= mij, where
mij = 1 when edge ej is incident with vi,
0 otherwise.
Incidence matrices can also be used to represent multiple edges and loops.
Multiple edges are represented in the incidence matrix using columns withidentical entries, because these edges are incident with the same pair of vertices.
Loops are represented using column with exactly one entry equal to 1,corresponding to the vertex that is incident with this loop.
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
49/50
Example
Determine the incidence matrix of the graph shown in Figure.
v1 v2
v3
v5v4
e6
e5e4
e3
e2
e1
Solution: The incidence matrix is
M=
e1 e2 e3 e4 e5 e6
v1 1 1 0 0 0 0v2 0 0 1 1 0 1v3 0 0 0 0 1 1v4 1 0 1 0 0 0v5 0 1 0 1 1 0
Sequences Summations Number theory Matrices Mathematical Induction Recursive Relations Graphs
7/25/2019 Discrete Mathematics - week14
50/50
Exercises at the end of Week 12