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

Discrete Math Lec3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Discrete Math Lec3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Discrete Math

lec3
Today we will have:
•Summations
•Matrices
Sequences
• Ordered list of elements
– e.g., 1, 2, 3, 5, 8 is a sequence with 5 elements
– 1, 3, 9, 27, 81, …, 30, …, is an infinite sequence
• Sequence {an}: a function from a subset of the set of integers
(usually either the set of {0, 1, 2, …} or the set {1, 2, 3, …}) to a
set S
• Use an to denote the image of the integer n
• Call an a term of the sequence

3
Sequences
• Example: {an} where an=1/n
– a1, a2, a3, a4, …
– 1, ½, 1/3, ¼,…
• When the elements of an infinite set can be listed, the set is
called countable
• Will show that the set of rational numbers is countable, but
the set of real numbers is not

4
Geometric progression
• Geometric progression: a sequence of the form
a, ar, ar2, ar3,…, arn
where the initial term a and common ratio r are real numbers
• Can be written as f(x)=a ∙ rx
• The sequences {bn} with bn=(-1)n, {cn} with cn=2∙5n, {dn} with dn=6
∙(1/3)n are geometric progression
– bn : 1, -1, 1, -1, 1, …
– cn: 2, 10, 50, 250, 1250, …
– dn: 6, 2, 2/3, 2/9, 2/27, …

5
Geometric progression
• A geometric progression is a discrete analogue of the
exponential function
f(x) = arx

6
Arithmetic progression
• Arithmetic progression: a sequence of the form
a, a+d, a+2d, …, a+nd
where the initial term a and the common difference d are real numbers
• Can be written as f(x)=a+dx
• {sn} with sn=-1+4n, {tn} with tn=7-3n
– {sn}: -1, 3, 7, 11, …
– {tn}: 7, 4, 1, -2, …

7
Arithmetic progression
• An arithmetic progression is a discrete analogue of the linear
function
f(x) = dx+a

8
String
• Sequences of the form a1, a2, …, an are often used in computer
science
• These finite sequences are also called strings
• The length of the string S is the number of terms in the string
• The empty string, denoted by 𝝺, is the string has no terms

9
Special integer sequences
• Finding some patterns among the terms
• Are terms obtained from previous terms
– by adding the same amount or an amount depends on the position in
the sequence?
– by multiplying a particular amount?
– By combining previous terms in a certain way?
– In some cycle?

10
Example
• Find formulae for the sequences with the following 5 terms
– 1, ½, ¼, 1/8, 1/16
– 1, 3, 5, 7, 9
– 1, -1, 1, -1, 1

11
Example1:
• Find formulae for the sequences with the following 5 terms
1, ½, ¼, 1/8, 1/16

• We recognize that the denominators are powers of 2.


1
• The sequence with an = 2𝑛 , n = 0, 1, 2, ... is a possible match.
• This proposed sequence is a geometric progression with a = 1 and r = 1/2.

12
Example2:
• Find formulae for the sequences with the following 5 terms
1, 3, 5, 7, 9

• We note that each term is obtained by adding 2 to the previous term.


• The sequence with an = 2n + 1, n = 0, 1, 2,... is a possible match.
• This proposed sequence is an arithmetic progression with a = 1 and d = 2.

13
Example3:
• Find formulae for the sequences with the following 5 terms
1, -1, 1, -1, 1

• 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 progression with a = 1 and r = −1.

14
Example
• How can we produce the terms of a sequence if the first 10
terms are :
• 1, 2, 2, 3, 3, 3, 4, 4, 4, 4?
• 5, 11, 17, 23, 29, 35, 41, 47, 53, 59
• 1, 3, 4, 7, 11, 18, 29, 47, 76, 123?

15
Example4:
• How can we produce the terms of a sequence if the first 10 terms are :
• 1, 2, 2, 3, 3, 3, 4, 4, 4, 4?
• In this sequence, the integer 1 appears once, the integer 2 appears
twice, the integer 3 appears three times, and the integer 4 appears
four times. A reasonable rule for generating this sequence is that the
integer n appears exactly n times, so the next five terms of the
sequence would all be 5, the following six terms would all be 6, and so
on. The sequence generated this way is a possible match.

16
Example
• How can we produce the terms of a sequence if the first 10 terms are :
• 5, 11, 17, 23, 29, 35, 41, 47, 53, 59
• Each of the first 10 terms of this sequence after the first is obtained by
adding 6 to the previous term. (We could see this by noticing that the
difference between consecutive terms is 6.) Consequently, the nth
term could be produced by starting with 5 and adding 6 a total of n − 1
times; that is, a reasonable guess is that the nth term is 5 + 6(n − 1) =
6n − 1. (This is an arithmetic progression with a = 5 and d = 6.)

