homogeneous linear recurrences to solve such recurrences we must first know how to solve an easier...

19
Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type of recurrence relation: DEF: A linear recurrence relation is said to be homogeneous if it is a linear combination of the previous terms of the recurrence without an additional function of n or a constant. a n = 2a n-1 is homogeneous a n = 2a n-1 + 2 n-3 - a n-3 is not. b = 2b - b + 4b + 2 is not.

Upload: mercy-palmer

Post on 20-Jan-2018

212 views

Category:

Documents


0 download

DESCRIPTION

First Order Homogenous Recurrences Characteristic equation Using initial conditions: General Solution: Closed Form Solution: Quiz tomorrow from Solving Recurrence Relations

TRANSCRIPT

Page 1: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Homogeneous Linear Recurrences

To solve such recurrences we must first know how to solve an easier type of recurrence relation:

DEF: A linear recurrence relation is said to be homogeneous if it is a linear combination of the previous terms of the recurrence without an additional function of n or a constant.

an = 2an-1 is homogeneousan = 2an-1 + 2n-3 - an-3 is not.bk = 2bk-1 - bk-2 + 4bk-3 + 2 is not.

Page 2: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Homogeneous Linear Recurrences

To solve such recurrences we must first know how to solve an easier type of recurrence relation:

DEF: A linear recurrence relation is said to be homogeneous if it is a linear combination of the previous terms of the recurrence without an additional function of n or a constant.

an = 2an-1 is homogeneousan = 2an-1 + 2n-3 - an-3 is not.bk = 2bk-1 - bk-2 + 4bk-3 + 2 is not.

Page 3: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

First Order Homogenous Recurrences

032

1

0

kbbb

kk

3DCharacteristic equation

kk

kk

Ab

