Professional Documents
Culture Documents
DM Set05 SequencesSums
DM Set05 SequencesSums
DM Set05 SequencesSums
Tassos Dimitriou
CpE-203
Discrete Structures
Set 5
Tassos Dimitriou
Outline
Sequences
Sums
1
1/17/2019
Tassos Dimitriou
Definitions
Sequence: an ordered list of elements
A sequence is a function from a subset of Z to a set S. We
use the notation an to denote the image of the integer n.
We call an a term of the sequence.
Example:
Subset of N: 1 2 3 4 5 …
S: 2 4 6 8 10 …
Tassos Dimitriou
Sequences
We use the notation {an} to describe a sequence
2
1/17/2019
Tassos Dimitriou
1, 3, 5, 7, 9, … an = 2n - 1
Tassos Dimitriou
Arithmetic Progression
a, a+d, a+2d, …, a+nd, …
an = a + (n-1)d
3
1/17/2019
Tassos Dimitriou
Geometric Progression
a, ar, ar2, ar3, …, arn-1, …
an = arn-1
Tassos Dimitriou
Steps to consider:
Is it an arithmetic progression (each term a constant amount
from the last)?
Is it a geometric progression (each term a factor of the previous
term)?
Does the sequence repeat (or cycle)?
Does the sequence combine previous terms?
Are there runs of the same value?
4
1/17/2019
Tassos Dimitriou
Tassos Dimitriou
5
1/17/2019
Tassos Dimitriou
Recurrences
A recurrence relation for the sequence {an} is an equation that
expresses an in terms of one or more of the previous terms of
the sequence.
Example 1: Let {an} be a sequence that satisfies the recurrence
relation an = an-1 + 3 for n = 1, 2, 3, . . . , and suppose that a0 = 2.
What are a1, a2, and a3?
Example 2: Let {an} be a sequence that satisfies the recurrence
relation an = an−1 − an−2 for n = 2, 3, 4, . . . , and suppose that
a0 = 3 and a1 = 5. What are a2 and a3?
Initial conditions specify the terms that precede the first term
where the recurrence relation takes effect.
Tassos Dimitriou
Fibonacci sequence:
F0 = 0 and F1 = 1
Fn = Fn-1 + Fn-2 , if n > 1
6
1/17/2019
Tassos Dimitriou
Tassos Dimitriou
7
1/17/2019
Tassos Dimitriou
Summations
n
What does a
j m
j stand for?
The variable j is called the index of summation, running from its lower
limit m to its upper limit n.
We could as well have used any other letter to denote this index.
Tassos Dimitriou
Summations
How can we express the sum of the first 1000 terms of the
sequence {an} with an=n2 for n = 1, 2, 3, … ?
We write it as
6
It is 1 + 2 + 3 + 4 + 5 + 6 = 21.
100
8
1/17/2019
Tassos Dimitriou
Summations
It is said that Friedrich Gauss came up with the following formula:
When you have such a formula, the result of any summation can be
calculated much more easily, for example:
Tassos Dimitriou
9
1/17/2019
Tassos Dimitriou
Geometric Series
Let’s prove
Observe that:
S = 1 + a + a2 + a3 + … + an
aS = a + a2 + a3 + … + an + a(n+1)
Therefore,
Tassos Dimitriou
10
1/17/2019
Tassos Dimitriou
Useful series
Tassos Dimitriou
Double summations
Like a nested for-loop
4 3
ij
i 1 j 1
Is equivalent to:
int sum = 0;
for ( int i = 1; i <= 4; i++ )
for ( int j = 1; j <= 3; j++ )
sum += i*j;
11
1/17/2019
Tassos Dimitriou
Products
There is also a special notation for products.
The product of am, am+1, . . . , an is represented by
Tassos Dimitriou
12