Professional Documents
Culture Documents
DS - Lecture - 9 - Sequences and Summations
DS - Lecture - 9 - Sequences and Summations
Lahore Campus
Lecture Outline
Sequences
Sequences
•
• A sequence is a function from a subset of the set integers
Z (usually the set {0,1,2,…} or the set {1,2,3,…}) to a set
S.
n an
01/07/2022 CSC102 - Discrete Structures 5
Sequences
Geometric Progression
• A geometric progression is a sequence of the form
• Is {} geometric progression?
01/07/2022 CSC102 - Discrete Structures 9
• Is {} geometric progression?
6,2,2/3,2/9,…
Yes, a=6 and r=1/3
01/07/2022 CSC102 - Discrete Structures 10
Arithmetic Progression
•
• An arithmetic progression is a sequence of the form
• Is Arithmetic progression?
01/07/2022 CSC102 - Discrete Structures 14
• Is Arithmetic progression?
7,4,1,-2,…
Yes, a=7 and d=-3
01/07/2022 CSC102 - Discrete Structures 15
Sequences (Example)
•
• Find a formula for the following sequence.
01/07/2022 CSC102 - Discrete Structures 19
Sequences (Example)
•
• Find a formula for the following sequence.
Solution:
Sequences (Example)
•
• Find a formula for the following sequence.
01/07/2022 CSC102 - Discrete Structures 21
Sequences (Example)
•
• Find a formula for the following sequence.
Solution:
It is a geometric progression.
a=1 and r=1/2
01/07/2022 CSC102 - Discrete Structures 22
Sequences (Example)
• Find formula for the following sequence.
01/07/2022 CSC102 - Discrete Structures 23
Sequences (Example)
• Find formula for the following sequence.
Solution:
It is a arithmetic progression.
a=1 and d=2
01/07/2022 CSC102 - Discrete Structures 24
Sequences (Example)
• Find formula for the following sequence.
01/07/2022 CSC102 - Discrete Structures 25
Sequences (Example)
• Find formula for the following sequence.
Solution:
It is a geometric progression.
a=1 and r=-1
01/07/2022 CSC102 - Discrete Structures 26
Sequences (Example)
•
• How can you produce the terms of the following
sequence?
01/07/2022 CSC102 - Discrete Structures 27
Sequences (Example)
•
• How can you produce the terms of the following
sequence?
Solution:
Sequences (Example)
•
• How can you produce the terms of the following
sequence?
01/07/2022 CSC102 - Discrete Structures 29
Sequences (Example)
•
• How can you produce the terms of the following
sequence?
Solution:
Sequences (Example)
•
• Find a formula for the following sequence.
01/07/2022 CSC102 - Discrete Structures 31
Sequences (Example)
•
• Find a formula for the following sequence.
Solution:
Useful Sequences
01/07/2022 CSC102 - Discrete Structures 33
Sequences (Example)
•
• Find a formula for the following sequence?
01/07/2022 CSC102 - Discrete Structures 34
Sequences (Example)
•
• Find a formula for the following sequence?
Solution:
Sequences (Example)
• Find formula for the following sequence.
01/07/2022 CSC102 - Discrete Structures 36
Sequences (Example)
• Find formula for the following sequence.
Solution:
Compare it to .
01/07/2022 CSC102 - Discrete Structures 37
Summations
01/07/2022 CSC102 - Discrete Structures 38
Summations
• The sum of the terms from the sequence {} is:
Summations
• A summation:
int sum = 0;
for ( int j = m; j <= n; j++ )
sum += a(j);
01/07/2022 CSC102 - Discrete Structures 40
Summations (Example)
Summations (Example)
•
Express the sum of the first 100 terms of the sequence
{1/n} for n=1,2,3,… .
Solution:
01/07/2022 CSC102 - Discrete Structures 42
Summations (Example)
•
What is the value of ?
01/07/2022 CSC102 - Discrete Structures 43
Summations (Example)
•
What is the value of ?
Solution:
01/07/2022 CSC102 - Discrete Structures 44
Solution:
01/07/2022 CSC102 - Discrete Structures 47
Properties of Summations
01/07/2022 CSC102 - Discrete Structures 50
Example
•
01/07/2022 CSC102 - Discrete Structures 51
Example
01/07/2022 CSC102 - Discrete Structures 52
Double Summations
• Like a nested for loop
Is equivalent to:
int sum = 0;
for ( int i = 1; i <= 4; i++ )
for ( int j = 1; j <= 3; j++ )
sum += i*j;
01/07/2022 CSC102 - Discrete Structures 53
Double Summations
•
01/07/2022 CSC102 - Discrete Structures 54
Double Summations
•
• Solution:
01/07/2022 CSC102 - Discrete Structures 55
Example
•.
01/07/2022 CSC102 - Discrete Structures 56
Example
Find
01/07/2022 CSC102 - Discrete Structures 58
Example
Find
01/07/2022 CSC102 - Discrete Structures 59
Example
Find .
Find .
01/07/2022 CSC102 - Discrete Structures 60
Exercise Questions
Chapter # 2
Topic # 2.4
Questions 1, 2, 4, 25, 26, 29, 30,31, 32, 33, 34, 39, 40