rootAb

)3(

)1(

Using initial conditions:

kkb )3(2

General Solution:

AAb

2)3( 0

0

Closed Form Solution:

2 0 26 1 618 2 1854 3 54162 4 162486 5 4861458 6 14584374 7 4374

Quiz tomorrow from Solving Recurrence Relations

Page 4: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Solving Homogenous Recurrences

Finding a closed form solution to a recurrence relation.

2281

21

1

0

naaaaa

nnn

12

0)1)(2(0)2()2(

0222

rr

rrrrrrrr

02

2

2

21

21

21

nnn

nnn

nn

nnn

rrr

rrr

ra

Letaaa

Multiply both sides by2 nr

02

0222122

22122

nnnnnn

nnnnnn

rrr

rrrrrr

022 rr Characteristic equation

roots

Page 5: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Example continued…The closed form solution is given by:

nnn

nnn

BAa

rootBrootAa

)1()2(

)2()1(

Where constants A and B are to determined by employing initial conditions. 8,1 10 aa

Plug in n = 0 in equation 1 to obtain:

Plug in n = 1 in equation 1 to obtain:

BABAa 1)1()2( 000

BABAa 28)1()2( 111

821

BABA

Adding the two equation, we get 2,393

BA

A

1

Let be the solution.

Page 6: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Example continued…By substituting A = 3 and B = -2 in equation 1, we get the final solution in the closed form:

nnna )1(2)2(3

Verification

98296)1(2)2(3

46248)1(2)2(3

26224)1(2)2(3

102121*24*3)1(2)2(3

826)1(2)2(3)1(2)2(3

123)1(2)2(3

)1(2)2(3

555

444

333

222

1

111

0

000

a

a

a

a

aa

aa

a nnn

9846261081

5

4

3

2

1

0

aaaaaa

Test Data

Page 7: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Example 2

210722

21

1

0

kbbbbb

kkk

5,20)5)(2(0107

1072

2

DDDDDD

DD

The closed form solution is given by:

kkk

kkk

BAb

rootBrootAb

)5()2(

)2()1(

Using initial conditions:

BABAb

BABAb

BAb kkk

522)5()2(

2)5()2(

)5()2(

111

000

38,

32522

2

AB

BABA

kkkb )5(

32)2(

38

Page 8: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Solution of Fibonacci Recurrence

Solve the quadratic equation:r 2

= r + 1r 2

- r - 1 = 0 to obtain r1 = (1+5)/2 r2 = (1-5)/2General solution:

an = A [(1+5)/2]n +B [(1-5)/2]n

211

21

1

0

naaaaa

nnn

Characteristic equation

Page 9: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Fibonacci Recurrence Use initial conditions a0 = 0, a1 = 1 to find A,B and obtain specific solution.

0=a0 = A [(1+5)/2]0 +B [(1-5)/2]0 = A +BThat is A +B = 0 --- (1)1=a1 = A [(1+5)/2]1 +B [(1-5)/2]1 = A(1+5)/2 +B (1-5)/2

= (A+B )/2 + (A-B )5/2That is (A+B )/2 + (A-B )5/2 = 1 or(A+B ) + (A-B )5 = 2 -- (2)

First equation give B = -A. Plug into 2nd:A = 1/5, B = -1/5Final answer:

nn

na

251

51

251

51

Page 10: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Case where the roots are identical

Finding a closed form solution to a recurrence relation when the roots are identical.

29631

21

1

0

kttttt

kkk

30)3(

096

96

2

2

2

DD

DD

DD

Test DataThe closed form solution is given by:

kkk

kkk

BkAt

rootBkrootAt

)3()3(

)2()1(

7292438127931

6

5

4

3

2

1

0

ttttttt

Page 11: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Where constants A and B are to determined by employing initial conditions.

I

Plug in k = 0 in equation 1 to obtain:

Plug in k= 1 in equation 1 to obtain:

.11)3(*0*)3( 00

0

AABAt

1333)3(*1*)3( 11

1

BABABAt

01

BA

31

)3()3(

1

0

tt

BkAt kkk

kkt )3(

Page 12: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

A variation of the previous Example

Finding a closed form solution to a recurrence relation when the roots are identical.

29630

21

1

0

kttttt

kkk

30)3(

096

96

2

2

2

DD

DD

DD

Test DataThe closed form solution is given by:

kkk

kkk

BkAt

rootBkrootAt

)3()3(

)2()1(

324811830

4

3

2

1

0

ttttt

Page 13: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Where constants A and B are to determined by employing initial conditions.

I

Plug in k = 0 in equation 1 to obtain:

Plug in k= 1 in equation 1 to obtain:

.00)3(*0*)3( 00

0

AABAt

1333)3(*1*)3( 11

1

BABABAt

10

BA

30

)3()3(

1

0

tt

BkAt kkk

kk kt )3(

324811830

4

3

2

1

0

ttttt

Page 14: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Relationship between Recurrence Relation and Sequences

Finding sequences that satisfy a recurrence relation.

2107 21 kbbb kkk

5,20)5)(2(0107

1072

2

DDDDDD

DD

Characteristic equation

The given recurrence is satisfied by the following sequences:

b0, b1, b2, ….

1, (2)1, (2)2, (2)3 , …

1, (5)1, (5)2, (5)3 , … 1, 2, 4, 8, …

1, 5, 25, 125, …

Or

Page 15: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Verification2107 21 kbbb kkk

1, 5, 25, 125, …

820282*104*7107

41*102*7107

123

2

012

bbbb

bbb

1, 2, 4, 8, …

125501755*1025*7107

251*105*7107

123

2

012

bbbb

bbb

Page 16: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Practice Problem

22332

21

1

0

kaaaaa

kkk

List first 5 terms of sequence generated by the recurrence.

Solve the recurrence in the close form.

Step 1: Write characteristic equation.Step 2: Find roots of the characteristic equation.Step 3: Write the general solution.

Step 4: Find constants A and B using boundary conditions.Step 5: Substitute constants in the general solution.

kkk rootBrootAa )2()1(

Page 17: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

Solving Recurrences using Spreadsheet

2359173365129257513

22332

21

1

0

kaaaaa

kkk

23=3*A2-2*A1=3*A3-2*A2=3*A4-2*A3=3*A5-2*A4=3*A6-2*A5=3*A7-2*A6=3*A8-2*A7=3*A9-2*A8

Page 18: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

3rd order Homogenous Recurrences

321 6116 rrrr aaaa

1,1,2

2

1

0

aaa

Characteristic equation

6116 23 DDD

06116 23 DDD

Roots D = 1, D = 2, and D = 3

General Solution:rrr

r CBAa )3()2()1(

Where A, B, and C are constants to be determined by using boundary conditions.Let r = 0

22

)3()2()1( 0000

CBACBA

CBAa

Let r = 1

132321

)3()2()1( 1111

CBACBA

CBAa

(I)

(II)

Page 19: Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type…

3rd order Homogenous Recurrences

Let r = 2

194941

)3()2()1( 2222

CBACBA

CBAa

We have to solve (I), (II), and (III) simultaneously for A, B, and C.

(III)

194 CBA

132 CBA

2 CBA

The solution is not complete.