SlideShare a Scribd company logo
CSC102: Discrete Structure
Credit Hours: 3(3,0)
Lecture # 15
Unit #: 5
MISHAL IQBAL
1
Instructor:
COMSATS University Islamabad
Vehari Campus
Topic
2
 Sequences
 Arithmetic progression
 Geometric progression
 Recurrence relation
 Fibonacci sequence
Sequences
3
 A sequence is a discrete structure used to represent an ordered
list. E.g., 1, 2, 3, 5, 8 is a sequence with five terms and 1, 3, 9,
27, 81 , . . . , 3
n
, . . . is an infinite sequence.
 The terms of a sequence can be specified by providing a
formula for each term of the sequence.
 To specify the terms of a sequence a recurrence relation is
used, which expresses each term as a combination of the
previous terms.
Overview
Sequences
4
 We use the notation {an} to describe the sequence and an
represents an individual term of the sequence {an}.
 We describe sequences by listing the terms of the sequence in
order of increasing subscripts
 Example: Consider the sequence {an}, where an =
 List of the terms of this sequence, beginning with a1, namely,
a1, a2, a3, a4, a5, a6, . . . , starts with 1, . . . .
Definition
Sequences
5
 (1) an=n2
, where n= 1, 2, 3,…. What are the elements of
sequence?
1, 4, 9, 16, 25,…
 (2) an=(-1)n
, where n= 0, 1, 2, 3, …. What are the elements of
sequence?
1, -1, 1, -1, 1,…
 (3) an=2n
, where n= 0, 1, 2, 3, …. What are the elements of
sequence?
1, 2, 4, 8, 16, 32, …
Examples
Sequences
6
 An arithmetic progression is a discrete analogue of the linear
function f (x) = dx + a.
 The sequences {sn} with sn = −1 + 4n, is an arithmetic
progression with initial term = -1, 2nd
term = 3, and common
difference = 4 if we start with n=0
 The list of terms s0, s1, s2, s3, . . . begins with −1, 3, 7, 11, . . .
Arithmetic
Progression
Sequences
7
 Example: The sequences {tn} with tn = 7 - 3n, is an arithmetic
progression with initial term = 7, 2nd
term = 4, and common
difference = -3, if we start with n=0
 The list of terms t0, t1, t2, t3, . . . begins with
7, 4, 1, -2, . . .
Arithmetic
Progression
Sequences
8
 Given a sequence finding a rule for generating the sequence is
not always straightforward.
 Example: Assume the sequence: 1,3,5,7,9, …. What is the
formula for the sequence?
 Each term is obtained by adding 2 to the previous term.
1, 1+2=3, 3+2=5, 5+2=7, 7+2
 It suggests an arithmetic progression: a+nd with a=1 and
d=2 an=1+2n
Arithmetic
progression
Sequences
9
 A geometric progression is a discrete analogue of the
exponential function f (x) =ark
 The sequences {bn} with bn = (−1)n
is a geometric progression
with initial term=1, 2nd
term = -1, and common ratio = -1, if we
start at n = 0.
 The terms b0, b1, b2, b3, b4, . . . begins with 1,−1, 1,−1, 1, . . .
Geometric
Progression
Sequences
10
 The sequences {cn} with cn = 2.5n
is a geometric progression
with initial term=2, 2nd
term = 10, and common ratio = 5, if we
start at n = 0.
 The terms c0, c1, c2, c3, c4, . . . begins with
2, 10, 50, 250, 1250, …
 The sequences {dn} with dn = 6.(1/3)n
is a geometric
progression with initial term=6, 2nd
term = 2, and common ratio
= 1/3, if we start at n = 0.
 The terms d0, d1, d2, d3, d4, . . . begins with
6, 2, 2/3, 2/9, 2/27, …
Geometric
Progression
Sequences
11
 Assume the sequence: 1, 1/3, 1/9, 1/27, … What is the
