Docsity

Solving Recurrence Relations: Techniques and Examples - Prof. Dali Wang, Study notes of Discrete Structures and Graph Theory

Partial preview of the text

Download Solving Recurrence Relations: Techniques and Examples - Prof. Dali Wang and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

Solving Recurrence Relations

(Section 6.2 of the Text)

Solving Recurrence Relations

Review

  • nth degree polynomials have n roots

a

n^

x

n^

a

n-

x

n-

a

x 1

a

0

  • If the coefficients are real then the roots

are real or occur in complex conjugatepairs

  • Recall the

quadratic formula

ax

2

bx

c

0 then

a

ac

b b

x^

2

4 2 − ± − =

Solving Recurrence Relations

Statement of the Problem

  • If

a

g (

n )

f

a

g(0)

a

g(1)

a

g(n-1)

) find a closed

form or an expression for

a

g(n)

  • Example:

f(n) = 3

n^

f(0) = 1, f(n) = 3f(n-1)

Solving Recurrence Relations

Form of Recurrence Equations

-^

Solving recurrence relations can be very difficultunless the recurrence equation has a specialform:–

g(n) = n

(single variable)

  • the equation is

linear

:

  • sum of previous terms• no transcendental functions of the

ai

' s

  • no products of the

ai'

s

constant

coefficients: the coefficients in the sum of the

ai

' s are constants, independent of n.

Solving Recurrence Relations

Form of Recurrence Equations

(cont.)

A recurrence relation

a

n^

= f(a

n-

,... , a

n-k

has

degree k

if the function f depends on the

term a

n-k

and if it depends on no terms of lower

index. It is

linear

of degree k if it has the form

a

n^

= c

a 1

n-

  • c

a 2

n-

  • · · · + c

ak

n-k

  • g(n)

where each c

k^

is a real function and c

k^

≠^

  1. It is

homogenous

if g(n) = 0.

Solving Recurrence Relations

Examples

a

n^

=

na

n −

1

n

2 a

n −

2

a

n −

a 1

n −

2

a

= n^

ca

n / m

b

a

= n^

a

n −

  • 1

a

n −^2

a

n −

  • 3

2

n-

a

= n^

(1.02)

a

n −

  • 1

2

n-

a

= n^

(1.02)

a

n −^1

degree

homo-geneous

const.coef.

linear

Solving Recurrence Relations

Solution Procedure

-^

Equation:

k-

LiHoReCoCo

a^ n

= c

a 1

n-

  • c

a 2 n-

  • · · · + c

ak

n-k

-^

Steps: 1.^

Put all a

's on the left side of the equation,i

everything else on the right. If nonhomogeneous,stop (for now). a

n^

-^

c^1

an

c

a 2

n -

-... -

ck

a n

  • k

= 0

Assume a solution of the form

a

n^

= b

n.

Substitute the solution into the equation, factor outthe lowest power of b and eliminate it. n b

−

c

1 b

n-

−

c

2 b

n-

−

...

−

c^ k

n-k b

=

0

n-k b

[ b

k^ −

c

1 b

k-

−...

−

c^ k

]^

=^

0

Solving Recurrence Relations

Solution Procedure (cont.)

-^

Steps3.^

The remaining polynomial of degree k, k b

−

c

b 1 k^ −

1 −

...

−

c

k

is called the

characteristic polynomial.

The

corresponding equation is called

characteristic

equation

.

Find its k roots,

r

, 1 r

,... , 2

r

. k

If the roots are distinct, the

general solution

is:

an

= α

r 1 n^ 1

  • α

r 2

n + 2

...

+α

rk k n

Solving Recurrence Relations

Examples

  • Solving the recurrence equation:

a

n^

= 3a

n-

, a

0

  • Solution:
    • Step 1: Bring subscripted variables to one

side:

an

-3a

n-

= 0.

  • Step

2:

Substitute a

n^

= b

n^

and factor lowest

power of b: b

n-

(b-3) = 0 or b-3 = 0

  • Step

3:

Find the root of the characteristic

equation: r

1

= 3

Solving Recurrence Relations

Examples (cont.)

  • Solution (cont.)
    • Step 4: Compute the general solution:

an

= c

n

  • Step 5: Find the constants based on the initial

conditions: a^0

= c(

0 ) or c = 4

  • Finally

:^

Produce the specific solution:

an

= 4(

n^ )

Solving Recurrence Relations

16

The Case of Degenerate Roots• If a root

r

1

has multiplicity p, then the

solution corresponding the root is: (α

  • α 1

n 2

+α

np

p-

) r

n 1

  • For quadratic case: if the characteristic

equation

r

2

c

r 1

c

2

= 0 has only 1 root

r

then,

a

n^

α

r 1

n 0

α

nr 2

n 0 , for all

n

for some constants

α

α

Solving Recurrence Relations

Examples

  • Solving the recurrence equation:

a

n^

a

n-

a

n −

2

,^

a

0

a

1