[PDF] Recurrence Relations - Hong Kong University of Science and





Previous PDF Next PDF



CS 161 Lecture 3 - 1 Solving recurrences

Last class we introduced recurrence relations such as T(n) = 2T(?n/2?) + n. Typically Here a = 9



Discrete Mathematics II (Spring 2015) - 8.2 Solving Linear

Determine what is the degree of the recurrence relation. • Need to know the general solution equations. • Need to find characteristic equation. • Need to find 



Recurrences

n = 2k for some constant k and leaving out base case and constant in ?). Methods for solving recurrences. 1. Substitution method. 2. Iteration method.



Q1: Exercise 2.3-3 (10 points) Use mathematical induction to show

recurrence. T(n) =2 ifn=2. 2T(n/2) + n if n = 2k for k > 1 is T(n) = n logn. . Base Step: If n = 2



Master Theorem: Practice Problems and Solutions

The Master Theorem applies to recurrences of the following form: 2. T(n)=4T(n/2) + n2. 3. T(n) = T(n/2) + 2n. 4. T(n)=2nT(n/2) + nn.



GENERATING FUNCTIONS AND RECURRENCE RELATIONS

A recurrence recurrence relation is a set of equations Linear Recurrence. Fibonacci Sequence an = an?1 + an?2 n ? 2. ... n=2 n(n ? 1)xn +.



Solving Recurrences

For example the following recurrence (written in two different but standard ways) describes the identity function f (n) = n:.



1.1 Time complexity and Big-Oh notation: exercises

2. A quadratic algorithm with processing time T(n) = cn2 spends T(N) To have the well-defined recurrence assume that n = km with the integer.



Sample Induction Proofs

(?1)nn(n + 1). 2 . Base case: When n = 1 the left side of (1) is (?1)12 = ?1



3. Recurrence 3.1. Recursive Definitions. To construct a recursively

Example 3.2.1. The factorial function f(n) = n! is defined recursively as follows: 1. Initial Condition: f(0) = 1. 2. Recursion: f(n +1)=(n + 1)f(n).



Recurrence Relations - Hong Kong University of Science and

an= 2 n¡1; n ‚1: Given a recurrence relation for a sequence with initial conditions Solving the recurrence relation means to ?nd a formula to express the general termanof the sequence 2 Homogeneous Recurrence Relations Any recurrence relation of the form



Solving Recurrence Relations - Texas A&M University

n 2 and the base cases of the induction proof (which is not the same as the base case of the recurrence!) are n= 2 and n= 3 (We are allowed to do this because asymptotic notation only requires us to prove our statement for n n 0 and we can set n 0 = 2 ) We choose n= 2 and n= 3 for our base cases because when we expand the recurrence



Recurrence Relations - University of Ottawa

Many sequences can be a solution for the same recurrence relation a n = 2a n 1 a n 2; for n 2 The following sequences are solutions of this recurrence relation: I a n = 3n for all n 0 I a n = 5 for all n 0 The initial conditions for a sequence specify the terms before n 0 (before the recurrence relation takes e ect)



Solving Recurrence Relations - Princeton University

n 2 to be C0 and C1 Since the sequences fang and f 1rn 1 + 2r n 2g satisfy the degree 2 recurrence and agree on the rst two values they must be identical Example: Find the solution to the recurrence relation an = an 1 +an 2 with initial condi-tions a0 = 2 and a1 = 7 Solution: The characteristic equation is r2 r 2 = 0 i e (r 2)(r +1) = 0



Recurrence Relations - University of Illinois Urbana-Champaign

2 Recall that 1=nk= nk and we have rn 2(r25r + 6) = 0 Then we can factor the polynomial into rn 2(r 2)(r 3) = 0 We assumed that r is non-zero so we can divide by the rst factor rn 2 which leaves (r 2)(r 3) = 0 Thus the characteristic function (also: polynomial) remains on the left-hand side



Searches related to 2^n n^2 recurrence PDF

n = 2n for every nonnegative integer n is a solution of the recurrence relation a n = 2a n-1 - a n-2 for n = 234 Assume a 0=1 and a 1=2 Solution: Check initial conditions a 0= 20 = 1 a 1= 2 1 = 2 Check if {2n} satisfies a n = 2a n-1 - a n-2 2a n-1 - a n-2 = 2(2n-1) - 2n-2 = 2n-2(4-1) = 3(2n-2) 2n So {2n} is not a solution for a n = 2a

What is the solution of the recurrence relation?

.Thenasequence (a n ) is a solution of the recurrence relation a n= c 1a n?1+ c 2a n?2 if and only if a n= ? 1r n 1+ ? 2r n 2 for n ? 0 for some constants ? 1,? 2 Idea of the Proof The proof proceeds exactly as in the case of the Fibonacci numbers. Try to prove it yourself!

What is the solution of recurrence relation an = 10an-1 - 25an-2?