sequence?
 The denominators are powers of 3.
1, 1/3= 1/3, (1/3)/3=1/(3*3)=1/9, (1/9)/3=1/27
 This suggests a geometric progression: ark
with a=1 and
r=1/3 is (1/3 )n
Geometric
progression
Sequences
12
 In arithmetic and geometric progression, we specified
sequences by providing explicit formulas for their terms.
 There are many other ways to specify a sequence.
 E.g., another way to specify a sequence is to provide one or
more initial terms together with a rule for determining
subsequent terms from those that precede them.
Recurrence
relation
Sequences
13
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, namely, a0, a1, . . . , an−1, for all integers n with n ≥ n0,
where n0 is a nonnegative integer. A sequence is called a solution
of a recurrence relation if its terms satisfy the recurrence relation.
(A recurrence relation is said to recursively define a sequence.
Recurrence
relation
The n-th element of the sequence {an} is defined recursively in
terms of the previous elements of the sequence and the initial
elements of the sequence.
Sequences
14
 The initial conditions for a recursively defined sequence
specify the terms that precede the first term where the
recurrence relation takes effect.
 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?
 Solution: We see from the recurrence relation that
a1 = a0 + 3 = 2 + 3 = 5. It then follows that a2 = 5 + 3 = 8 and
a3 = 8 + 3 = 11.
Recurrence
relation
Sequences
15
 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?
 Solution: We see from the recurrence relation that
a2 = a1 − a0 = 5 − 3 = 2 and a3 = a2 −a1 = 2 − 5 = −3.
 We can find a4, a5, and each successive term in a similar way.
Recurrence
relation
Sequences
16
 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, . . . .
 Solution: Suppose that an = 3n for every nonnegative integer n.
Then, for n ≥ 2, we see that
2an−1 − an−2 = 2(3(n − 1)) − 3(n − 2) = 3n = an
 Therefore, {an}, where an = 3n, is a solution of the recurrence
relation.
Recurrence
relation
Sequences
17
 Example: Determine whether the sequence {an}, where an = 2n
for every nonnegative integer n, is a solution of the recurrence
relation an = 2an−1 − an−2 for n = 2, 3, 4, . . . .
 Solution: Suppose that an = 2n
for every nonnegative integer n.
Note that a0 = 1, a1 = 2, and a2 = 4, because
a2 =2a1 − a0 = 2 * 2 − 1 = 3, we see that {an},
where an = 2n
, is not a solution of the recurrence relation.
Recurrence
relation
Sequences
18
 Example: Determine whether the sequence {an}, where an = 5
 for every nonnegative integer n, is a solution of the recurrence
relation an = 2an−1 − an−2 for n = 2, 3, 4, . . . .
 Solution: Suppose that an = 5 for every nonnegative integer n.
Then for n ≥ 2, we see that
an = 2an−1 − an−2 = 2 ・ 5 − 5 = 5 = an
 Therefore, {an}, where an = 5, is a solution of the recurrence
relation.
Recurrence
relation
Sequences
19
 Many methods have been developed for solving recurrence
relations.
 Here, we will introduce a straightforward method known as
iteration.
 Solve the recurrence relation and initial condition with {an} be
a sequence that satisfies the recurrence relation an = an−1 + 3
for n = 1, 2, 3, . . . .
 Suppose that a1 = 2, and working upward until we reach an to
deduce a closed formula for the sequence. (continue …)
Recurrence
relation
Sequences
20
 The first approach is called forward substitution – we found
successive terms beginning with the initial condition and
ending with an.
 We see that
a2 = 2 + 3
a3 = (2 + 3) + 3 = 2 + 3 * 2 = 2 + 2 *3
a4 = (2 + 2 * 3) + 3 = 2 + 3 * 3
…
an = an−1 + 3 = (2 + 3 * (n − 2)) + 3 = 2 + 3(n − 1) (continue …)
Recurrence
relation
Sequences
21
 The second approach backward substitution starting with the
term an and working downward until we reach the initial
condition a1 = 2 to deduce this same formula.
 The steps are
an = an−1 + 3
= (an−2 + 3) + 3 = an−2 + 3 * 2
= (an−3 + 3) + 3 * 2 = an−3 + 3 * 3
...
= a + 3(n − 2) = (a + 3) + 3(n − 2) = 2 + 3(n − 1).
Recurrence
relation
Sequences
22
 Compound Interest Suppose that a person deposits $10,000 in
a savings account at a bank yielding 11% per year with interest
compounded annually. How much will be in the account after
30 years?
 Solution: Let Pn denote the amount in the account after n
years. Because the amount in the account after n years equals
the amount in the account after n−1 years plus interest for the
nth year, we see that the sequence {Pn} satisfies the recurrence
relation
Pn = Pn−1 + 0.11Pn−1 = (1.11)Pn−1
Recurrence
relation
Sequences
23
 The initial condition is P0 = 10,000. We can use an iterative
approach to find a formula for Pn. Note that
P1 = (1.11) P0
P2 = (1.11) P1 = (1.11)
2
P0
P3 = (1.11) P2 = (1.11)
3
P0
...
Pn = (1.11)Pn−1 = (1.11)n
P0
 Initial condition P0 = 10,000, Pn = (1.11)n
10,000 is obtained.
 n = 30, Pn = (1.11)
n
10,000
30
Recurrence
relation
Sequences
24
 A particularly useful sequence defined by a recurrence relation,
known as the Fibonacci sequence.
 The recurrence relation for the Fibonacci sequence tells us that
we find successive terms by adding the previous two terms.
Fibonacci
sequence
Sequences
25
 Example: Find the Fibonacci numbers f2, f3, f4, f5, and f6.
 Solution: The initial conditions tell us that f0 = 0 and f1 = 1,
using the recurrence relation in the definition we find that
f2 = f1 + f0 = 1 + 0 = 1,
f3 = f2 + f1 = 1 + 1 = 2,
f4 = f3 + f2 = 2 + 1 = 3,
f5 = f4 + f3 = 3 + 2 = 5,
f6 = f5 + f4 = 5 + 3 = 8.
Fibonacci
sequence
Sequences
26
 Suppose that {an} is the sequence of integers defined by
an = n!, the value of the factorial function at the integer n,
where n = 1, 2, 3, . . ..
 Because n! = n((n − 1)(n − 2) . . . 2 * 1) = n(n − 1)! = nan−1, we
see that the sequence of factorials satisfies the recurrence
relation an = nan−1, together with the initial condition a1 = 1.
 We have solved the recurrence relation together with the initial
conditions when we find an explicit formula, called a closed
formula, for the terms of the sequence.
Fibonacci
sequence
Sequences
27
 A common problem in discrete mathematics is finding a closed
formula, a recurrence relation, or some other type of general
rule for constructing the terms of a sequence.
 Sometimes only a few terms of a sequence solving a problem
are known; the goal is to identify the sequence.
 Even though the initial terms of a sequence do not determine
the entire sequence, knowing the first few terms may help you
make an educated conjecture about the identity of your
sequence. Once you have made this conjecture, you can try to
verify that you have the correct sequence.
Special integer
sequences
Sequences
28
 When trying to deduce a possible formula, recurrence relation,
or some other type of rule for the terms of a sequence when
given the initial terms, try to find a pattern in these terms.
 You might also see whether you can determine how a term
might have been produced from those preceding it.
 Are there runs of the same value? That is, does the same value occur many times in a row?
 Are terms obtained from previous terms by adding the same amount or an amount that
depends on the position in the sequence?
 Are terms obtained from previous terms by multiplying by a particular amount?
 Are terms obtained by combining previous terms in a certain way?
 Are there cycles among the terms?
Special integer
sequences
Sequences
29
 Find formulae for the sequences with the following first five
terms: 1, 1/2, 1/4, 1/8, 1/16.
 Solution: We recognize that the denominators are powers of 2.
The sequence with an = 1/2n
, n = 0, 1, 2, . . . is a possible
match.
This proposed sequence is a geometric progression with initial
a0 = 1 and common ratio r = 1/2.
Special integer
sequences
Sequences
30
 Find formulae for the sequences with the following first five
terms: 1, 3, 5, 7, 9.
 Solution: We note that each term is obtained by adding 2 to the
previous term. The sequence with an = 2n + 1, n = 0, 1, 2, . . . is
a possible match.
 This proposed sequence is an arithmetic progression with
initial a0 = 1 and d = 2.
Special integer
sequences
Sequences
31
 Find formulae for the sequences with the following first five
terms: 1, −1, 1, −1, 1.
 Solution: The terms alternate between 1 and −1.
 The sequence with an = (−1)n
, n = 0, 1, 2 . . . is a possible
match. This proposed sequence is a geometric progression with
initial a0 = 1 and r = −1.
Special integer
sequences
Sequences
32
 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?
 Solution: 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.
Special integer
sequences
Sequences
33
 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?
 Solution: In 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 a1 = 5 and d = 6.)
