Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
22 views12 pages

DM Set05 SequencesSums

The document discusses sequences and summations. It provides definitions and examples of sequences, including arithmetic and geometric progressions. It also covers determining sequence formulas from values, recurrence relations including the Fibonacci sequence, closed formulas for recurrences, and definitions and examples of summations.

Uploaded by

haimiryaz
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)
22 views12 pages

DM Set05 SequencesSums

The document discusses sequences and summations. It provides definitions and examples of sequences, including arithmetic and geometric progressions. It also covers determining sequence formulas from values, recurrence relations including the Fibonacci sequence, closed formulas for recurrences, and definitions and examples of summations.

Uploaded by

haimiryaz
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/ 12

1/17/2019

Tassos Dimitriou

CpE-203
Discrete Structures

Set 5

Prof. Tassos Dimitriou

Computer Engineering Department


Kuwait University

CpE-203: Discrete Structures 1

Tassos Dimitriou

Outline
Sequences

Sums

CpE-203: Discrete Structures 2

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 …

CpE-203: Discrete Structures 3

Tassos Dimitriou

Sequences
We use the notation {an} to describe a sequence

It is often convenient to describe a sequence with a formula.

For example, the sequence on the previous slide can be


specified as {an}, where an = 2n.

CpE-203: Discrete Structures 4

2
1/17/2019

Tassos Dimitriou

The Formula Game


What are the formulas that describe the following
sequences a1, a2, a3, … ?

1, 3, 5, 7, 9, … an = 2n - 1

-1, 1, -1, 1, -1, … an = (-1)n

2, 5, 10, 17, 26, … an = n2 + 1

0.25, 0.5, 0.75, 1, 1.25 … an = 0.25n

3, 9, 27, 81, 243, … an = 3n

CpE-203: Discrete Structures 5

Tassos Dimitriou

More sequence examples


an = 3n
 The terms in the sequence are a1, a2, a3, …
 The sequence {an} is { 3, 6, 9, 12, … }

Arithmetic Progression
 a, a+d, a+2d, …, a+nd, …
 an = a + (n-1)d

CpE-203: Discrete Structures 6

3
1/17/2019

Tassos Dimitriou

More sequence examples


bn = 2n
 The terms in the sequence are b1, b2, b3, …
 The sequence {bn} is { 2, 4, 8, 16, 32, … }

Geometric Progression
 a, ar, ar2, ar3, …, arn-1, …
 an = arn-1

CpE-203: Discrete Structures 7

Tassos Dimitriou

Determining the sequence formula


Given values in a sequence, how do you determine the
formula?

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?

CpE-203: Discrete Structures 8

4
1/17/2019

Tassos Dimitriou

Determining the sequence formula


1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, …
 The sequence alternates 1’s and 0’s, increasing the number of
1’s and 0’s each time
1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, …
 This sequence increases by one, but repeats all even numbers
once
1, 0, 2, 0, 4, 0, 8, 0, 16, 0, …
 The non-0 numbers are a geometric sequence (2n) interspersed
with zeros
3, 6, 12, 24, 48, 96, 192, …
 Each term is twice the previous: geometric progression
 an = 3*2n-1

CpE-203: Discrete Structures CSci 2011 9

Tassos Dimitriou

Determining the sequence formula


15, 8, 1, -6, -13, -20, -27, …
 Each term is 7 less than the previous term
 an = 22 - 7n
3, 5, 8, 12, 17, 23, 30, 38, 47, …
 The difference between successive terms increases by one each time
 a1 = 3, an = an-1 + n
 an = n(n+1)/2 + 2
2, 16, 54, 128, 250, 432, 686, …
 Each term is twice the cube of n
 an = 2*n3
2, 3, 7, 25, 121, 721, 5041, 40321
 Each successive term is about n times the previous one
 an = n! + 1

CpE-203: Discrete Structures 10

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.

CpE-203: Discrete Structures 11

Tassos Dimitriou

The Fibonacci numbers

Fibonacci, Leonardo de Pisa (ca. 1170 -


ca. 1240)
 The Fibonacci numbers have an intimate
relationship with the golden ratio the Greeks
so admired, and with Euclid’s GCD algorithm
 Furthermore, nature seems to love Fibonacci
numbers

Fibonacci sequence:
 F0 = 0 and F1 = 1
 Fn = Fn-1 + Fn-2 , if n > 1

CpE-203: Discrete Structures 12

6
1/17/2019

Tassos Dimitriou

Fibonacci numbers in nature

More about plants, etc. in


http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/fibnat.html

CpE-203: Discrete Structures 13

Tassos Dimitriou

Closed formulas for recurrences


Closed formula: an explicit expression for a recurrence as a
function of n.

 Example: Determine whether the sequence {an}, where an = 3n for


every nonnegative integer n, is a solution of the recurrence relation
an = 2an−1 − an−2 for n = 2, 3, 4, . . . .
Answer the same question where an = 2n and where an = 5.

 Example: Find a closed expression for the sequence that satisfies


the recurrence relation an = an-1 + 3 for n = 1, 2, 3, . . . , with a0 = 2.

Can be solved by iterating (i.e. repeatedly using) the recurrence


relation using either forward substitution or backward substitution.

CpE-203: Discrete Structures 14

7
1/17/2019

Tassos Dimitriou

Summations
n
What does a
j m
j stand for?

 It represents the sum am + am+1 + am+2 + … + an.

 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.

CpE-203: Discrete Structures 15

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

What is the value of  j?


j 1

It is 1 + 2 + 3 + 4 + 5 + 6 = 21.
100

What is the value of j


j 1
?

CpE-203: Discrete Structures 16

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:

CpE-203: Discrete Structures 17

Tassos Dimitriou

Sum of Arithmetic Series


Can you prove the “Gauss formula”?

Hint: Group numbers in pairs…

CpE-203: Discrete Structures 18

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)

so, (aS - S) = (a - 1)S = a(n+1) - 1

Therefore,

For example: 1 + 2 + 4 + 8 +… + 1024 = 2047.

CpE-203: Discrete Structures 19

Tassos Dimitriou

Geometric Series (cont.)


What about, when a < 1?
Infinite number of terms!

CpE-203: Discrete Structures 20

10
1/17/2019

Tassos Dimitriou

Useful series

CpE-203: Discrete Structures 21

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;

CpE-203: Discrete Structures 22

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

and is read as the product from i = m to i = n of ai .

How would you represent the factorial using this notation?

CpE-203: Discrete Structures 23

Tassos Dimitriou

CpE-203: Discrete Structures 24

12

You might also like