The solution of the recurrence relation an = 10an-1 - 25an-2, is: (a0 = 1, a1 = 15) Q8. Solution to recurrence relation T (n) = T (n - 1) + 4 is given by, where n > 0 and T (0) = 3.

What is a 2 nd-order linear recurrence?

This is a subset of the type of 2 nd -order recurrence formulas used by MCS . The Fibonacci number s are the best-known example of a 2 nd -order linear recurrence.

What is the initial condition for a recurrence relation?

So (a_n = 3a_ {n-1} + 2) is our recurrence relation and the initial condition is (a_0 = 1 ext {.}) We are going to try to solve these recurrence relations.

Recurrence Relations

1 In¯nite Sequences

An in¯nite sequence is a function from the set of positive integers to the set of real numbers or to the set of complex numbers.

Example 1.1.

The game ofHanoi Toweris to play with a set of disks of graduated size with holes in their centers and a playing board having three spokes for holding the disks.A BC The object of the game is to transfer all the disks from spokeAto spokeCby moving one disk at a time without placing a larger disk on top of a smaller one. What is the minimal number of moves required when there arendisks? Solution.Letanbe the minimum number of moves to transferndisks from one spoke to another. In order to movendisks from spokeAto spokeC, one must move the ¯rstn¡1 disks from spokeAto spokeBbyan¡1moves, then move the last (also the largest) disk from spokeAto spokeCby one move, and then remove then¡1 disks again from spokeBto spokeCbyan¡1moves. Thus the total number of moves should be a n=an¡1+ 1 +an¡1= 2an¡1+ 1: This means that the sequencefanjn¸1gsatis¯es the recurrence relation

½an= 2an¡1+ 1; n¸1

a

1= 1:(1)

1 Applying the recurrence relation again and again, we have a

1= 2a0+ 1

a

2= 2a1+ 1 = 2(2a0+ 1) + 1

= 2

2a0+ 2 + 1

a

3= 2a2+ 1 = 2(22a0+ 2 + 1) + 1

= 2

3a0+ 22+ 2 + 1

a

4= 2a3+ 1 = 2(23a0+ 22+ 2 + 1) + 1

= 2

4a0+ 23+ 22+ 2 + 1...

a n= 2na0+ 2n¡1+ 2n¡2+¢¢¢+ 2 + 1 = 2 na0+ 2n¡1:

Leta0= 0. The general term is given by

a n= 2n¡1; n¸1: Given a recurrence relation for a sequence with initial conditions. Solving the recurrence relation means to ¯nd a formula to express the general termanof the sequence.

2 Homogeneous Recurrence Relations

Any recurrence relation of the form

x n=axn¡1+bxn¡2(2) is called asecond order homogeneous linear recurrence relation.

Letxn=snandxn=tnbe two solutions, i.e.,

s

Then for constantsc1andc2

c

1sn+c2tn=c1(asn¡1+bsn¡2) +c2(atn¡1+btn¡2)

=a(c1sn¡1+c2tn¡1) +b(c1sn¡2+c2tn¡2):

This means thatxn=c1sn+c2tnis a solution of (2).

2 Theorem 2.1.Any linear combination of solutions of a homogeneous re- currence linear relation is also a solution. In solving the ¯rst order homogeneous recurrence linear relation x n=axn¡1; it is clear that the general solution is x n=anx0: This means thatxn=anis a solution. This suggests that, for the second order homogeneous recurrence linear relation (2), we may have the solutions of the form x n=rn:

Indeed, putxn=rninto (2). We have

r n=arn¡1+brn¡2orrn¡2(r2¡ar¡b) = 0:

Thus eitherr= 0 or

r

2¡ar¡b= 0:(3)

The equation (3) is called thecharacteristic equationof (2).

Theorem 2.2.

If the characteristic equation(3)has two distinct rootsr1 andr2, then the general solution for(2)is given by x n=c1rn1+c2rn2: If the characteristic equation(3)has only one rootr, then the general so- lution for(2)is given by x n=c1rn+c2nrn:

Proof.

When the characteristic equation (3) has two distinct rootsr1andr2it is clear that both x n=rn1andxn=rn2 are solutions of (2), so are their linear combinations.

Recall thatr=a§p

a 2+4b 2 . Now assume that (2) has only one rootr. Then a

2+ 4b= 0 andr=a=2:

3 Thus b=¡a24andr=a2: We verify thatxn=nrnis a solution of (2). In fact, ax n¡1+bxn¡2=a(n¡1)³a 2 n¡1+µ

¡a2

4 (n¡2)³a 2 n¡2 = [2(n¡1)¡(n¡2)]³a 2 n=n³a 2 n=xn: Remark.There is heuristic method to explain whyxn=nrnis a solution when the two roots are the same. If two rootsr1andr2are distinct but very close to each other, thenrn1¡rn2is a solution. So is (rn1¡rn2)=(r1¡r2). It follows that the limit lim r2!r1r n1¡rn2 r

1¡r2=nrn¡11

would be a solution. Thus its multiplexn=r1(nrn¡11) =nrn1by the constant r

