CSC 10400 Discrete Mathematical Structures Lecture 10 Instructor: Pavel Rytir Email: rytirpavel@gmail.com The City College of New York Spring 2015 Section 10.1 The First-Order Linear Recurrence Relation First-order linear recurrence relation Homogeneous and nonhomogeneous recurrence relation Geometric Progression A geometric progression is an infinite sequence of numbers, such as 5, 15, 45, 135, . . ., where the division of each term, other than the first, by its immediate predecessor is a constant. One can define this geometric progression as: a0 = 5 an = 3an−1 (n > 0) Geometric Progression A geometric progression is an infinite sequence of numbers, such as 5, 15, 45, 135, . . ., where the division of each term, other than the first, by its immediate predecessor is a constant. One can define this geometric progression as: a0 = 5 an = 3an−1 (n > 0) FHowever, if we change the value of a0 to a0 = 7, we obtain a different geometric progression: 7, 21, 63, 189, . . .. Recurrence Relation Recurrence relation A recurrence relation is a function a(n), preferably written as an , where an depends on some of the prior terms an−1 , an−2 , . . . , a1 , a0 . Recurrence Relation Recurrence relation A recurrence relation is a function a(n), preferably written as an , where an depends on some of the prior terms an−1 , an−2 , . . . , a1 , a0 . First-order recurrence relation A recurrence relation is a first-order recurrence relation if an only depends on its immediate predecessor, an−1 . Recurrence Relation Recurrence relation A recurrence relation is a function a(n), preferably written as an , where an depends on some of the prior terms an−1 , an−2 , . . . , a1 , a0 . First-order recurrence relation A recurrence relation is a first-order recurrence relation if an only depends on its immediate predecessor, an−1 . Linear recurrence relation A recurrence relation is linear if each subscripted term appears to the first power. Recurrence Relation Recurrence relation A recurrence relation is a function a(n), preferably written as an , where an depends on some of the prior terms an−1 , an−2 , . . . , a1 , a0 . First-order recurrence relation A recurrence relation is a first-order recurrence relation if an only depends on its immediate predecessor, an−1 . Linear recurrence relation A recurrence relation is linear if each subscripted term appears to the first power. Boundary (initial) conditions The value a0 , given in addition to the recurrence relation, is called boundary condition, or initial condition. Unique Solution and General Solution Unique solution The recurrence relation an = 3an−1 with a0 = 5 determines a unique solution an = 5(3n ). Unique Solution and General Solution Unique solution The recurrence relation an = 3an−1 with a0 = 5 determines a unique solution an = 5(3n ). General solution The recurrence relation an = 3an−1 without specifying the value of a0 determines a general solution an = A(3n ). This general solution becomes unique when a0 = A is specified. Solutions For Geometric Progression For the recurrence relation defined as a0 = A an = dan−1 (n > 0) The unique solution is an = Ad n Problem Solve the recurrence relation a2 = 98 an = 7an−1 (n > 0) Answer Problem Solve the recurrence relation a2 = 98 an = 7an−1 (n > 0) Answer we have a2 = a0 (72 ) = 98, implying a0 = 2. Therefore, the unique solution is an = 2(7n ). Problem A bank pays 6% annual interest on savings, compounding the interest monthly. If Percy deposit 1000 dollars on the first day of May, how much will this deposit be worth a year later? Answer Problem A bank pays 6% annual interest on savings, compounding the interest monthly. If Percy deposit 1000 dollars on the first day of May, how much will this deposit be worth a year later? Answer The monthly rate is 6% 12 = 0.005. For 0 ≤ n ≤ 12, let pn denote the value of the deposit after the end of n months. We have p0 = 1000 and pn = pn−1 + 0.005pn−1 = 1.005pn−1 for n > 0. Therefore, the value of this deposit a year later is p12 = 1000×1.00512 ≈ 1061.68. Problem A positive integer n can be represented as a composition of positive integers. For example, 3 can be represented by 3 1+2 2+1 1+1+1 Let an count the number of compositions of n. How to compute an directly? Answer Problem A positive integer n can be represented as a composition of positive integers. For example, 3 can be represented by 3 1+2 2+1 1+1+1 Let an count the number of compositions of n. How to compute an directly? Answer A composite of n can generate two different compositions of n + 1: (1) by increasing the last summand by 1, e.g., from 1 + 2 to 1 + 3; or (2) by adding a new summand 1, e.g., from 1 + 2 to 1 + 2 + 1. Thus, we have an = 2an−1 for n > 1. Clearly, a1 = 1. We can set a0 = a21 = 12 , and have the recurrence relation an = 2an−1 with a0 = 12 . Therefore, an = 12 2n = 2n−1 . Homogeneous and Nonhomogeneous Recurrence Relations The general first-order linear recurrence relations with constant coefficients have the form an + can−1 = f (n) for n > 0, where c is a constant and f (n) is a function with domain Z+ . Homogeneous recurrence relation A recurrence relation is homogeneous if f (n) = 0. FExample: the geometric progression Nonhomogenous recurrence relation A recurrence relation is nonhomogeneous if f (n) 6= 0. FExample: an = an−1 + 3n Problem The bubble sort algorithm shown on blackboard (you can also google/wiki it) sorts a sequence of numbers. How many comparisons does the bubble sort algorithm execute to sort a sequence of n numbers? Answer In the first iteration, the algorithm executes n−1 comparisons, places the smallest number at the first position, and leaves n − 1 number unsorted. Let an be the number of comparisons executed in sorting n numbers. We have an = an−1 + (n − 1) for n ≥ 2, and a1 = 0. Problem The bubble sort algorithm shown on blackboard (you can also google/wiki it) sorts a sequence of numbers. How many comparisons does the bubble sort algorithm execute to sort a sequence of n numbers? Answer In the first iteration, the algorithm executes n−1 comparisons, places the smallest number at the first position, and leaves n − 1 number unsorted. Let an be the number of comparisons executed in sorting n numbers. We have an = an−1 + (n − 1) for n ≥ 2, and a1 = 0. Question How can we solve the recurrence relation: a1 = 0; an = an−1 + (n − 1), n ≥ 2 Problem Solve the recurrence relation: a1 = 0; an = an−1 + (n − 1), n ≥ 2 Answer Problem Solve the recurrence relation: a1 = 0; an = an−1 + (n − 1), n ≥ 2 Answer a1 = 0 a2 = a1 + (2 − 1) = 1 a3 = a2 + (3 − 1) = 1 + 2 a4 = a3 + (4 − 1) = 1 + 2 + 3 ...... an = an−1 + (n − 1) = 1 + 2 + 3 + . . . + (n − 1) Therefore, an = 1 + 2 + 3 + . . . + (n − 1) = n(n−1) . 2 Section 10.2 The Second-Order Linear Homogeneous Recurrence Relation with Constant Coefficients Second-order linear homogeneous recurrence relation Start From Recursive Definition Let us consider the following recursive definition. n=0 0 1 n=1 Fn = Fn−1 + Fn−2 n ≥ 2 This is the definition of well-known Fibonacci numbers. Start From Recursive Definition Let us consider the following recursive definition. n=0 0 1 n=1 Fn = Fn−1 + Fn−2 n ≥ 2 This is the definition of well-known Fibonacci numbers. Question How can we represent Fn directly? Second-order Linear Recurrence Relation General form of linear recurrence relations Let k, n ∈ Z+ with k ≤ n. Consider the following recurrence relation C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = f (n) where C0 , C1 , . . . , Ck are real numbers with C0 6= 0 and Ck 6= 0. This equation is the general form of a linear recurrence relation with constant coefficients of order k. Second-order Linear Recurrence Relation General form of linear recurrence relations Let k, n ∈ Z+ with k ≤ n. Consider the following recurrence relation C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = f (n) where C0 , C1 , . . . , Ck are real numbers with C0 6= 0 and Ck 6= 0. This equation is the general form of a linear recurrence relation with constant coefficients of order k. Second-order linear homogeneous recurrence relation with constant coefficients In this section, we only consider the recurrence relations defined as: C0 an + C1 an−1 + C2 an−2 = 0, n ≥ 2 Characteristic Equation Because the second-order recurrence function is extended from the first order recurrence relation (If C2 = 0, it becomes a first-order recurrence relation), we guess a solution as an = cr n where c, r 6= 0 (this guess may be not correct!). Characteristic Equation Because the second-order recurrence function is extended from the first order recurrence relation (If C2 = 0, it becomes a first-order recurrence relation), we guess a solution as an = cr n where c, r 6= 0 (this guess may be not correct!). By guessing an = cr n , we have C0 cr n + C1 cr n−1 + C2 cr n−2 = 0, or C0 r 2 + c1 r + C2 = 0 This quadratic equation is called the characteristic equation. The roots r1 and r2 of this equation are called characteristic roots. These roots r1 and r2 determine three cases: Characteristic Equation Because the second-order recurrence function is extended from the first order recurrence relation (If C2 = 0, it becomes a first-order recurrence relation), we guess a solution as an = cr n where c, r 6= 0 (this guess may be not correct!). By guessing an = cr n , we have C0 cr n + C1 cr n−1 + C2 cr n−2 = 0, or C0 r 2 + c1 r + C2 = 0 This quadratic equation is called the characteristic equation. The roots r1 and r2 of this equation are called characteristic roots. These roots r1 and r2 determine three cases: Case 1 (Distinct real roots): r1 and r2 are distinct real numbers. Characteristic Equation Because the second-order recurrence function is extended from the first order recurrence relation (If C2 = 0, it becomes a first-order recurrence relation), we guess a solution as an = cr n where c, r 6= 0 (this guess may be not correct!). By guessing an = cr n , we have C0 cr n + C1 cr n−1 + C2 cr n−2 = 0, or C0 r 2 + c1 r + C2 = 0 This quadratic equation is called the characteristic equation. The roots r1 and r2 of this equation are called characteristic roots. These roots r1 and r2 determine three cases: Case 1 (Distinct real roots): r1 and r2 are distinct real numbers. Case 2 (Distinct complex roots): r1 and r2 are not real numbers but complex numbers. Characteristic Equation Because the second-order recurrence function is extended from the first order recurrence relation (If C2 = 0, it becomes a first-order recurrence relation), we guess a solution as an = cr n where c, r 6= 0 (this guess may be not correct!). By guessing an = cr n , we have C0 cr n + C1 cr n−1 + C2 cr n−2 = 0, or C0 r 2 + c1 r + C2 = 0 This quadratic equation is called the characteristic equation. The roots r1 and r2 of this equation are called characteristic roots. These roots r1 and r2 determine three cases: Case 1 (Distinct real roots): r1 and r2 are distinct real numbers. Case 2 (Distinct complex roots): r1 and r2 are not real numbers but complex numbers. Case 3 (Repeated real root): r1 and r2 are real numbers but r1 = r2 . Case 1: Distinct Real Roots Let r1 and r2 be two distinct real roots of the characteristic equation C0 r 2 + C1 r + C2 = 0 corresponding to the recurrence relation: C0 an + C1 an−1 + C2 an−2 = 0, n ≥ 2 Case 1: Distinct Real Roots Let r1 and r2 be two distinct real roots of the characteristic equation C0 r 2 + C1 r + C2 = 0 corresponding to the recurrence relation: C0 an + C1 an−1 + C2 an−2 = 0, n ≥ 2 General Solution The general solution of the recurrence relation is: an = q1 r1n + q2 r2n Problem The Fibonacci number was defined recursively as: F0 = 0; F1 = 1; Fn = Fn−1 + Fn−2 , n ≥ 2 How to compute Fn directly? Answer Problem The Fibonacci number was defined recursively as: F0 = 0; F1 = 1; Fn = Fn−1 + Fn−2 , n ≥ 2 How to compute Fn directly? Answer The corresponding recurrence relation is: an − an−1 − an−2 = 0 with 2 a0 = 0 and a1 = 1. The characteristic √ relation is r √− r − 1 = 0. The characteristic roots are r1 = 1+2 5 and r2 = 1−2 5 . Thus, the √ √ general solution is:an = q1 ( 1+2 5 )n + q2 ( 1−2 5 )n . We use the initial √ 5 values and obtain a0 = 0 = q1 + q2 and a1 = 1 = q1 1+2 √ q2 1−2 5 , implying that q1 √ √ √1 ( 1+ 5 )n − √1 ( 1− 5 )n . 2 2 5 5 = √1 5 andq2 = − √15 . + Therefore, Fn = Problem Solve the recurrence relation: a0 = −1; a1 = 8; an + an−1 − 6an−2 = 0, n ≥ 2 Answer Problem Solve the recurrence relation: a0 = −1; a1 = 8; an + an−1 − 6an−2 = 0, n ≥ 2 Answer The characteristic equation is r 2 + r − 6 = 0, with roots r1 = 2 and r2 = −3. Thus, the general solution is an = q1 2n + q2 (−3)n . With a0 = −1 and a1 = 8, we have q1 = 1 and q2 = −2. Therefore, the solution is an = 2n − 2(−3)n . Problem In many programming languages, one may consider legal arithmetic expressions. Suppose we only consider the arithmetic expression made up of the digits 0, 1, . . . , 9 and binary operations +, ∗, / (no parenthesis). For example, 3 + 4 and 2 + 3 ∗ 5 are legal but 8 + ∗9 is not. We also consider the number 00735 a legal number as 00735 = 735. How many possible legal arithmetic expressions are made of n symbols? Answer Let an be the number of legal arithmetic expressions made of n symbols. We have a1 = 10 for 0, 1, . . . , 9 and a2 = 100 for 00, 01, . . . , 99. When n > 2, we construct a symbol by (1) adding a digit at the end of a legal equation of n − 1 symbols; and (2) adding a binary operator and a digit at the end of a legal equation of n − 2 symbols. For the first case, we have 10 choices. For the second case, we have 29 choices: +0, +1, . . . , +9, ∗0, ∗1, . . . , ∗9, /1, /2, . . . , /9. Thus, we have an = 10an−1 + 29an−2 . Answer Let an be the number of legal arithmetic expressions made of n symbols. We have a1 = 10 for 0, 1, . . . , 9 and a2 = 100 for 00, 01, . . . , 99. When n > 2, we construct a symbol by (1) adding a digit at the end of a legal equation of n − 1 symbols; and (2) adding a binary operator and a digit at the end of a legal equation of n − 2 symbols. For the first case, we have 10 choices. For the second case, we have 29 choices: +0, +1, . . . , +9, ∗0, ∗1, . . . , ∗9, /1, /2, . . . , /9. Thus, we have an = 10an−1 + 29an−2 . The characteristic equation is √r 2 − 10r − 29 = 0 with root √ r1 = 5 + 3 √ 6 and r2 = 5 −√3 6. Thus, the general solution is an = q1 (5 + 3 6)n + q2 (5 − 3 6)n . With a1 = 10 and a2 = 100, we 5 5 have a0 = (a2 − 10a1 )/29 = 0, implying q1 = 3√ and q2 = − 3√ . 6 6 √ √ 5 5 Therefore, the solution is: an = 3√ (5 + 3 6)n − 3√ (5 − 3 6)n . 6 6 Problem How many binary sequences of length n having no consecutive 0’s can we have? Answer Problem How many binary sequences of length n having no consecutive 0’s can we have? Answer Let an , bn , and cn be the number of binary sequences of length n with no consecutive 0’s which ends with either 0 or 1, ends with 0, and ends with 1 respectively. Clearly, an = bn + cn . First, a1 = 2 and a2 = 3. When n > 2, we can generate a sequence of length n from a sequence x of length n − 1. If x ends with 0, we can only add 1 at the end of x. If x ends with 1, we can either add 0 or 1 at the end of x. Thus, an = bn−1 + 2cn−1 . In addition, any binary sequence of length n − 2 can generate a sequence of length n−1 ending with 1, i.e., cn−1 = an−2 . Therefore, an = bn−1 +2cn−1 = (bn−1 +cn−1 )+c =a +a . Solve the √ n−1 √ n−1 √ n−2 √ 5+2 1+ 5 5−2 1− 5 n n recurrence relation, we have an = √5 ( 2 ) + √5 ( 2 ) . Case 2: Distinct Complex Roots Let r1 and r2 be two distinct complex roots (not real) of the characteristic equation C0 r 2 + C1 r + C2 = 0 corresponding to the recurrence relation: C0 an + C1 an−1 + C2 an−2 = 0, n ≥ 2 Case 2: Distinct Complex Roots Let r1 and r2 be two distinct complex roots (not real) of the characteristic equation C0 r 2 + C1 r + C2 = 0 corresponding to the recurrence relation: C0 an + C1 an−1 + C2 an−2 = 0, n ≥ 2 General Solution The general solution of the recurrence relation is: an = q1 r1n + q2 r2n Problem Solve the recurrence relation an = 2(an−1 − an−2 ) with a0 = 1 and a1 = 2. Answer Problem Solve the recurrence relation an = 2(an−1 − an−2 ) with a0 = 1 and a1 = 2. Answer The characteristic equation is r 2 − 2r + 2 = 0 with roots r1 = 1 + i and r2 = 1 − i. The general solution is an = q1 (1 + i)n + q2 (1 − i)n . Apply this general solution to a0 = 1 and a1 = 2, we have q1 = 1−i 2 1−i n + 1+i (1 − i)n . and q2 = 1+i . Therefore, a = (1 + i) n 2 2 2 DeMoivre’s Theorem A complex number x + yi can be rewritten as R(cos θ + i sin θ), p 2 where R = x + y 2 and θ = arctan( yx ). DeMoivre’s Theorem A complex number x + yi can be rewritten as R(cos θ + i sin θ), p 2 where R = x + y 2 and θ = arctan( yx ). DeMoivre’s Theorem (cos θ + i sin θ)n = cos nθ + i sin nθ Case 3: Repeated Real Roots Let r1 = r2 be the unique real root of the characteristic equation C0 r 2 + C1 r + C2 = 0 corresponding to the recurrence relation: C0 an + C1 an−1 + C2 an−2 = 0, n ≥ 2 Case 3: Repeated Real Roots Let r1 = r2 be the unique real root of the characteristic equation C0 r 2 + C1 r + C2 = 0 corresponding to the recurrence relation: C0 an + C1 an−1 + C2 an−2 = 0, n ≥ 2 General Solution The general solution of the recurrence relation is: an = q1 r1n + q2 nr1n = (q1 + q2 n)r1n Problem Solve the recurrence relation a0 = 2; a1 = 3; an = 4an−1 − 4an−2 , n ≥ 2 Answer Problem Solve the recurrence relation a0 = 2; a1 = 3; an = 4an−1 − 4an−2 , n ≥ 2 Answer The characteristic equation is r 2 − 4r + 4 = 0 with unique root r1 = r2 = 2. Thus, the general solution is an = (q1 + q2 n)2n . Apply this solution to a0 = 2 and a1 = 4, we have q1 = 2 and q2 = − 21 . Therefore, n an = (2 − )(2n ) 2 Section 10.3 The Nonhomogeneous Recurrence Relation First-order and second-order nonhomogeneous recurrence relation Solve some nonhomogeneous recurrence relations Nonhomogeneous Recurrence Relation Consider the nonhomogeneous linear recurrence relation with constant coefficients. C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = f (n) Nonhomogeneous Recurrence Relation Consider the nonhomogeneous linear recurrence relation with constant coefficients. C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = f (n) Bad New There is no general method to solve all nonhomogeneous relations! Nonhomogeneous Recurrence Relation Consider the nonhomogeneous linear recurrence relation with constant coefficients. C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = f (n) Bad New There is no general method to solve all nonhomogeneous relations! Good New For certain functions f (n), we can find a successful technique! The Recurrence Relation an − an−1 = f (n) Consider that a1 = a0 + f (1) a2 = a1 + f (2) a3 = a2 + f (3) . . . . . . an = an−1 + f (n) Thus, the general solution is: an = a0 + f (1) + f (2) + . . . + f (n) = a0 + n X i=1 f (i) Particular Solution Given a linear nonhomogeneous recurrence relation as C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = f (n) A particular solution is a solution to make the above equation valid. FExamples an = 3(3n ) is a particular solution of the recurrence relation an − an−1 = 2(3n ). an = 3(3n ) + 2 and an = 3(3n ) − 4 are both particular solutions of the recurrence relation an − an−1 = 2(3n ). Linear Nonhomogeneous Recurrence Relation Theorem Given a linear nonhomogeneous recurrence relation as C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = f (n) where C0 , C1 , . . . , Ck are constants with C0 , Ck 6= 0. The general solution of this nonhomogeneous relation is an = hn +pn , where hn is the general solution for the corresponding homogeneous recurrence relation C0 an + C1 an−1 + C2 an−2 + . . . + Ck an−k = 0 and pn is a solution of the nonhomogeneous recurrence relation, called the particular solution. Linear Nonhomogeneous Recurrence Relation Proof. Because pn is a particular solution, we have C0 pn + C1 pn−1 + C2 pn−2 + . . . + Ck pn−k = f (n) Because bn be another particular solution, we have C0 bn + C1 bn−1 + C2 bn−2 + . . . + Ck bn−k = f (n) Subtract the first of equation from the second equation, we have C0 (bn −pn )+C1 (bn−1 −pn−1 )+C2 (bn−2 −pn−2 )+. . .+Ck (bn−k −pn−k ) = 0 If follows that bn − pn is a solution of the corresponding homogeneous recurrence relation, say, hn . Consequently, bn = hn + pn for all n. Determine the Particular Solution pn Question How to determine pn ? Determine the Particular Solution pn Question How to determine pn ? Answer Make a reasonable guess suggested by f (n). Specified Solution Let an be a general solution. We say that bn is a specified solution of an , or a solution of an , if bn can be written in form of an by specifying appropriate constants in an . Specified Solution Let an be a general solution. We say that bn is a specified solution of an , or a solution of an , if bn can be written in form of an by specifying appropriate constants in an . FExample 3n is a specified solution of α(3n ) by setting α = 1. √ 3 2 2 n 2 n √is a specified solution of αn + β3 bye α = − 23 and β = 0. 3n3 is NOT a specified solution of αn2 + β3n . − setting Determine Particular Solution For an + C1 an−1 = kr n . If r n is not a specified solution on the general solution hn pn = βr n where β is a constant. If r n is a specified solution on the general solution hn pn = βnr n where β is a constant. Problem Solve the recurrence relation a0 = 2; an − 3an−1 = 5(7n ), n ≥ 1 Answer Problem Solve the recurrence relation a0 = 2; an − 3an−1 = 5(7n ), n ≥ 1 Answer The corresponding homogeneous relation is an − 3an−1 = 0 with general solution hn = α(3n ). Because 7n is not a specified solution of α(3n ), we can set pn = β(7n ). Apply the particular solution pn on the relation an − 3an−1 = 5(7n ), we have β(7n ) − 3β(7n−1 ) = 5(7n ), implying 7β − 3β = 5(71 ), i.e., β = 35 4 . Therefore, the general n solution is an = hn + pn = α(3n ) + β(7n ) = α(3n ) + 35 4 7 . Apply 27 this general solution with a0 = 2, we have α = − 4 . Therefore, 35 n n an = − 27 4 (3 ) + 4 (7 ). Problem Solve the recurrence relation a0 = 2; an − 3an−1 = 5(3n ), n ≥ 1 Answer Problem Solve the recurrence relation a0 = 2; an − 3an−1 = 5(3n ), n ≥ 1 Answer The corresponding homogeneous relation is an − 3an−1 = 0 with general solution hn = α(3n ). Because 3n is a specified solution of α(3n ), we can set pn = β(n3n ). Apply the particular solution pn on the relation an −3an−1 = 5(3n ), we have β(n3n )−3β((n−1)3n−1 ) = 5(3n ), implying βn−β(n−1) = 5, i.e., β = 5. Therefore, the general solution is an = hn + pn = α(3n ) + β(n3n ) = α(3n ) + 5n(3n ). Apply this general solution with a0 = 2, we have α = 2. Therefore, an = (2 + 5n)(3n ). Problem Consider the game “The Tower of Hanoi” shown on blackboard (you can google/wiki it). If we want to move n disks from leg 1 to leg 3, what is the minimum number of moves needed to do? Answer Problem Consider the game “The Tower of Hanoi” shown on blackboard (you can google/wiki it). If we want to move n disks from leg 1 to leg 3, what is the minimum number of moves needed to do? Answer Let an be the minimum number of moves to move n disks from one leg to another leg. It is easy to show that an = 2an−1 + 1, by moving n − 1 disks to an auxiliary leg. We have the recurrence relation an −2an−1 = 1. hn = α2n . Since 1 = 1(1n ) is not a specified solution of hn , pn = β(1n ) = β. Apply pn into an − 2an−1 = 1, we have β = −1. Thus, the general solution is an = α2n − 1. Apply this general solution with a1 = 1, we have α = 1. Therefore, the solution is an = 2n − 1. Determine Particular Solution For an + C1 an−1 + C2 an−2 = kr n . If r n is not a specified solution of the general solution hn pn = βr n If r n is a specified solution of the general solution hn If hn = c1 r1n + c2 r2n with r1 6= r2 pn = βnr n If hn = (c1 + c2 n)r1n pn = βn2 r n Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 5an−1 + 6an−2 = 10, n ≥ 2 Answer Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 5an−1 + 6an−2 = 10, n ≥ 2 Answer The corresponding homogeneous recurrence relation an − 5an−1 + 6an−2 = 0 has a general solution hn = α1 2n + α2 3n . Because 10 = 10(1n ) is not a specified solution of hn , we can set pn = β(1n ) = β. Apply the particular solution pn = β on an − 5an−1 + 6an−2 = 10, we have β − 5β + 6β = 10, i.e., β = 5. Thus, the general solution is an = α1 2n + α2 3n + 5. Apply this general solution with a0 = 1 and a1 = 2, we have α1 = −9 and α2 = 5. Therefore, an = −9(2n ) + 5(3n ) + 5. Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 5an−1 + 6an−2 = 3(2n ), n ≥ 2 Answer Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 5an−1 + 6an−2 = 3(2n ), n ≥ 2 Answer The corresponding homogeneous recurrence relation an − 5an−1 + 6an−2 = 0 has a general solution hn = α1 2n + α2 3n . Because 3(2n ) is a specified solution of hn , we can set pn = βn(2n ). Apply the particular solution pn = βn2n on an − 5an−1 + 6an−2 = 3(2n ), we have βn2n − 5β(n − 1)2n−1 + 6β(n − 2)2n−2 = 3(2n ), implying 4βn − 10β(n − 1) + 6β(n − 2) = 12, i.e., β = −6. Thus, the general solution is an = α1 2n + α2 3n − 6n2n . Apply this general solution with a0 = 1 and a1 = 2, we have α1 = −11 and α2 = 12. Therefore, an = −11(2n ) + 12(3n ) − 6n2n . Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 4an−1 + 4an−2 = 5(3n ), n ≥ 2 Answer Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 4an−1 + 4an−2 = 5(3n ), n ≥ 2 Answer The corresponding homogeneous recurrence relation an − 4an−1 + 4an−2 = 0 has a general solution hn = α1 2n +α2 n2n . Because 5(3n ) is not a specified solution of hn , we can set pn = β(3n ). Apply the particular solution pn = β3n on an −4an−1 +4an−2 = 5(3n ), we have β3n − 4β3n−1 + 4β3n−2 = 5(3n ), implying 9β − 12β + 4β = 45, i.e., β = 45. Thus, the general solution is an = α1 2n + α2 n2n + 45(3n ). Apply this general solution with a0 = 1 and a1 = 2, we have α1 = 45 n n n −44 and α2 = − 45 2 . Therefore, an = −44(2 ) − 2 n(2 ) + 45(3 ). Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 4an−1 + 4an−2 = 5(2n ), n ≥ 2 Answer Problem Solve the recurrence relation a0 = 1; a1 = 2; an − 4an−1 + 4an−2 = 5(2n ), n ≥ 2 Answer The corresponding homogeneous recurrence relation an − 4an−1 + 4an−2 = 0 has a general solution hn = α1 2n +α2 n2n . Because 5(2n ) is a specified solution of hn , we can set pn = βn2 (2n ). Apply the particular solution pn = βn2 2n on an − 4an−1 + 4an−2 = 5(2n ), we have βn2 2n − 4β(n − 1)2 2n−1 + 4β(n − 2)2 2n−2 = 5(2n ), implying 4βn2 − 8β(n − 1)2 + 4β(n − 2)2 = 20, i.e., β = 25 . Thus, the general solution is an = α1 2n + α2 n2n + 52 n2 2n . Apply this general solution with a0 = 1 and a1 = 2, we have α1 = 1 and α2 = −frac52. Therefore, an = 2n − 52 n2n + 25 n2 2n .
© Copyright 2024