- 109 Views
- Uploaded on
- Presentation posted in: General

Lecture15

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Lecture15

section 6.2

Solving Recurrence Relations

Recurrence Relations can take many forms, and most forms are hard,

if not impossible to solve. There are however a certain subset that can be

solved explicitly. They are of the form:

This is a linear, homogeneous recurrence relation of degree k with constant coefficients

-linear because we don’t have terms: with F(.) a nonlinear function.

-homogeneous because we don’t have terms: .

-degree k, because it depends on k terms in the past a(n-1) ... a(n-k).

- Note that the equation: is also of degree k (some c’s are zero).

-constant coefficients because c(k) does not depend on n.

Examples:

non-linear

no constant coefficients

non-homogeneous

Reminder:There can be more than one solution to a recurrence relation!

Only when the initial conditions are specified is the solution unique.

For a recurrence relation of degree k, you need k contiguous initial conditions.

The trick in many of these cases is to try out a parameterized form of a solution

and solve for the remaining parameters (educated guess, ansatz).

In the case of linear equation we have already seen the solution to the bank problem:

B(n) = c B(n-1)

= c^2 B(n-2)

= c^3B(n-3)

Now we can guess a solution: B(n) = d r^n stick into the equation:

d r^n=d c r^(n-1)

r=c

B(n) = d c^n