1is also a solution. Please note that this isnota mathematical proof, but a

mathematical idea.

Example 2.1.

Find a general formula for theFibonacci sequence

8< :f n=fn¡1+fn¡2 f 0= 0 f 1= 1 Solution.The characteristic equationr2=r+ 1 has two distinct roots r

1=1 +p

5 2 andr2=1¡p 5 2

The general solution is given by

f n=c1Ã 1 +p 5 2 n +c2Ã

1¡p

5 2 n 4 Set (0 =c1+c2

1 =c1³

1+p5 2´ +c2³

1¡p5

We havec1=¡c2=1

p 5 . Thus f n=1 p 5 1 +p 5 2 n ¡1 p 5

1¡p

5 2 n ; n¸0: Remark.The Fibonacci sequencefnis an integer sequence, but it \looks like" a sequence of irrational numbers from its general formula above.

Example 2.2.

Find the solution for the recurrence relation

8< :x n= 6xn¡1¡9xn¡2 x 0= 2 x 1= 3

Solution.The characteristic equation

r

2¡6r+ 9 = 0()(r¡3)2= 0

has only one rootr= 3. Then the general solution is x n=c13n+c2n3n: The initial conditionsx0= 2 andx1= 3 imply thatc1= 2 andc2=¡1. Thus the solution is x n= 2¢3n¡n¢3n= (2¡n)3n; n¸0:

Example 2.3.

Find the solution for the recurrence relation

8< :x n= 2xn¡1¡5xn¡2; n¸2 x 0= 1 x 1= 5

Solution.The characteristic equation

r

2¡2r+ 5 = 0()(x¡1¡2i)(x¡1 + 2i) = 0

5 has two distinct complex rootsr1= 1+2iandr2= 1¡2i. The initial conditions imply that c

1+c2= 1c1(1 + 2i) +c2(1¡2i) = 5:

Soc1=1¡2i

2 andc2=1+2i 2 . Thus the solutions is x n=1¡2i 2

¢(1 + 2i)n+1 + 2i

2

¢(1¡2i)n

5 2 (1 + 2i)n+1+5 2 (1¡2i)n+1; n¸0: Remark.The sequence is obviously a real sequence. However, its general formula involves complex numbers.

Example 2.4.

Two persons A and B gamble dollars on the toss of a fair coin. A has $70 and B has $30. In each play either A wins $1 from B or loss $1 to B. The game is played without stop until one wins all the money of the other or goes forever. Find the probabilities of the following three possibilities: (a)

A wins all the money of B.

(b) A loss all his money to B. (c)

The game continues forever.

Solution.Either A or B can keep track of the game simply by counting their own money. Their positionn(number of dollars) can be one of the numbers

0;1;2;:::;100. Let

p n= probability that A reaches 100 at positionn. After one toss, A enters into either positionn+ 1 or positionn¡1. The new probability that A reaches 100 is eitherpn+1orpn¡1. Since the probability of A moving to positionn+1 orn¡1 fromnis1 2 . We obtain the recurrence relation 8< :p n=1 2 pn+1+1 2 pn¡1 p 0= 0 p

100= 1

First Method:The characteristic equation

r

2¡2r+ 1 = 0:

6 has only one rootr= 1. The general solutions is p n=c1+c2n: Applying the boundary conditionsp0= 0 andp100= 1, we have c

1= 0 andc2=1

100
Thus p n=n 100
;0·n·100:

Of course,pn=n

100
forn >100 is nonsense to the original problem. The probabilities for (a), (b), and (c) are 70%, 30%, and 0, respectively.

Second Method:The recurrence relationpn=1

2 pn+1+1 2 pn¡1can be written as p n+1¡pn=pn¡pn¡1: Then p Sincep0= 0, we havepn=pn¡1+p1. Applying the recurrence relation again and again, we obtain p n=p0+np1: Applying the conditionsp0= 0 andp100= 1, we havepn=n 100

3 Higher Order Homogeneous Recurrence Relations

For ahigher order homogeneous recurrence relation

quotesdbs_dbs11.pdfusesText_17
[PDF] la composante vivante dun milieu naturel

[PDF] les composantes de lenvironnement 6ème

[PDF] quelles sont les composantes de lenvironnement

[PDF] les composantes de l'environnement svt 6ème

[PDF] les composantes dun milieu naturel

[PDF] quelles sont les composantes dun milieu naturel

[PDF] les elements qui composent l'environnement

[PDF] les composantes de lenvironnement pdf

[PDF] 1.1.1 tenue des dossiers fournisseurs et sous-traitants

[PDF] 1.1.4 evaluation et suivi des stocks

[PDF] 1.2.3 traitement des devis des commandes

[PDF] 1.2.4 traitement des livraisons et de la facturation

[PDF] 1.3.1 suivi de la trésorerie et des relations avec les banques

[PDF] tenue des dossiers clients donneurs d ordre et usagers

[PDF] 2.2.3 suivi administratif des carrières