17
Example
• How can we produce the terms of a sequence if the first 10 terms are :
• 1, 3, 4, 7, 11, 18, 29, 47, 76, 123?
• Observe that each successive term of this sequence, starting with the
third term, is the sum of the two previous terms. That is, 4 = 3 + 1, 7 =
4 + 3, 11 = 7 + 4, and so on. Consequently, if Ln is the nth term of this
sequence, we guess that the sequence is determined by the
recurrence relation Ln = Ln−1 + Ln−2 with initial conditions L1 = 1 and
L2 = 3

18
Example
• Find formulae for the sequences with the following 5 terms
– 1, ½, ¼, 1/8, 1/16
– 1, 3, 5, 7, 9
– 1, -1, 1, -1, 1
• The first 10 terms: 1, 2, 2, 3, 3, 3, 4, 4, 4, 4
• The first 10 terms: 5, 11, 17, 23, 29, 35, 41, 47, 53, 59

19
Example
• Conjecture a simple formula for {an} where the first 10 terms
are 1, 7, 25, 79, 241, 727, 2185, 6559, 19681, 59047

20
Summations
am  am1  ...  an
• The sum of terms: am, am+1, …, an from {an}
n

a ,  a j , or 1 j n a j
n
that represents j m
j j m

– Here j is the index of summation (can be replaced arbitrarily by i or k)


– The index runs from the lower limit m to upper limit n
– The usual laws for arithmetic applies

 (ax j  by j )  a j 1 x j  b j 1 y j where a, b are real numbers


n n n
j 1

21
Example
• Express the sum of the first 100 terms of the sequence {an}
where an=1/n, n=1, 2, 3, … 100 1
 j 1
j
• What is the value of k 1
5 2
k

k 1
5
k 2
 12
 2 2
 32
 4 2
 5 2
 1  4  9  16  25  55

• What is the value of k 4


8
( 1) k

k 4
8
( 1) k
 ( 1) 4
 ( 1) 5
 ( 1) 6
 ( 1) 7
 ( 1) 8
 1  (1)  1  (1)  1  1
5 4

• Shift index:     by setting j  k  1, or k  j  1


2 2
j ( k 1)
j 1 k 0 22
Geometric series
• Geometric series: sums of geometric progressions

 ar  a if r  1
n 1 n
S   ar j
n

 ar   r  1
j

if r  1
j 0


 (n  1)a
n
j 0
rS   ar j 1
j 0
n 1
  ar k
k 1
n
  ar k  (ar n 1  a )
k 0

 S  (ar n 1  a )
ar n 1  a
S
r 1 23
Double summations 4 3 4

• Often used in programs


 ij  (i  2i  3i)
i 1 j 1 i 1
4
  6i  6  12  18  24  60
i 1

• Can also write summation to add values of a function of a set


 f ( s)
sS

 s  0  2  4  6
s{0, 2, 4}

24
25
Example 100

• Find
k
k 50
2

100 100
100 101  201 49  50  99
49


k 50
k  k k 
2

k 1 k 1
2

6
2

6
 338350  40425  297925

• Let x be a real number with |x|<1, Find x


n 0
n

 ar n 1  a if r  1
n
 k
x k 1  1 
x k 1  1  1 1
 ar j   r  1 ,  x  n
, x n
 lim k   
j 0  (n  1)a if r  1 n 0 x 1 n 0 x 1 x 1 1  x

• Differentiating both sides of  xk 


k 0
1
1 x

1
 kx k 1 
k 0 (1  x) 2
26
Matrix
• Matrices are useful discrete structures that can be used in many
ways. For example, they are used to:
– describe certain types of functions known as linear transformations.
– Express which vertices of a graph are connected by edges (see Chapter 10).
• In later chapters, we will see matrices used to build models of:
– Transportation systems.
– Communication networks.
• Algorithms based on matrix models will be presented in later
chapters.
• Here we cover the aspect of matrix arithmetic that will be needed
later.
Matrix

Definition: A matrix is a rectangular array of numbers. A matrix


with m rows and n columns is called an m×n matrix.
– The plural of matrix is matrices.
– A matrix with the same number 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 entries in every position are equal.

3 2 matrix
3 by 2 matrix
Notation
• Let m and n be positive integers and let

• The i-th row of A is the 1×n matrix [ai1, ai2,…,ain]. The j-th column of A is
the m×1 matrix:

