Solution to homework#7, ICS6A, Winter, 1999
-- By Zhao, Hong


Textbook:

P315:
3. Is the sequence {an} a solution of the recurrence relation an = 8an-1 - 16an-2 if
a) an = 0?
Answer: Yes.
      an = 0, an-1 = 0, an-2 = 0
=> 8an-1 - 16an-2 = 0 = an

c) an = 2n?
Answer: No.
      an = 2n, an-1 = 2n-1, an-2 = 2n-2
=> 8an-1 - 16an-2 = 8*2n-1 - 16*2n-2 = 4*2n - 4*2n = 0 != an

e) an = n4n?
Answer: Yes.
      an = n4n, an-1 = (n-1)*4n-1, an-2 = (n-2)*4n-2
=> 8an-1 - 16an-2 = 8*(n-1)*4n-1 - 16*(n-2)*4n-2
                                  = 2*(n-1)*4n - (n-2)*4n
                                  = [ 2(n-1) - (n-2) ] *4n
                                  = n4n
                                  = an
 

h) an = n24n?
Answer: No.
       an = n24n, an-1 = (n-1)2*4n-1, an-2 = (n-2)2*4n-2
=> 8an-1 - 16an-2 = 8*(n-1)2*4n-1 - 16*(n-2)2*4n-2
                                  = 2*(n-1)2*4n - (n-2)2*4n
                                  = [ 2(n-1)2 - (n-2)2 ] *4n
                                  = ( 2n2 - 4n + 2 - n2 + 4n - 4) *4n
                                  = (n2 - 2)*4n
                                  != an
 
5. Find the solution to each of the following recurrence relations and initial conditions. Use an iterative approach such as that used in Example 5.
a) an = 3an-1 , a0  = 2
Answer: an = 2 * 3n

c) an = an-1 + n, a0  = 1
Answer: an = 1 + (n2+n)/2
an = an-1 + n
     = (an-2 + n-1) + n = an-2 + 2n - 1
     = (an-3 + n - 2 ) + 2n - 1=  an-3 + 3n - (1+2)
     = (an-4 + n - 3 ) + 3n - 3=  an-4 + 4n - (1+2+3)
     .
     .
     .
     = an-n + n*n - [1+2+3+ ... +(n-1)]
     = a0 + n2 - (n-1)(1+n-1)/2
     = 1 + n2 - (n2-n)/2
     = 1 + (n2+n)/2

e) an = 2an-1 - 1, a0  = 1
Answer: an  = 1
an = 2an-1 - 1
     = 2(2an-2 -1) - 1 = 22an-2 - (1+21)
     = 22(2an-3 - 1) - (20 +21)  =  23an-3 - (1+21+22)
     = 23(2an-4 - 1) - (20+21+22) =  24an-4 - (1+21+22+23)
     .
     .
     .
     = 2nan-n - (1+21+22+ ... +2n-1)
     = 2na0 - (1+21+22+ ... +2n-1)
     = 2n * 1 - (2n-1+1-1)/(2-1)
     = 2n - (2n-1)
     = 1
 
g) an = nan-1, a0  = 5
Answer: an  = 5 * n!
an = nan-1
     = n[(n-1)an-2] = n(n-1)an-2
     = n(n-1)[(n-2)an-3] =  n(n-1)(n-2)an-3
     .
     .
     .
     =  n(n-1)(n-2) ... 1 * an-n
     = n! * a0
     = 5 * n!
 

 

7. Suppose that the number of bacteria in a colony triples every hour.
a) Set up a recurrence relation for the number of bacteria after n hours have elapsed.
Answer: an = 3an-1, where an is the number of bacteria after n hours, and a0 is the number of bacteria used to begin a new colony.
 
b) If 100 bacteria are used to begin a new colony, how many bacteria will be in the colony in 10 hours?
Answer:  5,904,900
Repeat the same steps as that in the problem 5, part a,
an = 3an-1
     = 3*(3an-2) = 32 an-2
     = 32 * 3an-3 = 33 an-3
     .
     .
     .
     = 3n an-n
     = 3n a0
Where a0 = 100, so a10 = 310 a0 = 310 * 100 = 5,904,900
 
 

