Discrete Math Lec3
Discrete Math Lec3
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
12
Example2:
• Find formulae for the sequences with the following 5 terms
1, 3, 5, 7, 9
13
Example3:
• Find formulae for the sequences with the following 5 terms
1, -1, 1, -1, 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 am1 ... 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
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
k 4
8
( 1) k
( 1) 4
( 1) 5
( 1) 6
( 1) 7
( 1) 8
1 (1) 1 (1) 1 1
5 4
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
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
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
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 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
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.