Special integer
sequences
Sequences
34
 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?
 Solution: 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
 This sequence is known as the Lucas sequence.
Special integer
sequences
Sequences
35
Some useful
sequences
Sequences
36
 If the first 10 terms of the sequence {an} are 1, 7, 25, 79, 241,
727, 2185, 6559, 19681, 59047, construct a formula for an .
 Solution: We find that this ratio, although not a constant, is
close to 3. So it is reasonable to suspect that the terms of this
sequence are generated by a formula involving 3
n
.
 Comparing these terms with the corresponding terms of the
sequence {3
n
}, we notice that the nth term is 2 less than the
corresponding power of 3.
 We see that an = 3
n
− 2 for 1 ≤ n ≤ 10 and this formula holds
for all n.
Special integer
sequences
Sequences
37
 A sequence is also an important data structure in computer
science.
 Sequences of the form a1, a2, . . . , an are often used in computer
science.
 These finite sequences are also called strings and it is also
denoted by a1a2 . . . an.
 The length of a string is the number of terms in this string.
 The empty string, denoted by λ, is the string that has no terms
and has length zero. The string abcd is a string of length four.
strings
38

More Related Content

PPTX
10-Sequences and summation.pptx
DOCX
sequence and series.docx
DOC
Sequences
PPT
10.1-10.8.js-lecturenotes for students.ppt
DOC
Sequences
PPTX
Generating Patterns and arithmetic sequence.pptx
PDF
kemh108 pdf for students very useful documents
PPT
Task 4
10-Sequences and summation.pptx
sequence and series.docx
Sequences
10.1-10.8.js-lecturenotes for students.ppt
Sequences
Generating Patterns and arithmetic sequence.pptx
kemh108 pdf for students very useful documents
Task 4

