💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## B.2 Solving Recurrences Using the Characteristic Equation We develop a technique for determining the solutions to a large class of recurrences. ### B.2.1 Homogeneous Linear Recurrences Definition A recurrence of the form ![](https://box.kancloud.cn/ab538a4baff455f3a2a1e75227a504aa_265x19.jpg) where *k* and the *ai* terms are constants, is called a ***homogeneous linear recurrence equation with constant coefficients.*** Such a recurrence is called "linear" because every term *ti* appears only to the first power. That is, there are no terms such as *t2n–i*, *tn–itn–j*, and so on. However, there is the additional requirement that there be no terms *tc(n–i)*, where *c* is a positive constant other than 1. For example, there may not be terms such as *tn/2*, *t*3(n–4), etc. Such a recurrence is called "homogeneous" because the linear combination of the terms is equal to 0. Example B.4**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**The following are homogeneous linear recurrence equations with constant co-efficients: ![](https://box.kancloud.cn/53a784ee4cceae2862dddf16592529c5_191x72.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.5**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**The Fibonacci sequence, which is discussed in [Subsection 1.2.2](LiB0009.html#43), is defined as follows: ![](https://box.kancloud.cn/b6d1a6955cc04c5eb414baf4a76538ff_161x91.jpg) If we subtract *tn*–1 and t*n*–2 from both sides, we get ![](https://box.kancloud.cn/543fcedc370fca5b127c287e1bf826ec_170x18.jpg) which shows that the Fibonacci sequence is defined by a homogeneous linear recurrence. Next we show how to solve a homogeneous linear recurrence. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.6**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**Suppose we have the recurrence ![](https://box.kancloud.cn/8c73827429eaee1df5e17292ef89aec1_314x91.jpg) Notice that if we set ![](https://box.kancloud.cn/a3a46f5dd6cfb03967dc8ecf96642360_66x20.jpg) then ![](https://box.kancloud.cn/71f4c9d251602a1d00790e20b2d68d7c_331x23.jpg) Therefore, *tn* = *rn* is a solution to the recurrence if *r* is a root of ![](https://box.kancloud.cn/8503af797a5d6127785e3513df321a4a_195x20.jpg) Because ![](https://box.kancloud.cn/465bc2c075aa52b1a7f5f3977a52bc82_331x26.jpg) the roots are *r* = 0, and the roots of **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** ![](https://box.kancloud.cn/8e71202b8aa4d3a5c183fdff9de235b3_371x23.jpg) These roots can be found by factoring: ![](https://box.kancloud.cn/b1911b52655ad05ab555c8a7a644ac02_261x23.jpg) The roots are *r* = 3 and *r* = 2. Therefore, ![](https://box.kancloud.cn/a6dd70a46e6febc52b79bd7366154759_273x20.jpg) are all solutions to the recurrence. We verify this for 3*n* by substituting it into the left side of the recurrence, as follows: ![](https://box.kancloud.cn/b2a9d5e5b1859563c3231a6ab824df38_164x74.jpg) With this substitution, the left side becomes ![](https://box.kancloud.cn/8f621c1f464b236bc7786eb274ac8f0b_400x49.jpg) which means that 3*n* is a solution to the recurrence. We have found three solutions to the recurrence, but we have more solutions, because if 3*n* and 2*n* are solutions, then so is ![](https://box.kancloud.cn/f71f72557ccce3f90deb62d6d972a3b2_139x19.jpg) where *c*1 and *c*2 are arbitrary constants. This result is obtained in the exercises. Although we do not show it here, it is possible to show that these are the only solutions. This expression is therefore the general solution to the recurrence. (By taking *c*1 = *c*2 = 0, the trivial solution *tn* = 0 is included in this general solution.) We have an infinite number of solutions, but which one is the answer to our problem? This is determined by the initial conditions. Recall that we had the initial conditions ![](https://box.kancloud.cn/a5e8ef1c11bd3fd9ec0650348840ed24_203x19.jpg) These two conditions determine unique values of *c*1 and *c*2 as follows. If we apply the general solution to each of them, we get the following two equations in two unknowns: ![](https://box.kancloud.cn/0c3483e93a83b2f27c27292f51bae166_167x52.jpg) These two equations simplify to ![](https://box.kancloud.cn/75a880db81a7eb368228e16a858ca9b9_111x46.jpg) The solution to this system of equations is *c*1 = 1 and *c*2 = −1. Therefore, the solution to our recurrence is ![](https://box.kancloud.cn/c41a0c552fc7e977dedca36107a3e9b9_241x22.jpg) If we had different initial conditions in the preceding example, we would get a different solution. A recurrence actually represents a class of functions, one for each different assignment of initial conditions. Let's see what function we get if we use the initial conditions ![](https://box.kancloud.cn/29a8ef83e427f89205f0588349beef8a_202x18.jpg) with the recurrence given in [Example B.6](#ap-bex7). Applying the general solution in [Example B.6](#ap-bex7) to each of these conditions yields ![](https://box.kancloud.cn/bfc0af65952cf1d1f3428433f3ac768b_166x51.jpg) These two equations simplify to ![](https://box.kancloud.cn/6ef50932dfba95140a9f13702462464f_112x45.jpg) The solution to this system is *c*1 = 0 and *c*2 = 1. Therefore, the solution to the recurrence with these initial conditions is ![](https://box.kancloud.cn/7de3c510116c6eb1d2a7437ff24ebecd_201x21.jpg) [Equation B.1](#ap-beqn01) in [Example B.6](#ap-bex7) is called the characteristic equation for the recurrence. In general, this equation is defined as follows. Definition The ***characteristic equation*** for the homogenous linear recurrence equation with constant coefficients ![](https://box.kancloud.cn/dca225d849d1a405ae530fef75044a32_261x18.jpg) is defined as ![](https://box.kancloud.cn/974d20228405849e5904f344090cdd1d_249x23.jpg) The value of *r0* is simply 1. We write the term as *r0* to show the relationship between the characteristic equation and the recurrence. Example B.7**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**The characteristic equation for the recurrence appears below it: ![](https://box.kancloud.cn/486f405e908bb7b76378126325c6f567_196x47.jpg) We use an arrow to show that the order of the characteristic equation is *k* (in this case, 2). **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** The steps used to obtain the solution in [Example B.6](#ap-bex7) can be generalized into a theorem. To solve a homogeneous linear recurrence with constant coefficients, we need only refer to the theorem. The theorem follows, and its proof appears near the end of this appendix. Theorem B.1**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**Let the homogeneous linear recurrence equation with constant coefficients ![](https://box.kancloud.cn/baf01f81540e883b766d22ad06b7d38a_262x20.jpg) be given. If its characteristic equation ![](https://box.kancloud.cn/f1cebd6269ae581a1d30ffc8a8a84d83_245x23.jpg) has *k* distinct solutions *r*1, *r*2, …, *rk*, then the only solutions to the recurrence are ![](https://box.kancloud.cn/cb0205c860a9a59f97ee3f7875a4b92a_237x22.jpg) where the *ci* terms are arbitrary constants. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** The values of the *k* constants *ci* are determined by the initial conditions. We need *k* initial conditions to uniquely determine *k* constants. The method for determining the values of the constants is demonstrated in the following examples. Example B.8**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/18a2309cb29e4e870d4d484eec9f91bc_314x91.jpg) 1. Obtain the characteristic equation: ![](https://box.kancloud.cn/e5c646ae72cf853301150efecf090357_188x49.jpg) 2. Solve the characteristic equation: ![](https://box.kancloud.cn/6adddf20d0f6ebc4c1f1d1b70fa920f0_261x24.jpg) The roots are *r* = 4 and *r* = −1. 3. Apply [Theorem B.1](#ap-bex9) to get the general solution to the recurrence: ![](https://box.kancloud.cn/efa7dd4cf61995bc79c07f6b926fa5fc_172x23.jpg) 4. Determine the values of the constants by applying the general solution to the initial conditions: ![](https://box.kancloud.cn/f8d2007ae7026deef96cf7d18f798288_200x55.jpg) These values simplify to ![](https://box.kancloud.cn/380269679fa2f56b133b67c9d18fe9b9_103x46.jpg) The solution to this system is *c*1 = 1/5 and *c*2 = −1/5. 5. Substitute the constants into the general solution to obtain the particular solution: ![](https://box.kancloud.cn/62a2d987fbfd6445dcfadf0df63d3c53_168x41.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.9**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence that generates the Fibonacci sequence: ![](https://box.kancloud.cn/8a3353b2723a5b28e8b86c5228f9372a_294x91.jpg) 1. Obtain the characteristic equation: ![](https://box.kancloud.cn/1eb467246db95406b6a4ae34749b775d_171x49.jpg) 2. Solve the characteristic equation: From the formula for the solution to a quadratic equation, the roots of this characteristic equation are ![](https://box.kancloud.cn/d625e081715c82ea2d62821b9b6f95d5_291x44.jpg) 3. Apply [Theorem B.1](#ap-bex9) to get the general solution to the recurrence: ![](https://box.kancloud.cn/bed368af36a1aaa77272bfe74f173e84_294x59.jpg) 4. Determine the values of the constants by applying the general solution to the initial conditions: ![](https://box.kancloud.cn/e6244ff1c6b1c04f59bc80323e520ec2_320x126.jpg) These equations simplify to ![](https://box.kancloud.cn/22b159c86f93725231560655ce778428_271x83.jpg) Solving this system yields ![](https://box.kancloud.cn/b9d4a09b5c33d4b9fc7b6cc27fef9ba1_224x23.jpg) 5. Substitute the constants into the general solution to obtain the particular solution: ![](https://box.kancloud.cn/bd66c1ef3f3068d1eb7605480200bc22_307x52.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Although [Example B.9](#ap-bex11) provides an explicit formula for the *n*th Fibonacci term, it has little practical value, because the degree of precision necessary to represent ![](https://box.kancloud.cn/bd66c1ef3f3068d1eb7605480200bc22_307x52.jpg) increases as *n* increases. [Theorem B.1](#ap-bex9) requires that all *k* roots of the characteristic equation be distinct. The theorem does not allow a characteristic equation of the following form: ![](https://box.kancloud.cn/5b0e31e45895d0e907fbceddb820ab2d_153x73.jpg) Because the term *r* − 2 is raised to the third power, 2 is called a ***root of multiplicity 3*** of the equation. The following theorem allows for a root to have a multiplicity. The proof of the theorem appears near the end of this appendix. Theorem B.2**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**Let *r* be a root of multiplicity *m* of the characteristic equation for a homogeneous linear recurrence with constant coefficients. Then ![](https://box.kancloud.cn/38aebe759d47256f988e066bc6df8dac_400x17.jpg) are all solutions to the recurrence. Therefore, a term for each of these solutions is included in the general solution (as given in [Theorem B.1](#ap-bex9)) to the recurrence. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example applications of this theorem follow. Example B.10**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/dd7a8d91a2e1eb05a5f8b6e8be3137eb_380x91.jpg) 1. Obtain the characteristic equation: ![](https://box.kancloud.cn/4f2df51e41c9d8804ff0902c53343db5_262x53.jpg) 2. Solve the characteristic equation: ![](https://box.kancloud.cn/19112b4ce98454897762b63d7e66ba6d_326x73.jpg) The roots are *r* = 1 and *r* = 3, and *r* = 3 is a root of multiplicity 2. 3. Apply [Theorem B.2](#ap-bex12) to get the general solution to the recurrence: ![](https://box.kancloud.cn/d17054cdfd851f7a968c64f92209be58_206x20.jpg) We have included terms for 3*n* and *n*3*n* because 3 is a root of multiplicity 2. 4. Determine the values of the constants by applying the general solution to the initial conditions: ![](https://box.kancloud.cn/329ddd4445f716d5b181107714702d01_270x84.jpg) These values simply to ![](https://box.kancloud.cn/26c9a9e8d88fb4139ff1ff6825c7475d_157x72.jpg) Solving this system yields *c*1 = −1, *c*2 = 1, and *c*3 = ⅓ 5. Substitute the constants into the general solution to obtain the particular solution: ![](https://box.kancloud.cn/c5613c4d193244dc39afb4d992ba1f1a_317x72.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.11**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/a88dcc0b21a06d4e4cdebf8da156cd55_379x91.jpg) 1. Obtain the characteristic equation: ![](https://box.kancloud.cn/7ae98157890deba39f5fef265468cd36_253x53.jpg) 2. Solve the characteristic equation: ![](https://box.kancloud.cn/671c079e97bcf5beae13585233cbb617_316x72.jpg) The roots are *r* = 3 and *r* = 1, and the root 1 has multiplicity 2. 3. Apply [Theorem B.2](#ap-bex12) to obtain the general solution to the recurrence: ![](https://box.kancloud.cn/da4411115b759fd936e0f48556ad01ae_206x20.jpg) 4. Determine the values of the constants by applying the general solution to the initial conditions: ![](https://box.kancloud.cn/deb9c5bb754cea5aeaa0b4fb056e775e_270x84.jpg) These equations simplify to ![](https://box.kancloud.cn/76d0190879bf5e315de6d5f0aa610676_151x69.jpg) Solving this system yields *c*1 = 0, *c*2 = 1, and *c*3 = 1. 5. Substitute the constants into the general solution to obtain the particular solution: ![](https://box.kancloud.cn/0add0843c546adada97f38cc90587f4e_231x46.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** ### B.2.2 Nonhomogeneous Linear Recurrences Definition A recurrence of the form ![](https://box.kancloud.cn/2827302ca4b9bc0e093c05e8a523517e_295x21.jpg) where *k* and the *ai* terms are constant and *f(n)* is a function other than the zero function, is called a ***nonhomogeneous linear recurrence equation with constant coefficients***. By the zero function, we mean the function *f*(*n*) = 0. If we used the zero function, we would have a homogeneous linear recurrence equation. There is no known general method for solving a nonhomogeneous linear recurrence equation. We develop a method for solving the common special case ![](https://box.kancloud.cn/0e112587e6845f119af583ea4ecc6427_400x20.jpg) where *b* is a constant and *p(n)* is a polynomial in *n*. Example B.12**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**The recurrence ![](https://box.kancloud.cn/e5b6545602b8852d5b50e29aef7f2d63_127x21.jpg) is an example of Recurrence B.2 in which *k* = 1, *b* = 4, and *p(n)* = 1. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.13**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**The recurrence ![](https://box.kancloud.cn/149a7de615cc18d739725e85efa87eca_194x21.jpg) is an example of Recurrence B.2 in which *k*=1, *b*=4, and *p*(*n*)= 8*n*+7. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** The special case shown in Recurrence B.2 can be solved by transforming it into a homogeneous linear recurrence. The next sample illustrates how this is done. Example B.14**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/0d12c62e6cf0b66eac11460b9d83178e_258x91.jpg) The recurrence is not homogeneous because of term 4*n* on the right. We can get rid of that term as follows: 1. Replace *n* with *n*–1 in the original recurrence so that the recurrence is expressed with 4*n*–1 on the right: ![](https://box.kancloud.cn/c6fe5516c20455e8c7159c4528bd3e0c_169x22.jpg) 2. Divide the original recurrence by 4 so that the recurrence is expressed in another way with 4*n*–1 on the right: ![](https://box.kancloud.cn/38f76271c1160c0ca85457f5135a7b58_157x39.jpg) 3. Our original recurrence must have the same solutions as these versions of it. Therefore, it must also have the same solutions as their differnce. This means we can get rid of the term 4*n*–1 by substracting the recurrence obtained in Step 1 from the recurrence obtained in Step 2. The result is ![](https://box.kancloud.cn/ac911f400d171927407197ee6f0f0467_194x41.jpg) We can multiply by 4 to get rid of the fractions: ![](https://box.kancloud.cn/fedc3af963e084a659a97fa429c0d46e_196x19.jpg) This is a homogeneous linear recurrence equation, which means that it can be solved by applying [Theorem B.1](#ap-bex9). That is, we solve the characteristic equation ![](https://box.kancloud.cn/1f7235c428f140e21954779be86ff28b_271x25.jpg) obtain the general solution ![](https://box.kancloud.cn/78eeb0bb739c52dd56a769b8d8c17814_139x20.jpg) and use the initial conditions *t*o = 0 and *t*1 = 4 to determine the particular solution: ![](https://box.kancloud.cn/ddff5148807bff6512a3281d9fa6b7be_154x23.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** In [Example B.14](#ap-bex17), the general solution has the terms ![](https://box.kancloud.cn/c3f323b39d5d877e0758e4f29436d677_176x20.jpg) The first term comes from the characteristic equation that would be obtained if the recurrence were homogeneous, whereas the second term comes from the nonhomogeneous part of the recurrence—namely, *b*. The polynomial *p(n)* in this example equals 1. When this is not the case, the manipulations necessary to transform the recurrence into a homogeneous one are more complex. However, the outcome is simply to give *b* a multiplicity in the characteristic equation for the resultant homogeneous linear recurrence. This result is given in the theorem that follows. The theorem is stated without proof. The proof would follow steps similar to those in [Example B.14](#ap-bex17). Theorem B.3**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**A nonhomogeneous linear recurrence of the form ![](https://box.kancloud.cn/23b6400ff42c647aa6380eed6483720d_304x21.jpg) can be transformed into a homogeneous linear recurrence that has the characteristic equation ![](https://box.kancloud.cn/3018f2b1702c2655522d5e7fad23ca23_310x29.jpg) where *d* is the degree of *p(n)*. Notice that the characteristic equation is composed of two parts: 1. The characteristic equation for the corresponding homogeneous recurrence 2. A term obtained from the nonhomogeneous part of the recurrence If there is more than one term like *b**n**p(n)* on the right side, each one contributes a term to the characteristic equation. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Before applying this theorem, we recall that the degree of a polynomial *p(n)* is the highest power of *n*. For example, ![](https://box.kancloud.cn/0c4519e49fd8f83662e30f1d05d8a7c8_246x97.jpg) Now let's apply [Theorem B.3](#ap-bex18). Example B.15**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/8f7ec2f14e8b5ad7b8f96754a0fb7d4d_324x91.jpg) 1. Obtain the characteristic equation for the corresponding homogeneous equation: ![](https://box.kancloud.cn/7fc00c059799b61773f6b46f21e82edb_123x49.jpg) 2. Obtain a term from the nonhomogeneous part of the recurrence: ![](https://box.kancloud.cn/ee1c7d005d147afebc9900376f032566_93x115.jpg) The term from the nonhomogeneous part is ![](https://box.kancloud.cn/2c7a36561ca790ed1f23da3f8523ae7f_190x26.jpg) 3. Apply [Theorem B.3](#ap-bex18) to obtain the characteristic equation from the terms obtained in Steps 1 and 2. The characteristic equation is ![](https://box.kancloud.cn/46080251023028c71f033fc1bdb750c9_127x25.jpg) After obtaining the characteristic equation, proceed exactly as in the linear homogeneous case: 4. Solve the characteristic equation: ![](https://box.kancloud.cn/8bf52a5dae98467bca5844418898bbc2_156x26.jpg) The roots are *r* = 3, and the root *r* = 4 has multiplicity 2. 5. Apply [Theorem B.2](#ap-bex12) to get the general solution to the recurrence: ![](https://box.kancloud.cn/6231c211816bb0656e2f7e863f14989e_205x20.jpg) We have three unknows, but only two initial conditions. In this case we must find another initial condition by computing the value of the recurrence at the next-largest value of *n*. In this case, that value is 2. Because ![](https://box.kancloud.cn/6d8aca06068e6efe21c851197d91c139_199x24.jpg) and *t*1 = 12, ![](https://box.kancloud.cn/d57d6784ebec35bed19a4d9e6229ce14_185x18.jpg) In the exercises you are asked to (6) determine the values of the constants and (7) substitute the constants into the general solution to obtain ![](https://box.kancloud.cn/d5f81631765e10402ebef60a488b40ca_236x21.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.16**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/ad732ee1ccf1a854d5fcdaf33ecd647a_271x69.jpg) 1. Obtain the characteristic equation for the corresponding homogeneous recurrence: ![](https://box.kancloud.cn/b55785dc99fb4644d6a25f609566dfc8_115x48.jpg) 2. Obtain a term from the nonhomogeneous part of the recurrence: ![](https://box.kancloud.cn/aeb5a020176950c2bc530fde1300e701_155x116.jpg) The term is ![](https://box.kancloud.cn/ea7276096f2ee83c6e9dd55e81b08a62_79x26.jpg) 3. Apply [Theorem B.3](#ap-bex18) to obtain the characteristic equation from the terms obtained in Steps 1 and 2. The characteristic equation is ![](https://box.kancloud.cn/675496629fa0f2277d19782c3f54b4d5_128x26.jpg) 4. Solve the characteristic equation: ![](https://box.kancloud.cn/f3086b664dfeaa3c941a77e65f1e7495_101x26.jpg) The root is *r* = 1, and it has a multiplicity of 3. 5. Apply [Theorem B.2](#ap-bex12) to get the general solution to the recurrence: ![](https://box.kancloud.cn/7bbda2c213083e6a706f3689da03c431_221x52.jpg) We need two more initial conditions: ![](https://box.kancloud.cn/82a2cc410e6eb57cc1782ac1c9892f0c_219x46.jpg) In the excercise you are asked to (6) determine the values of the constants and (7) substitute the constants into the general solution to obtain ![](https://box.kancloud.cn/ba282f2639523e991daffc00db41ba56_121x42.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.17**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/bf3fc32aad089d1006ae7e53ec7151e2_292x68.jpg) 1. Determine the characteristic equation for the corresponding homogeneous recurrence: ![](https://box.kancloud.cn/4c1d572c0cba254e90f6bcd52cde6dbd_123x49.jpg) 2. This is a case in which there are two terms on the right. As [Theorem B.3](#ap-bex18) states, each term contributes to the characteristic equation, as follows: ![](https://box.kancloud.cn/7b425b8eb2f7ab1bf9bdc82654f778d3_224x116.jpg) The two terms are ![](https://box.kancloud.cn/9661428ee9ef5345e7cc7a0c42bebfe2_274x27.jpg) 3. Apply [Theorem B.3](#ap-bex18) to obtain the characteristic equation from all the terms: ![](https://box.kancloud.cn/c59e1f87fd51877e6f526d0c3e3b70e3_332x26.jpg) You are asked to complete this problem in the exercises. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** ### B.2.3 Change of Variables (Domain Transformations) Sometimes a recurrence that is not in the form that can be solved by applying [Theorem B.3](#ap-bex18) can be solved by performing a change of variables to transform it into a new recurrence that is in that form. The technique is illustrated in the following examples. In these examples, we use *T*(*n*) for the original recurrence, because *t**k* is used for the new recurrence. The notation *T*(*n*) means the same things as *t**n*—namely, that a unique number is associated with each value of *n*. Example B.18**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/32d5050721732c150be47444064fd5c5_400x81.jpg) Recall that we already solved this recurrence using induction in [Section B.1](LiB0102.html#1371). We solve it again to illustrate the ***change of variables*** technique. The recurrence is not in the form that can be solved by applying [Theorem B.3](#ap-bex18) because of the term *n*/2. We can transform it into a recurrence that is in that form as follows. First, set ![](https://box.kancloud.cn/e1ab81d8fe4f9317e59f015ae2b0ab35_302x23.jpg) Second, substitute 2*k* for *n* in the recurrence to obtain ![](https://box.kancloud.cn/91003ab5b24ef7c1a72c8a47978b1331_398x88.jpg) Next, set ![](https://box.kancloud.cn/d5505fee26460da1331e6fd0fe026f2b_91x26.jpg) in Recurrence B.3 to obtain the new recurrence, ![](https://box.kancloud.cn/e02dab8bd8de0ee3d9248aaae6be8e57_112x20.jpg) This new recurrence is in the form that can be solved by applying [Theorem B.3](#ap-bex18). Therefore, applying that theorem, we can determine its general solution to be ![](https://box.kancloud.cn/bd61bdaf39a7588e094ba89baf85ac70_111x19.jpg) This general solution to our original recurrence can now be obtained with the following two steps: 1. Substitute *T*(2*k*) for *t**k* in the general solution to the new recurrence: ![](https://box.kancloud.cn/e734e0589acb6578bcb46bd79da2b85f_144x26.jpg) 2. Substitute *n* for 2*k* and lg *n* for *k* in the equation in Step 1: ![](https://box.kancloud.cn/ca52e5a2665acf21c35823cd8bef3ca3_157x21.jpg) Once we have the general solution to our original recurrence, we proceed as usual. That is, we use the initial condition *T*(1) = 1, determine a second initial condition, and then compute the values of the constants to obtain ![](https://box.kancloud.cn/66bcc7002689df53e62832705c923c94_132x21.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.19**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/c9b57d1b4d5b87dd2b6799c03658a5c1_400x75.jpg) Recall that we were unable to solve this recurrence using induction in [Example B.3](LiB0102.html#1378). We solve it here with a change of variables. First, substitute 2*k* for *n* to yield ![](https://box.kancloud.cn/c997c835427eb1c94e1e8b692a629213_228x78.jpg) Next, set ![](https://box.kancloud.cn/382a88a5a12f1243efaf66778836a993_90x26.jpg) in this equation to obtain ![](https://box.kancloud.cn/2b0cbdac0bd2da9cbe6ce38dcb0609e3_160x23.jpg) Apply [Theorem B.3](#ap-bex18) to this new recurrence to obtain ![](https://box.kancloud.cn/c90b4907cb1820f6a83855c4abd91c04_184x23.jpg) Perform the steps that give the general solution to the original recurrence: 1. Substitute *T*(2*k*) for *t**k* in the general solution to the new recurrence: ![](https://box.kancloud.cn/de8afbfa31511d7921ceaf36cf4c22fc_217x26.jpg) 2. Substitute *n* for 2*k* and lg *n* for *k* in the equation obtained in Step 1: ![](https://box.kancloud.cn/e680064eaa504bb3154176133fef9675_216x22.jpg) Now proceed as usual. That is, use the initial condition *T*(1) = 0, determine two more initial conditions, and then compute the values of the constants. The solution is ![](https://box.kancloud.cn/ee388a1439d618f98d892fded8e34854_195x21.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)** Example B.20**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We solve the recurrence ![](https://box.kancloud.cn/325fbd4070f3a196af43f2e45bb920cd_400x73.jpg) Substitute 2*k* for *n* in the recurrence to yield ![](https://box.kancloud.cn/de198d3cb2e51f15242c36b95c4b8eba_400x27.jpg) Set ![](https://box.kancloud.cn/e6494bc76ffedc27897c24b93e5d061a_91x26.jpg) in Recurrence (B.4) to obtain ![](https://box.kancloud.cn/aac84fb1e70457bdc147cf1320b929d2_196x29.jpg) This recurrence does not look exactly like the kind required in [Theorem B.3](#ap-bex18), but we can make it look like that as follows: ![](https://box.kancloud.cn/8c7ad0d87db7b11b56d38ea98e1506f4_188x110.jpg) Now apply [Theorem B.3](#ap-bex18) to this new recurrence to obtain ![](https://box.kancloud.cn/255146d200713dbad9bb3e82898ed0fb_137x23.jpg) Perform the steps that give the general solution to the original recurrence: 1. Substitute *T*(2*k*) for *t**k* in the general solution to *t**k*: ![](https://box.kancloud.cn/b41486f89130b357ba9a554dd3fdac11_171x26.jpg) 2. Substitute *n* for 2*k* and lg *n* for *k* in the equation obtained in Step 1: ![](https://box.kancloud.cn/467a423b515aa614d862b66e3d977bd6_186x53.jpg) Use the initial condition *T*(1) = 0, determine a second initial condition, and then compute the values of the constants. The solution is ![](https://box.kancloud.cn/f3cd3423ec5fe9bc1182a7e7f17c178f_283x24.jpg) **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**