8. Assume that the population of the world in 1995 is 7 billion and is growing 3% a year.
a) Set up a recurrance relation for the population of the world n years after 1995.
Answer: an = an-1 + 3%an-1 = 1.03 * an-1, where an is the population of the world n years after 1995, and a0 is the  population of the world in 1995, which is 7 billion.

b) Find an exiplicit formula for the population of the world n years after 1995.
Answer:  an = 7 * 1.03n billion
Repeat the similary steps to that in the problem 5, part a,
an = 1.03an-1
     = 1.03*(1.03an-2) = 1.032 an-2
     = 1.032 * 1.03an-3 = 1.033 an-3
     .
     .
     .
     = 1.03n an-n
     = 1.03n a0
     = 7 * 1.03n
Where a0 = 7 billion.

c) What will be the population of the world be in 2010?
Answer: 10.9 billion
2010 - 1995 = 15
a15 = 7 * 1.0315 = 10.9 billion
 
 

11. Use mathematical induction to verify the formula derived in Example 5 for the number of moves required to complete the Tower of Hanoi puzzle.
Proof: We are going to prove Hn = 2n - 1, the recurrence relation is Hn = 2Hn-1 + 1 with H1 = 1.

 

30. A bus driver pays all tolls, using only nickels and dimes, by throwing one coin at a time into the mechanical toll collector.
a) Find a recurrence relation for the number of different ways the bus driver can pay a toll of n cents (where the order in which the coins are used matters).
Answer: Let an be the number of ways the bus driver can pay a toll of n cents by using nickels and dimes ( where the order in which the coins are used matters).

  1. If the toll can be devided by 5, i.e. n = 5k ( where k is a nonnegative integer ), then the number of ways the bus driver can pay a toll of n = 5k cents by using nickels and dimes is a5k.
  2. If the toll can't be devided by 5, i.e. n = 5k+1, 5k+2, 5k+3 or 5k+4 (where k is a nonnegative integer), then the number of ways the bus driver can pay n = 5k+1, 5k+2, 5k+3 or 5k+4 cents is a5(k+1).
So in convenience we denote ak be the number of ways the bus driver can pay a toll of n=5k cents by using nickels and dimes ( where the order in which the coins are used matters). So we got the recurrence relation: ak = ak-1 + ak-2, where a0 = 1, a1 = 1
 

b) In how many different ways can the driver pay a toll of 45 cents?
Answer: 55 ways.
       ak = ak-1 + ak-2, where a0 = 1, a1 = 1
      a0 = 1,
      a1 = 1,
      a2 = a0 + a1 = 1+1 = 2
      a3 = a1 + a2 = 1+2 = 3
      a4 = a2 + a3 = 2+3 = 5
      a5 = a3 + a4 = 3+5 = 8
      a6 = a4 + a5 = 5+8 = 13
      a7 = a5 + a6 = 8+13 = 21
      a8 = a6 + a7 = 13+21 = 34
      a9 = a7 + a8 = 21+34 = 55 ways
 
 

P324:
3. Solve the following recurrence relations together with the initial conditions given.
b) an = an-1 for n>=1, a0 = 2
Answer: Obvious result: an = 2
OR this is a linear homogeneous recurrence relation with degree 1. We can do it like this:
      c1 = 1,
      r - 1 = 0
=> r = 1,
      with the initial condition: a0 = 2
=> an = 2

d) an = 4an-1 - 4an-2 for n>=2, a0 = 6, a1 = 8
Answer: an = 6 * 2n - 2n * 2n
      c1 = 4, c2 = -4,
      r2 - 4r + 4 = 0
=> r1 = r2 = 2
=> an = b1 * 2n + b2 * n * 2n
      with the initial condition: a0 = 6, a1 = 8
=> 6 = b1 * 20 + b2 * 0 * 20 = b1
      8 = b1 * 21 + b2 * 1 * 21 = 2b1 + 2b2
=> b1 = 6, b2 = -2
=> an = 6 * 2n - 2n * 2n

f) an = 4an-2 for n>=2, a0 = 0, a1 = 4
Answer: an = 2n - (-2)n
      c1 = 0, c2 = 4,
      r2 - 4 = 0
=> r1 = 2, r2 = -2
=> an = b1 * 2n + b2 * (-2)n
      with the initial condition: a0 = 0, a1 = 4
=> 0 = b1 * 20 + b2 * (-2)0 = b1 + b2
      4 = b1 * 21 + b2 * (-2)1 = 2b1 - 2b2