This is a solution for all values of `d’.

Now impose initial value:

B(0) = 1

d c^0 = 1

d=1 final solution B(n) = c^n (unique)

-For higher degree RR the idea is exactly the same: try a solution of the

d r^n.

Let’s try second degree: Fibonacci RR: F(n) = F(n-1) + F(n-2).

d r^n = d r^(n-1) + d r^(n-2)

multiplicative constants can never be determined by the RR (they will

be determined by the initial conditions).

r^n = r^(n-1) + r^(n-2) r^2 = r + 1 r^2-r-1=0

Two solutions! In fact any linear combination will be a solution:

F(n) = d1 r1^n + d2 r2^n (try it by inserting this solution in the RR).

d1 and d2 are free, but should be determined by the initial values:

F(0)=0 d1 + d2 = 0; F(1) = 1 d1 r1 + d2 r2 = 1.

This represents 2 linear equations with 2 unknowns: solve to find:

d1 = 1/sqrt(5) d2 = -1/sqrt(5).

Now the solution is unique.

What happens if we have a quadratic equation with 2 equal roots?

The solution we have a different form:

a(n) = (d1 + d2 n) r^n

This extra n factor is different!

Example: a(n) = 6 a(n-1) – 9 a(n-2) a0 = 1, a1 = 6.

Try r^n r^n = 6 r^(n-1) – 9 r^(n-2) r^2 – 6 r + 9 = 0 (r-3)^2=0 r=3 (2x).

So now the general form of the solution is: a(n) = (d1 + d2 n) 3^n

d1,d2 must follow from the initial conditions:

d1 = 1, (d1+d2) 3 = 6 d2 = 1. a(n) = (1 + n) 3^n.

1. determine if the RR is homogeneous, linear, const. coeff. and find it’s degree.

2. Insert a(n) = r^n into the equation and find the roots of the resulting

polynomial equation

degree 1 degree 2 (2 different roots) degree 2 (2 equal roots)

3. Determine the coefficients d, d1, d2 from the initial conditions.

Theorem: c1,...,ck real numbers with ck NOT 0.

Suppose the characteristic equation:

has k distinct roots r1,...,rk. Then the sequence {an} is a solution

of the recurrence relation:

if and only if for n=0,1,2,3,... and arbitrary constants d1,...,dk we have:

if we have t distinct roots, each with multiplicity m1,...mt

then the sequence {an} will be a solution iff

For every distinct root

we have an arbitrary

polynomial of degree

m(t)-1 in front.

a[n] = 6a[n-1]-11a[n-2]+6a[n-3] a[0]=2, a[1]=5, a[2]=15.

Insert r^n in the equation:

r^3 – 6r^2 + 11r – 6 = 0 = (r-1)(r-2)(r-3)=0

General form of solution:

a[n]=d1 1^n + d2 2^n + d3 3^n = d1 + d2 2^n + d3 3^n .

Initial condition give 3 linear equations to solve d1,d2,d3:

d1+d2+d3=2

d1+2d2+3d3=5

d1+4d2+9d3=15

d1 = 1, d2=-1, d3=2.

a[n]=1-2^n+2x3^n

a[n]=-3a[n-1]-3a[n-2]-a[n-3] a[0]=1, a[1]=-2, a[2]=-1

Insert r^n into RR:

r^3 + 3r^2 + 3r + 1 = 0 (r+1)^3=0

General solution:

a[n] = (d1+d2 n + d3 n^2) (-1)^n

Initial conditions:

d1 = 1

(d1+d2+d3) x (-1) = -2

(d1+4d2+9d3) x 1 = -1

d1=1, d2=3,d3=-2

Final solution: a[n]=(1+3n-2n^2) x (-1)^n

Linear, inhomogeneous RR of degree k with constant coefficients

Again, in general this is a hard problem, but for certain cases we can guess

a particular solution to the full equation.

Once we have one solution, we can immediately write down the general solution

according to:

Theorem: If {bn} is a particular solution to the inhomogeneous RR, and {an} is the

general solution to the associated homogeneous RR, then the general solution

to the inhomogeneous RR is given by: {gn} with gn = an+bn.

Proof: Show that gn-bn must be a solution to the homogeneous RR, which we know:

in full generality {an}. Thus gn = an+bn

This problem can be solved in the case:

n’th power of a

constant s

polynomial

Example: g[n]=3g[n-1]+2n. g1=3

Try a solution of the bn = c n+d c n+d = 3c(n-1)+3d+2n

c n = 3 c n + 2n

d = 3d-3c

c=-1 & d=-3/2

General solution: gn = -n-3/2 + d 3^n

the coefficients before every power of n must be equal.

Initial conditions: d=11/6

solution inhom. RR

solution hom. RR

Example: a[n]=5a[n-1]-6a[n-2] + 7^n

Now try bn = d 7^n as a solution:

Insert in the equation:

d 7^n = 5 d 7^(n-1) – 6 d 7^(n-2) + 7^n

7^2 d – 5x7d + 6d - 7^2 = 0

d = 49/20

General form for solution:

gn = d1 r1^n + d2 r2^n + 49/20 7^n

Now solve homogeneous equation to get:

r1 = 3, r2=2, d1,d2 arbitrary because we didn’t specify initial conditions.

Theorem:If we have a inhomogeneous RR of the form:

where:

then

a) if s is not a root of the characteristic equation of the associated

homogeneous equation then there exists a particular solution of the form:

b) If s is a root with multiplicity m then the following solution exists:

1) Determine of RR is linear with constant coefficients and determine degree.

2) Determine if inhomogeneous part fits the special form.

3) Solve associated homogeneous RR (determine roots by inserting r^n),

but leave the parameters d1,...dk undetermined.

4) Insert an trial particular solution and determine the parameters by inserting it in the RR.

(s is root with

multiplicity m)

(s is not a root)

This term is also there when s=1 is a root with mult. m.

5) Add particular solution and homogeneous part and determine d1,...dk from initial

conditions (if specified).

m1, m2,... are multiplicities roots r1, r2,...

d1,0, d1,1,...,dt,0, dt,1,... are determined

by imposing the initial conditions on this

beast (don’t forget to include bn)

+

a[n]=6a[n-1]-9a[n-2] + (n^2+1) 3^n a[0]=1, a[1]=2;

1) linear inhomogeneous RR with constant coefficients of degree k=2.

2) The inhomogeneous term fits the special form with: t=2, b0=1, b1=0, b2=1, s=3.

3) r^2-6r+9=(r-3)^2=0 r=3, m(r) = 2.

4) Insert: divide by 3^(n-2), match all powers of n, solve p0,p1,p2

5) impose initial conditions, solve for d0, d1.