• The (i,j)-th element or entry of A is the


element aij. We can use A = [aij ] to denote the matrix with its (i,j)-th
element equal to aij.
Matrix addition
Defintion: Let A = [aij] and B = [bij] be m×n matrices. The
sum of A and B, denoted by A + B, is the m×n matrix that has
aij + bij as its (i,j)-th element. In other words, A + B = [aij +
bij].
Example:

Note that matrices of different sizes can not be added.


Matrix multiplication
Definition: Let A be an n×k matrix and B be a k × n matrix. The product of A and B,
denoted by AB, is the m×n matrix that has its (i,j)-th element equal to the sum of
the products of the corresponding elments from the i-th row of A and the j-th
column of B. In other words, if AB = [cij] then cij = ai1b1j + ai2b2j + … + akjb2j.
Example:

The product of two matrices is undefined when the number of columns in the first
matrix is not the same as the number of rows in the second.
Illustration of matrix multiplication
• The Product of A = [aij] and B = [bij]
Matrix multiplication is not commutative
Example: Let

Does AB = BA?
Solution:

AB ≠ BA
Identity matrix and powers of matrices
Definition: The identity matrix of order n is the n x n matrix In = [ij],
where ij = 1 if i = j and ij = 0 if i≠j.

AIn = ImA = A
when A is an m×n matrix

Powers of square matrices can be defined. When A is an n  n matrix,


we have:
A0 = In Ar = AAA∙∙∙A
Transposes of matrices
Definition: Let A = [aij] be an m×n matrix. The transpose of A,
denoted by AT ,is the n×m matrix obtained by interchanging
the rows and columns of A.

If AT = [bij], then bij = aji for i =1,2,…,n and j = 1,2,


...,m.
Transposes of matrices
Definition: A square matrix A is called symmetric if A = AT. Thus
A = [aij] is symmetric if aij = aji for i and j with 1≤ i≤ n and
1≤ j≤ n.

Square matrices do not change when their rows and


columns are interchanged.
Zero-one matrices
Definition: A matrix all of whose entries are either 0 or 1 is
called a zero-one matrix. (These will be used in Chapters 9 and
10.)
Algorithms operating on discrete structures represented by
zero-one matrices are based on Boolean arithmetic defined by
the following Boolean operations:
Zero-one matrices
Definition: Let A = [aij] and B = [bij] be an m  n zero-one
matrices.
– The join of A and B is the zero-one matrix with (i,j)-th entry aij ∨ bij.
The join of A and B is denoted by A ∨ B.
– The meet of of A and B is the zero-one matrix with (i,j)-th entry aij ∧
bij. The meet of A and B is denoted by A ∧ B.
Joins and meets of zero-one matrices
Example: Find the join and meet of the zero-one matrices

Solution: The join of A and B is

The meet of A and B is


Boolean product of zero-one matrices
Definition: Let A = [aij] be an m × k zero-one matrix and B = [bij] be a
k × n zero-one matrix. The Boolean product of A and B,
denoted by A ⊙ B, is the m×n zero-one matrix with(i,j)-th
entry
cij = (ai1 ∧ b1j)∨ (ai2 ∧ b2j) ∨ … ∨ (aik ∧ bkj).
Example: Find the Boolean product of A and B, where
Boolean product of zero-one matrices
Solution: The Boolean product A ⊙ B is given by
Boolean product of zero-one matrices
Definition: Let A be a square zero-one matrix and let r be a positive
integer. The r-th Boolean power of A is the Boolean product of r factors
of A, denoted by A[r] . Hence,

We define A[r] to be In.


(The Boolean product is well defined because the Boolean
product of matrices is associative.)
Boolean product of zero-one matrices
Example: Let

Find An for all positive integers n.


Solution:
Boolean product of zero-one matrices

1 1 0 0 0 1
A2ʘA= 0 0 1 1 0 0
0 0 1 0 0 1
AʘA= 1 0 0 1 0 0 1 0 1 1 1 0
1 1 0 1 1 0

1 1 0 1 0 1
A2= 0 0 1
1 0 1 A3= 1 1 0
1 1 1

44
Boolean product of zero-one matrices
1 0 1 0 0 1 1 1 1 0 0 1
A3ʘA= 1 1 0 1 0 0 A4ʘA= 1 0 1 1 0 0
1 1 1 1 1 0 1 1 1 1 1 0

1 1 1 1 1 1
A4= 1 0 1 A5= 1 1 1
1 1 1 1 1 1

45
Let’s call it a day. Thank you.

You might also like