=> b1 = 1, b2 = -1
=> an = 2n - (-2)n
 

 
4. Solve the following recurrence relations together with the initial conditions given.
a) an = an-1 + 6an-2 for n>=2, a0 = 3, a1 = 6
Answer: an = 3n * 12 / 5 + (-2)n * 3 / 5
      c1 = 1, c2 = 6,
      r2 - r - 6 = 0
=> r1 = 3, r2 = -2
=> an = b1 * 3n + b2 * (-2)n
      with the initial condition: a0 = 3, a1 = 6
=> 3 = b1 * 30 + b2 * (-2)0 = b1 + b2
      6 = b1 * 31 + b2 * (-2)1 = 3b1 - 2b2
=> b1 = 12/5, b2 = 3/5
=> an = 3n * 12 / 5 + (-2)n * 3 / 5
 

c) an = 6an-1 - 8an-2 for n>=2, a0 = 4, a1 = 10
Answer: an = 3 * 2n + 4n
      c1 = 6, c2 = -8,
      r2 - 6r + 8 = 0
=> r1 = 2, r2 = 4
=> an = b1 * 2n + b2 * 4n
      with the initial condition: a0 = 4, a1 = 10
=> 4 = b1 * 20 + b2 * 40 = b1 + b2
      10 = b1 * 21 + b2 * 41 = 2b1 + 4b2
=> b1 = 3, b2 = 1
=> an = 3 * 2n + 4n
 

e) an = an-2 for n>=2, a0 = 5, a1 = -1
Answer: an = 2 + 3 * (-1)n
      c1 = 0, c2 = 1,
      r2 - 1 = 0
=> r1 = 1, r2 = -1
=> an = b1 * 1n + b2 * (-1)n = b1 + b2 * (-1)n
      with the initial condition: a0 = 5, a1 = -1
=> 5 = b1 + b2 * (-1)0 = b1 + b2
      -1 = b1 + b2 * (-1)1 = b1 - b2
=> b1 = 2, b2 = 3
=> an = 2 + 3 * (-1)n
 

 
7. In how many ways can a 2*n rectangular board be tiled using 1*2 and 2*2 pieces?
Answer: Let an be the number of ways that 2*n rectangular board can be tiled using 1*2 and 2*2 pieces.
In order to tile the 2*n board from the 2*(n-1) board:

So we got the recurrence relation: an = which is 2*an-2 + an-1 + an-2 = an-1 + 2*an-2. where a0 = 1, a1 = 1
      c1 = 1, c2 = 2,
      r2 - r - 2 = 0
=> r1 = 2, r2 = -1
=> an = b1 * 2n + b2 * (-1)n
     with the initial condition: a0 = 1, a1 = 1
=> 1 = b1 * 20 + b2 * (-1)0 = b1 + b2
      1 = b1 * 21 + b2 * (-1)1 = 2b1 - b2
=> b1 = 2/3, b2 = 1/3
=> an = 2n * 2 / 3+ (-1)n / 3 = [ 2n+1 + (-1)n ] / 3
 
 

13. Find the solution to an = 7an-2 + 6an-3 with a0 = 9, a1 = 10, and a2 = 32
Answer: an = 8 * (-1)n + 4 * 3n - 3 * (-2)n
      c1 = 0, c2 = 7, c3 = 6
      r3 - 7r - 6 = 0
=> r3 - r - 6r - 6 = r(r2 - 1) - 6(r + 1) = r(r+1)(r-1) - 6(r+1) = (r+1)(r2 - r - 6) = (r+1)(r-3)(r+2) = 0
=> r1 = -1, r2 = 3, r2 = -2
=> an = b1 * (-1)n + b2 * 3n + b3 * (-2)n
     with the initial condition: a0 = 9, a1 = 10, a2 = 32
=> 9 = b1 * (-1)0 + b2 * 30 + b3 * (-2)0  = b1 + b2 + b3
      10 = b1 * (-1)1 + b2 * 31 + b3 * (-2)1  = -b1 + 3b2 - 2b3
      32 = b1 * (-1)2 + b2 * 32 + b3 * (-2)2  = b1 + 9b2 + 4b3
=> b1 = 8, b2 = 4, b2 = -3
=> an = 8 * (-1)n + 4 * 3n - 3 * (-2)n