Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Solving Recurrence Relations - Discrete Mathematics and its Applications - Lecture Slides, Slides of Discrete Mathematics

During the study of discrete mathematics, I found this course very informative and applicable.The main points in these lecture slides are:Solving Recurrence Relations, Homogeneous Recurrence Relation, Constant Coefficients, Nonlinear Function, Initial Conditions, Parameterized Form, Bank Problem, Impose Initial Value, Multiplicative Constants

Typology: Slides

2012/2013

Uploaded on 04/27/2013

atmaja
atmaja 🇮🇳

4.2

(45)

182 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture15
section 6.2
Solving Recurrence Relations
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Solving Recurrence Relations - Discrete Mathematics and its Applications - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

Lecture

section 6.

Solving Recurrence Relations

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:

n n k n k k

a c a c a c

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.

F a ( n −k)

G n ( ) n k n k a c a − =

Solving Linear RR (degree 1)

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)

Solving RR (degree 2)

-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. 1,

r = ±

Overview first and second degree

  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. ( ) n a n = d r ( )^1 1 2 2 n n a n = d r + d r 1 2 ( ) ( ) n a n = d +d n r

Higher Degree RR

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 1 1 ...^0 k k r c r ck − − − − = an = c a 1 n (^) − 1 + ...+c ak n −k 1 1 ... n n n k k a = d r + +d r 1 2 1 1 1,0 1,1 1, 1 1 2 1 2,0 2,1 2, 1 2 1 ,0 ,1 , 1 ( ... ) ( ... ) ..... ( ... ) t m n n m m n m mt n t t t m t a d d n d n r d d n d n r d d n d n r − − − − − − = + + +

For every distinct root we have an arbitrary polynomial of degree m(t)-1 in front.

Examples

a[n]=-3a[n-1]-3a[n-2]-a[n-3] a[0]=1, a[1]=-2, a[2]=- Insert r^n into RR: r^3 + 3r^2 + 3r + 1 = 0 (r+1)^3= General solution: a[n] = (d1+d2 n + d3 n^2) (-1)^n Initial conditions: d1 = 1 (d1+d2+d3) x (-1) = - (d1+4d2+9d3) x 1 = -  d1=1, d2=3,d3=- Final solution: a[n]=(1+3n-2n^2) x (-1)^n

Inhomogeneous Terms

1 1

n n k n k

a c a c a F 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

Finding Particular Solutions

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/ 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:

General Case

0 1 ( ) ( ... ) t n t F n = b + b n + + b n ×s 1 1

n n k n k

a c a c a F n

− −

0 1 ( ) t n n t b = p + p n + p n s 0 1 ( ) m t n n t b = n p + p n + p n s

One more example

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=2, m(r) = 2.
  4. Insert:  divide by 3^(n-2), match all powers of n, solve p0,p1,p
  5.  impose initial conditions, solve for d0, d1. 2 2 ( 0 1 2 ) 3 n bn = n p + p n + p n ( 0 1 ) 3 n an = d + d n +bn