Similar to Discrete structure sequence, arithmetic progression (20)

DOCX
Sequence function
PDF
3.-SEQUENCES-AND-SERIES-THEORY.hhsssspdf
DOCX
Arithmetic Sequence
PDF
Ap gp
PDF
Arithmetic Progression & Geometric ProgresionP
PDF
Arithmetic And Geometric Progressions
PPTX
Recurrence_Theory.pptx studdents nees free
PPTX
Lesson 1a_Sequence.pptx
PPTX
Series in Discrete Structure || Computer Science
PPT
Sequences_Arithmetic_Harmonic_Geometric.ppt
PDF
(678215997) neethutext
DOCX
Arithmetic sequences and series[1]
PPT
Per5 sequences
ODP
Analysis sequences and bounded sequences
PDF
11.3 Geometric Sequences and Series
PDF
(677528443) neethu text (2)
DOC
Grade 10 Math Module 1 searching for patterns, sequence and series
PDF
Presentation4
PPTX
3. Finding the 𝒏𝒕𝒉 Term of an Arithmetic Sequence.pptx
PDF
Arithmetic Sequence and Arithmetic Series
Sequence function
3.-SEQUENCES-AND-SERIES-THEORY.hhsssspdf
Arithmetic Sequence
Ap gp
Arithmetic Progression & Geometric ProgresionP
Arithmetic And Geometric Progressions
Recurrence_Theory.pptx studdents nees free
Lesson 1a_Sequence.pptx
Series in Discrete Structure || Computer Science
Sequences_Arithmetic_Harmonic_Geometric.ppt
(678215997) neethutext
Arithmetic sequences and series[1]
Per5 sequences
Analysis sequences and bounded sequences
11.3 Geometric Sequences and Series
(677528443) neethu text (2)
Grade 10 Math Module 1 searching for patterns, sequence and series
Presentation4
3. Finding the 𝒏𝒕𝒉 Term of an Arithmetic Sequence.pptx
Arithmetic Sequence and Arithmetic Series
Ad

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Well-logging-methods_new................
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PPT on Performance Review to get promotions
PPTX
web development for engineering and engineering
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Safety Seminar civil to be ensured for safe working.
PPT
introduction to datamining and warehousing
PPTX
Construction Project Organization Group 2.pptx
R24 SURVEYING LAB MANUAL for civil enggi
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Well-logging-methods_new................
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Lecture Notes Electrical Wiring System Components
Operating System & Kernel Study Guide-1 - converted.pdf
PPT on Performance Review to get promotions
web development for engineering and engineering
Mechanical Engineering MATERIALS Selection
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
CH1 Production IntroductoryConcepts.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Foundation to blockchain - A guide to Blockchain Tech
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Safety Seminar civil to be ensured for safe working.
introduction to datamining and warehousing
Construction Project Organization Group 2.pptx
Ad

