Sequences, Sums, and Products

CSCE 222
Discrete Structures for Computing
Sequences, Sums, and Products
Dr. Philip C. Ritchey
Sequences
β€’ A sequence is a function from a subset of the integers to a set 𝑆.
β€’ A discrete structure used to represent an ordered list
β€’ π‘Žπ‘› denotes the sequence π‘Ž0 , π‘Ž1 , π‘Ž2 , …
β€’ Sometimes the sequence will start at π‘Ž1
β€’ π‘Žπ‘› is a term of the sequence
β€’ Example
β€’ 1, 2, 3, 5, 8 is a sequence with five terms
β€’ 1, 3, 9, 27, … , 3𝑛 , … is an infinite sequence
β€’ What is the function which generates the terms of the sequence 5, 7, 9, 11, … ?
β€’ If π‘Ž0 = 5
β€’ π‘Žπ‘› = 5 + 2𝑛
β€’ If if π‘Ž1 = 5
β€’ π‘Žπ‘› = 3 + 2𝑛
Geometric Progression
β€’ A geometric progression is a sequence of the form
π‘Ž, π‘Žπ‘Ÿ, π‘Žπ‘Ÿ 2 , π‘Žπ‘Ÿ 3 , …
where the initial term π‘Ž and the common ratio π‘Ÿ are real numbers.
β€’ Example
1 1 1
β€’ 1, , , , …
2 4 8
β€’ What is the initial term π‘Ž and common ratio π‘Ÿ?
β€’ π‘Ž=1
1
β€’ π‘Ÿ=2
β€’ π‘Žπ‘› = π‘Žπ‘Ÿ 𝑛
β€’ π‘Žπ‘› =
1 𝑛
2
Arithmetic Progression
β€’ An arithmetic progression is a sequence of the form
π‘Ž, π‘Ž + 𝑑, π‘Ž + 2𝑑, …
where the initial term π‘Ž and the common difference 𝑑 are real numbers.
β€’ Example
β€’ βˆ’1, 3, 7, 11, …
β€’ What is the initial term π‘Ž and common difference 𝑑?
β€’
β€’
β€’
β€’
π‘Ž = βˆ’1
𝑑=4
π‘Žπ‘› = π‘Ž + 𝑑𝑛
π‘Žπ‘› = βˆ’1 + 4𝑛
Exercises
List the first several terms of these sequences:
β€’ the sequence π‘Žπ‘› , where π‘Žπ‘› = 𝑛 + 1
β€’ 1, 4, 27, 256, 3125,…
𝑛+1
.
β€’ the sequence that begins with 2 and in which each successive term is 3 more than
the preceding term.
β€’ 2, 5, 8, 11, 14, …
β€’ π‘Žπ‘› = 2 + 3𝑛
β€’ the sequence that begins with 3, where each succeeding term is twice the preceding
term.
β€’ 3, 6, 12 ,24, 48, …
β€’ π‘Žπ‘› = 3 β‹… 2𝑛
β€’ the sequence where the 𝑛th term is the number of letters in the English word for the
index n.
β€’ 4, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, …
Recurrence Relations
β€’ A recurrence relation for the sequence π‘Žπ‘› is an equation that
expresses π‘Žπ‘› in terms of one or more of the previous terms of the
sequence.
β€’ Geometric progression: π‘Žπ‘› = π‘Žπ‘Ÿ 𝑛
β€’ Recurrence relation: π‘Žπ‘› = π‘Ÿπ‘Žπ‘›βˆ’1 , π‘Ž0 = π‘Ž
β€’ Arthmetic progression: π‘Žπ‘› = π‘Ž + 𝑑𝑛
β€’ Recurrence relation: π‘Žπ‘› = π‘Žπ‘›βˆ’1 + 𝑑, π‘Ž0 = π‘Ž
(π‘Ž0 is the initial condition)
β€’ Fibonacci Sequence: 𝑓𝑛 = 0, 1, 1, 2, 3, 5, 8, 13, …
β€’ 𝑓𝑛 = π‘“π‘›βˆ’1 + π‘“π‘›βˆ’2 ,
𝑓0 = 0, 𝑓1 = 1
β€’ Factorials: 1, 1, 2, 6, 24, 120, 720, 5040, …
β€’ 𝑛! = 𝑛 𝑛 βˆ’ 1 𝑛 βˆ’ 2 β‹― 2 β‹… 1
β€’ π‘Žπ‘› = π‘›π‘Žπ‘›βˆ’1 , π‘Ž0 = 1
Solving Recurrence Relations
β€’ A sequence is called a solution of a recurrence relation if its terms satisfy
the recurrence relation.
β€’ To solve a recurrence relation, find a closed formula (explicit formula) for
the terms of the sequence.
β€’ Closed formulae do not involve previous terms of the sequence.
β€’ Example
β€’ Relations of the form π‘Žπ‘› = π‘Ÿπ‘Žπ‘›βˆ’1
β€’ Geometric progression
β€’ Closed form: π‘Žπ‘› = π‘Žπ‘Ÿ 𝑛
β€’ Relations of the form π‘Žπ‘› = π‘Žπ‘›βˆ’1 + 𝑑
β€’ Arithmetic progression
β€’ Closed form: π‘Žπ‘› = π‘Ž + 𝑑𝑛
Technique for Solving Recurrence Relations
β€’ Iteration
β€’ Forward: work forward from the initial term until a pattern emerges. Then
guess the form of the solution.
β€’ Backward: work backward from an toward π‘Ž0 until a pattern emerges. The
guess the form of the solution.
β€’ Example: π‘Žπ‘› = π‘Žπ‘›βˆ’1 + 3,
β€’ Forward
β€’
β€’
β€’
β€’
β€’
π‘Ž1 = 2 + 3
π‘Ž2 = 2 + 3 + 3 = 2 + 2 β‹… 3
π‘Ž3 = 2 + 2 β‹… 3 + 3 = 2 + 3 β‹… 3
…
π‘Žπ‘› = 2 + 3𝑛
π‘Ž0 = 2
β€’ Backward
β€’
β€’
β€’
β€’
β€’
π‘Žπ‘›
π‘Žπ‘›
π‘Žπ‘›
…
π‘Žπ‘›
= π‘Žπ‘›βˆ’2 + 3 + 3 = π‘Žπ‘›βˆ’2 + 2 β‹… 3
= π‘Žπ‘›βˆ’3 + 3 + 2 β‹… 3 = π‘Žπ‘›βˆ’3 + 3 β‹… 3
= π‘Žπ‘›βˆ’4 + 3 + 3 β‹… 3 = π‘Žπ‘›βˆ’4 + 4 β‹… 3
= π‘Žπ‘›βˆ’π‘› + 𝑛 β‹… 3 = π‘Ž0 + 3𝑛 = 2 + 3𝑛
Exercises
β€’ Find the first few terms of a solution to the recurrence relation
π‘Žπ‘› = π‘Žπ‘›βˆ’1 + 2𝑛 + 3,
π‘Ž0 = 4
β€’
β€’
β€’
β€’
π‘Ž1 = 4 + 2 1 + 3 = 9
π‘Ž2 = 9 + 2 2 + 3 = 16
π‘Ž3 = 16 + 2 3 + 3 = 25
...
β€’ Solve the recurrence relation above.
β€’ From the first few terms, the pattern seems to be π‘Žπ‘› = 𝑛 + 2 2
β€’ This can be proved, but we need techniques we haven’t learned yet.
Exercises Continued
β€’ Find and solve a recurrence relation for the sequence 0, 1, 3, 6, 10, 15,…
β€’
β€’
β€’
β€’
Take differences: 1 - 0 = 1, 3 - 1 = 2, 6 – 3 = 3, 10 – 6 = 4, 15 – 10 = 5, …
Write down the relation: π‘Žπ‘› = π‘Žπ‘›βˆ’1 + 𝑛, π‘Ž0 = 0
Use backwards iteration
π‘Žπ‘› = π‘Žπ‘›βˆ’1 + 𝑛
β€’
β€’
β€’
β€’
β€’
= π‘Žπ‘›βˆ’2 + 𝑛 βˆ’ 1 + 𝑛
= π‘Žπ‘›βˆ’3 + 𝑛 βˆ’ 2 + 𝑛 βˆ’ 1 + 𝑛
…
= π‘Ž0 + 1 + 2 + β‹― + 𝑛
= 0 + 1 + 2 + β‹―+ 𝑛
β€’ The sum of the integers from 1 to 𝑛 is
β€’ π‘Žπ‘› =
𝑛 𝑛+1
2
𝑛 𝑛+1
2
Summations
β€’ The sum of the π‘š through 𝑛-th terms of sequence π‘Žπ‘˜
π‘Žπ‘š + π‘Žπ‘š+1 + β‹― + π‘Žπ‘›
is denoted as
𝑛
π‘Žπ‘–
𝑖=π‘š
where 𝑖 is the index of summation, π‘š is the lower limit, and 𝑛 is
the upper limit.
Examples
β€’ Use summation notation to express the sum from 1 to 100 of
100
β€’ Evaluate
3
𝑖=0
𝑖=1
1
𝑖
1
:
π‘₯
2𝑖 + 1
3
2𝑖 + 1 = 2 β‹… 0 + 1 + 2 β‹… 1 + 1 + 2 β‹… 2 + 1 + 2 β‹… 3 + 1
𝑖=0
= 1 + 3 + 5 + 7 = 16
Manipulations of Summation Notation
𝑛
π‘π‘Žπ‘– = 𝑐
𝑖
𝑛
𝑏𝑖 =
𝑖=π‘š
𝑛
𝑖=π‘š
𝑖=π‘š
𝑛
π‘Žπ‘– + 𝑐 =
π‘Žπ‘–
𝑖=𝑙+1
π‘›βˆ’π‘š
𝑖=π‘š
π‘›βˆ’π‘š
π‘Žπ‘—+π‘š =
𝑗=0
𝑛
π‘Žπ‘– + 𝑐 𝑛 βˆ’ π‘š + 1
𝑖=π‘š
π‘Žπ‘– +
π‘Žπ‘– =
π‘Žπ‘– + 𝑏𝑖
𝑛
𝑖=π‘š
𝑛
𝑛
π‘Žπ‘– +
𝑖=π‘š
π‘Žπ‘– =
𝑖
𝑛
𝑖=π‘š
π‘Žπ‘–
𝑙
π‘˜=0
𝑛
π‘Žπ‘– =
𝑖=π‘š
π‘Žπ‘›βˆ’π‘˜
π‘šβˆ’1
π‘Žπ‘– βˆ’
𝑖=0
π‘Žπ‘–
𝑖=0
Exercises
β€’ Evaluate
10
3
β€’ 3+3+3+3+3+3+3+3+3+3 = 30
𝑖=1
β€’ Let 𝑆 = 1,3,5,7 . Evaluate
𝑗2
β€’ 1+9+25+49 = 84
β€’ Evaluate
π‘—βˆˆπ‘†
8
3 β‹… 2𝑖
β€’ 3
8
𝑖
𝑖=0 2
𝑖=0
= 3 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 = 1533
Summation Identities
β€’ There are MANY, but here are two you should know:
β€’ Geometric Series
β€’ Arithmetic Series
𝑛
π‘›βˆ’1
𝑖
π‘Ÿ
π‘Ÿ =
π‘Ÿβˆ’1
𝑖=0
π‘›βˆ’1
π‘›βˆ’1
𝑖=0
π‘Ÿ=1
π‘Ÿβ‰ 1
𝑛 π‘›βˆ’1
𝑖=
2
Geometric Series Identity Proof π‘Ÿ β‰  1
π‘›βˆ’1
Let
π‘›βˆ’1
π‘Ÿπ‘–
S=
𝑖=0
π‘›βˆ’1
π‘Ÿπ‘–
π‘ŸS = π‘Ÿ
𝑖=0
π‘›βˆ’1
=
π‘Ÿπ‘— + π‘Ÿπ‘› βˆ’ π‘Ÿ0
=
𝑗=0
π‘Ÿπ‘† = 𝑆 + π‘Ÿ 𝑛 βˆ’ 1
𝑆 π‘Ÿ βˆ’ 1 = π‘Ÿπ‘› βˆ’ 1
π‘Ÿ 𝑖+1
π‘Ÿπ‘› βˆ’ 1
𝑆=
π‘Ÿβˆ’1
π‘Ÿπ‘—
β–‘
𝑖=0
𝑛
=
𝑗=1
Products
β€’ The product of the π‘š through 𝑛-th terms of sequence π‘Žπ‘˜
π‘Žπ‘š β‹… π‘Žπ‘š+1 β‹… β‹― β‹… π‘Žπ‘›
is denoted as
𝑛
π‘Žπ‘–
𝑖=π‘š
Example:
𝑛
𝑛! =
𝑖
𝑖=1
A Product Identity
𝑛
𝑛
π‘π‘Žπ‘– = 𝑐 π‘›βˆ’π‘š+1
𝑖=π‘š
𝑛
π‘Žπ‘–
𝑖=π‘š
π‘π‘Žπ‘– = π‘π‘Žπ‘š π‘π‘Žπ‘š+1 β‹― π‘π‘Žπ‘›
𝑖=π‘š
= 𝑐 𝑐 β‹― 𝑐 β‹… π‘Žπ‘š π‘Žπ‘š+1 β‹― π‘Žπ‘›
𝑛
= 𝑐
𝑛
𝑖=π‘š 1
π‘Žπ‘–
𝑖=π‘š
𝑛
= 𝑐 π‘›βˆ’π‘š+1
π‘Žπ‘–
𝑖=π‘š