17
Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Embed Size (px)

Citation preview

Page 1: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Solving Recurrence Relations by Iteration

Lecture 36

Section 8.2

Mon, Apr 17, 2006

Page 2: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Solving Recurrence Relations

Our method will involve two steps.Guess the answer.Verify the guess, using mathematical

induction.

Page 3: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Guessing the Answer

Write out the first several terms, as many as necessary.

Look for a pattern. Two strategies

Do the arithmetic.• Spot the pattern in the resulting numbers.

Postpone the arithmetic.• Spot the pattern in the algebraic formulas.

Page 4: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Example: Do the Arithmetic

Define {an} by

a1 = 2,

an = 2an – 1 – 1, for all n 2.

Find a formula for an. First few terms: 2, 3, 5, 9, 17, 33, 65. Compare to: 1, 2, 4, 8, 16, 32, 64. Guess that an = 2n – 1 + 1.

Page 5: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Example: Postpone the Arithmetic

Define {an} by

a1 = 1,

an = 2an – 1 + 5, for all n 2.

Find a formula for an. First few terms: 1, 7, 19, 43, 91. What is an?

Page 6: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Example: Postpone the Arithmetic

Calculate a few termsa1 = 1.a2 = 2 1 + 5.a3 = 22 1 + 2 5 + 5.a4 = 23 1 + 22 5 + 2 5 + 5.a5 = 24 1 + 23 5 + 22 5 + 2 5 + 5.

It appears that, in general,an = 2n – 1 + (2n – 2 + 2n – 3 + … + 1) 5.

Page 7: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Lemma: Geometric Series

Lemma: Let r 1. Then

.1

11

12

r

rrrr

nn

Page 8: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Example: Postpone the Arithmetic

an = 2n – 1 + (2n – 2 + 2n – 3 + … + 1) 5

= 2n – 1 + (2n – 1 – 1)/(2 – 1) 5

= 2n – 1 + (2n – 1 – 1) 5

= 2n – 1 + 5 2n – 1 – 5

= 6 2n – 1 – 5

= 3 2n – 5.

Page 9: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Example: Future Value of an Annuity

Define {an} by

a0 = d,

an = (1 + r)an – 1 + d, for all n 1.

Find a formula for an.

a1 = (1 + r)d + d.

a2 = (1 + r)2d + (1 + r)d + d.

a3 = (1 + r)3d + (1 + r)2d + (1 + r)d + d.

Page 10: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Example: Future Value of an Annuity

It appears that, in general,

an = (1 + r)nd + … + (1 + r)d + d

= d((1 + r)n + 1 – 1)/((1 + r) – 1)

= d((1 + r)n + 1 – 1)/r.

Page 11: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Verifying the Answer

Use mathematical induction to verify the guess.

Page 12: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Verifying the Answer

Define {an} by

a1 = 1,

an = 2an – 1 + 5, for all n 2.

Verify, by induction, the formula

an = 3 2n – 5,

for all n 1.

Page 13: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Future Value of an Annuity

Verify the formula

an = d((1 + r)n + 1 – 1)/r

for all n 0, for the future value of an annuity.

Page 14: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Solving First-Order Linear Recurrence Relations

A first-order linear recurrence relation is a recurrence relation of the form

an = san – 1 + t, n 1,

with initial condition

a0 = u,

where s, t, and u are real numbers.

Page 15: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Solving First-Order Linear Recurrence Relations

Theorem: Depending on the value of s, the recurrence relation will have one of the following solutions: If s = 0, the solution is a0 = u, an = t, for all n 1.

If s = 1, the solution is an = u + nt, for all n 0. If s 0 and s 1, then the solution is of the form

an = Asn + B, for all n 0,

for some real numbers A and B.

Page 16: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Solving First-Order Linear Recurrence Relations

To solve for A and B in the general case, substitute the values of a1 and a2 and solve the system for A and B.

a0 = A + B = u

a1 = As + B = su + t

Page 17: Solving Recurrence Relations by Iteration Lecture 36 Section 8.2 Mon, Apr 17, 2006

Example

Solve the recurrence relation

a1 = 1,

an = 2an – 1 + 5, n 2. Solve the recurrence relation

a0 = d,

an = (1 + r)an – 1 + d, n 1.