Discrete structure sequence, arithmetic progression

  • 1. CSC102: Discrete Structure Credit Hours: 3(3,0) Lecture # 15 Unit #: 5 MISHAL IQBAL 1 Instructor: COMSATS University Islamabad Vehari Campus
  • 2. Topic 2  Sequences  Arithmetic progression  Geometric progression  Recurrence relation  Fibonacci sequence
  • 3. Sequences 3  A sequence is a discrete structure used to represent an ordered list. E.g., 1, 2, 3, 5, 8 is a sequence with five terms and 1, 3, 9, 27, 81 , . . . , 3 n , . . . is an infinite sequence.  The terms of a sequence can be specified by providing a formula for each term of the sequence.  To specify the terms of a sequence a recurrence relation is used, which expresses each term as a combination of the previous terms. Overview
  • 4. Sequences 4  We use the notation {an} to describe the sequence and an represents an individual term of the sequence {an}.  We describe sequences by listing the terms of the sequence in order of increasing subscripts  Example: Consider the sequence {an}, where an =  List of the terms of this sequence, beginning with a1, namely, a1, a2, a3, a4, a5, a6, . . . , starts with 1, . . . . Definition
  • 5. Sequences 5  (1) an=n2 , where n= 1, 2, 3,…. What are the elements of sequence? 1, 4, 9, 16, 25,…  (2) an=(-1)n , where n= 0, 1, 2, 3, …. What are the elements of sequence? 1, -1, 1, -1, 1,…  (3) an=2n , where n= 0, 1, 2, 3, …. What are the elements of sequence? 1, 2, 4, 8, 16, 32, … Examples
  • 6. Sequences 6  An arithmetic progression is a discrete analogue of the linear function f (x) = dx + a.  The sequences {sn} with sn = −1 + 4n, is an arithmetic progression with initial term = -1, 2nd term = 3, and common difference = 4 if we start with n=0  The list of terms s0, s1, s2, s3, . . . begins with −1, 3, 7, 11, . . . Arithmetic Progression
  • 7. Sequences 7  Example: The sequences {tn} with tn = 7 - 3n, is an arithmetic progression with initial term = 7, 2nd term = 4, and common difference = -3, if we start with n=0  The list of terms t0, t1, t2, t3, . . . begins with 7, 4, 1, -2, . . . Arithmetic Progression
  • 8. Sequences 8  Given a sequence finding a rule for generating the sequence is not always straightforward.  Example: Assume the sequence: 1,3,5,7,9, …. What is the formula for the sequence?  Each term is obtained by adding 2 to the previous term. 1, 1+2=3, 3+2=5, 5+2=7, 7+2  It suggests an arithmetic progression: a+nd with a=1 and d=2 an=1+2n Arithmetic progression
  • 9. Sequences 9  A geometric progression is a discrete analogue of the exponential function f (x) =ark  The sequences {bn} with bn = (−1)n is a geometric progression with initial term=1, 2nd term = -1, and common ratio = -1, if we start at n = 0.  The terms b0, b1, b2, b3, b4, . . . begins with 1,−1, 1,−1, 1, . . . Geometric Progression
  • 10. Sequences 10  The sequences {cn} with cn = 2.5n is a geometric progression with initial term=2, 2nd term = 10, and common ratio = 5, if we start at n = 0.  The terms c0, c1, c2, c3, c4, . . . begins with 2, 10, 50, 250, 1250, …  The sequences {dn} with dn = 6.(1/3)n is a geometric progression with initial term=6, 2nd term = 2, and common ratio = 1/3, if we start at n = 0.  The terms d0, d1, d2, d3, d4, . . . begins with 6, 2, 2/3, 2/9, 2/27, … Geometric Progression
  • 11. Sequences 11  Assume the sequence: 1, 1/3, 1/9, 1/27, … What is the sequence?  The denominators are powers of 3. 1, 1/3= 1/3, (1/3)/3=1/(3*3)=1/9, (1/9)/3=1/27  This suggests a geometric progression: ark with a=1 and r=1/3 is (1/3 )n Geometric progression
  • 12. Sequences 12  In arithmetic and geometric progression, we specified sequences by providing explicit formulas for their terms.  There are many other ways to specify a sequence.  E.g., another way to specify a sequence is to provide one or more initial terms together with a rule for determining subsequent terms from those that precede them. Recurrence relation
  • 13. Sequences 13 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, namely, a0, a1, . . . , an−1, for all integers n with n ≥ n0, where n0 is a nonnegative integer. A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation. (A recurrence relation is said to recursively define a sequence. Recurrence relation The n-th element of the sequence {an} is defined recursively in terms of the previous elements of the sequence and the initial elements of the sequence.
  • 14. Sequences 14  The initial conditions for a recursively defined sequence specify the terms that precede the first term where the recurrence relation takes effect.  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?  Solution: We see from the recurrence relation that a1 = a0 + 3 = 2 + 3 = 5. It then follows that a2 = 5 + 3 = 8 and a3 = 8 + 3 = 11. Recurrence relation
  • 15. Sequences 15  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?  Solution: We see from the recurrence relation that a2 = a1 − a0 = 5 − 3 = 2 and a3 = a2 −a1 = 2 − 5 = −3.  We can find a4, a5, and each successive term in a similar way. Recurrence relation
  • 16. Sequences 16  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, . . . .  Solution: Suppose that an = 3n for every nonnegative integer n. Then, for n ≥ 2, we see that 2an−1 − an−2 = 2(3(n − 1)) − 3(n − 2) = 3n = an  Therefore, {an}, where an = 3n, is a solution of the recurrence relation. Recurrence relation
  • 17. Sequences 17  Example: Determine whether the sequence {an}, where an = 2n for every nonnegative integer n, is a solution of the recurrence relation an = 2an−1 − an−2 for n = 2, 3, 4, . . . .  Solution: Suppose that an = 2n for every nonnegative integer n. Note that a0 = 1, a1 = 2, and a2 = 4, because a2 =2a1 − a0 = 2 * 2 − 1 = 3, we see that {an}, where an = 2n , is not a solution of the recurrence relation. Recurrence relation
  • 18. Sequences 18  Example: Determine whether the sequence {an}, where an = 5  for every nonnegative integer n, is a solution of the recurrence relation an = 2an−1 − an−2 for n = 2, 3, 4, . . . .  Solution: Suppose that an = 5 for every nonnegative integer n. Then for n ≥ 2, we see that an = 2an−1 − an−2 = 2 ・ 5 − 5 = 5 = an  Therefore, {an}, where an = 5, is a solution of the recurrence relation. Recurrence relation
  • 19. Sequences 19  Many methods have been developed for solving recurrence relations.  Here, we will introduce a straightforward method known as iteration.  Solve the recurrence relation and initial condition with {an} be a sequence that satisfies the recurrence relation an = an−1 + 3 for n = 1, 2, 3, . . . .  Suppose that a1 = 2, and working upward until we reach an to deduce a closed formula for the sequence. (continue …) Recurrence relation
  • 20. Sequences 20  The first approach is called forward substitution – we found successive terms beginning with the initial condition and ending with an.  We see that a2 = 2 + 3 a3 = (2 + 3) + 3 = 2 + 3 * 2 = 2 + 2 *3 a4 = (2 + 2 * 3) + 3 = 2 + 3 * 3 … an = an−1 + 3 = (2 + 3 * (n − 2)) + 3 = 2 + 3(n − 1) (continue …) Recurrence relation
  • 21. Sequences 21  The second approach backward substitution starting with the term an and working downward until we reach the initial condition a1 = 2 to deduce this same formula.  The steps are an = an−1 + 3 = (an−2 + 3) + 3 = an−2 + 3 * 2 = (an−3 + 3) + 3 * 2 = an−3 + 3 * 3 ... = a + 3(n − 2) = (a + 3) + 3(n − 2) = 2 + 3(n − 1). Recurrence relation
  • 22. Sequences 22  Compound Interest Suppose that a person deposits $10,000 in a savings account at a bank yielding 11% per year with interest compounded annually. How much will be in the account after 30 years?  Solution: Let Pn denote the amount in the account after n years. Because the amount in the account after n years equals the amount in the account after n−1 years plus interest for the nth year, we see that the sequence {Pn} satisfies the recurrence relation Pn = Pn−1 + 0.11Pn−1 = (1.11)Pn−1 Recurrence relation
  • 23. Sequences 23  The initial condition is P0 = 10,000. We can use an iterative approach to find a formula for Pn. Note that P1 = (1.11) P0 P2 = (1.11) P1 = (1.11) 2 P0 P3 = (1.11) P2 = (1.11) 3 P0 ... Pn = (1.11)Pn−1 = (1.11)n P0  Initial condition P0 = 10,000, Pn = (1.11)n 10,000 is obtained.  n = 30, Pn = (1.11) n 10,000 30 Recurrence relation
  • 24. Sequences 24  A particularly useful sequence defined by a recurrence relation, known as the Fibonacci sequence.  The recurrence relation for the Fibonacci sequence tells us that we find successive terms by adding the previous two terms. Fibonacci sequence
  • 25. Sequences 25  Example: Find the Fibonacci numbers f2, f3, f4, f5, and f6.  Solution: The initial conditions tell us that f0 = 0 and f1 = 1, using the recurrence relation in the definition we find that f2 = f1 + f0 = 1 + 0 = 1, f3 = f2 + f1 = 1 + 1 = 2, f4 = f3 + f2 = 2 + 1 = 3, f5 = f4 + f3 = 3 + 2 = 5, f6 = f5 + f4 = 5 + 3 = 8. Fibonacci sequence
  • 26. Sequences 26  Suppose that {an} is the sequence of integers defined by an = n!, the value of the factorial function at the integer n, where n = 1, 2, 3, . . ..  Because n! = n((n − 1)(n − 2) . . . 2 * 1) = n(n − 1)! = nan−1, we see that the sequence of factorials satisfies the recurrence relation an = nan−1, together with the initial condition a1 = 1.  We have solved the recurrence relation together with the initial conditions when we find an explicit formula, called a closed formula, for the terms of the sequence. Fibonacci sequence
  • 27. Sequences 27  A common problem in discrete mathematics is finding a closed formula, a recurrence relation, or some other type of general rule for constructing the terms of a sequence.  Sometimes only a few terms of a sequence solving a problem are known; the goal is to identify the sequence.  Even though the initial terms of a sequence do not determine the entire sequence, knowing the first few terms may help you make an educated conjecture about the identity of your sequence. Once you have made this conjecture, you can try to verify that you have the correct sequence. Special integer sequences
  • 28. Sequences 28  When trying to deduce a possible formula, recurrence relation, or some other type of rule for the terms of a sequence when given the initial terms, try to find a pattern in these terms.  You might also see whether you can determine how a term might have been produced from those preceding it.  Are there runs of the same value? That is, does the same value occur many times in a row?  Are terms obtained from previous terms by adding the same amount or an amount that depends on the position in the sequence?  Are terms obtained from previous terms by multiplying by a particular amount?  Are terms obtained by combining previous terms in a certain way?  Are there cycles among the terms? Special integer sequences
  • 29. Sequences 29  Find formulae for the sequences with the following first five terms: 1, 1/2, 1/4, 1/8, 1/16.  Solution: We recognize that the denominators are powers of 2. The sequence with an = 1/2n , n = 0, 1, 2, . . . is a possible match. This proposed sequence is a geometric progression with initial a0 = 1 and common ratio r = 1/2. Special integer sequences
  • 30. Sequences 30  Find formulae for the sequences with the following first five terms: 1, 3, 5, 7, 9.  Solution: We note that each term is obtained by adding 2 to the previous term. The sequence with an = 2n + 1, n = 0, 1, 2, . . . is a possible match.  This proposed sequence is an arithmetic progression with initial a0 = 1 and d = 2. Special integer sequences
  • 31. Sequences 31  Find formulae for the sequences with the following first five terms: 1, −1, 1, −1, 1.  Solution: The terms alternate between 1 and −1.  The sequence with an = (−1)n , n = 0, 1, 2 . . . is a possible match. This proposed sequence is a geometric progression with initial a0 = 1 and r = −1. Special integer sequences
  • 32. Sequences 32  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?  Solution: 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. Special integer sequences
  • 33. Sequences 33  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?  Solution: In 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 a1 = 5 and d = 6.) Special integer sequences
  • 34. Sequences 34  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?  Solution: 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  This sequence is known as the Lucas sequence. Special integer sequences
  • 36. Sequences 36  If the first 10 terms of the sequence {an} are 1, 7, 25, 79, 241, 727, 2185, 6559, 19681, 59047, construct a formula for an .  Solution: We find that this ratio, although not a constant, is close to 3. So it is reasonable to suspect that the terms of this sequence are generated by a formula involving 3 n .  Comparing these terms with the corresponding terms of the sequence {3 n }, we notice that the nth term is 2 less than the corresponding power of 3.  We see that an = 3 n − 2 for 1 ≤ n ≤ 10 and this formula holds for all n. Special integer sequences
  • 37. Sequences 37  A sequence is also an important data structure in computer science.  Sequences of the form a1, a2, . . . , an are often used in computer science.  These finite sequences are also called strings and it is also denoted by a1a2 . . . an.  The length of a string is the number of terms in this string.  The empty string, denoted by λ, is the string that has no terms and has length zero. The string abcd is a string of length four. strings
  • 38. 38