Discrete Structures

Lecture Notes, 19 Nov 2010

Last Update: 22 November 2010

Note: NEW or UPDATED material is highlighted


Note: A username and password may be required to access certain documents. Please contact Bill Rapaport.


Index to all lecture notes
…Previous lecture


§§7.1–7.2: Recurrence Relations


  1. Recurrence Relations:

    1. A sequence can be defined in two different ways:

      1. non-recursively ("explicitly"),
        in terms of its current I/P:

          an = f(n)

      2. recursively,
        by giving initial conditions (first few terms)

          a0 = C0, …, an–1 = Cn–1

        & a recurrence relation that defines the sequence in terms of its previous O/P:

          an = h(a0 = C0, …, an–1)

    2. Question: Given initial conditions & recurrence relation an = h(a0 = C0, …, an–1),
      (how) can we compute the explicit formula f(n)?

      • This is called "solving" the recurrence relation.

    3. E.g.)

      1. initial conditions:

          a0 = C0
          a1 = C1

        recurrence relation:

          an = 3an–1 – 2an–2, ∀ n ≥ 2

      2. Lots of different sequences share this pattern,
        differing only in their initial conditions

        1. Given the initial conditions,
          we can compute the nth term (n ≥ 2)
          without knowing what the function does to its I/P!

        2. We compute it on the basis of what it did:
          we compute it on the basis of what its previous O/P was!

        3. Here are some examples:
            (initial conditions are in the first 2 rows;
            last row shows "explicit" "solution",
            i.e.) def in terms of I/P)

          a0 0 0 1 1 1 2 2
          a1 0 1 0 1 2 1 2
          a2 0 3 –2 1 4 –1 2
          a3 0 7 –6 1 8 –5 2
          a4 0 15 –14 1 16 –13 2
          a5 0 –30 1
          an 0 2n–1 2–2n 1 2n 3–2n 2

    4. What good are recurrence relations?

      1. They describe similar patterns of growth,
        based on differing initial conditions or "seeds"

      2. E.g.) compound interest:

        • 2 people deposit different amounts of $ in same bank;
          ∴ same recurrence relation computes their interest;

          But the actual interest depends on their initial deposit!


  2. So the question is: How to "solve" a recurrence relation.

    1. Def:

        A linear, homogeneous, recurrence relation of degree 2
        with constant coefficients
          isdef
        a recurrence relation of the form

          an = c1an–1 + c2an–2

        where c1, c2R & c2 ≠ 0

        1. See text for complete def of linear homogeneous recurrence relation of degree k with constant coefficients.
        2. "linear": no exponents
        3. "homogeneous": all terms are multiples of the ai
          • Note: pronounced "homoJEENee-us",
            not "hoMOJenus", with 5 syllables

        4. "constant coefficients":
            they are not functions of n;
            they are constants

    2. This determines a family of sequences
      that differ only in their initial conditions.

      • E.g.) The Fibonacci recurrence relation:

          fn = fn–1 + fn–2

        is a linear homegeneous recurrence relation of degree 2
        and can have differing intial conditions,
        yielding different Fibonacci sequences:

        1. f0 = 0 & f1 = 1 yields:

            0,1,1,2,3,5,…

        2. f0 = 1 & f1 = 1 yields:

            1,1,2,3,5,…

        3. f0 = 1 & f1 = 2 yields:

            1,2,3,5,…

    3. They are solvable!


  3. How do you solve them?

    1. The trick:

      • Given a0=C0, a1=C1, & an=c1an–1+c2an–2
        look for solutions of the form an = rn, for constant r

    2. Why?

      1. Because, in the simplest case, when an=c1an–1,
        the ratio of sucessive terms is constant;
        ∴ it's a geometric sequence

      2. Given the sequence
          a0 = C0
          an = c1an–1

        we have:

          a0 = C0
          a1 = c1C0
          a2 = c1²C0

          an = c1nC0
          ∴ an = a0c1n

    3. an = rn is a solution
      (i.e., an "explicit", non-recursive formula)
      for an = c1an–1 + c2an–2
      (an =) rn = c1rn–1 + c2rn–2 (by substituting rn for an)

      rn         c1rn–1 + c2rn–2
      ___ = _____________ (for r ≠ 0)
      rn–2           rn–2

      r² = c1r + c2
      r² – c1r – c2 = 0 [the characteristic equation of the recurrence relation]
      r is a solution of this equation [the characteristic root]
      (i.e., makes the equation come out T)


  4. Thm 1 (p. 462):

      • In a theorem, you have to say where everything comes from;
        i.e., you must give their data types.

      Let C0, C1N be constants.

      Let a0 = C0 and a1 = C1 be the initial conditions of a recurrence relation.

      Let c1, c2R be such that an = c1an–1 + c2an–2 is the recurrence relation.

      Let r1 ≠ r2 be 2 distinct roots of the "characteristic equation"

        r² – c1r – c2

      of the recurrence relation. Then:

        UPDATED
        (∃α1, α2R)(∀n ∈ N)[an = α1r1n + α2r2n]

      • i.e.) the recurrence relation for the nth term
        can be computed non-recursively
        using the formula in terms of αi and ri

      • This is a non-constructive existence claim!

        • We need an algorithm to show how to find the αi


  5. (Outline of) procedure (i.e., algorithm)
    for solving a (linear homogeneous) recurrence relation
    (of degree 2 with constant coefficients):

      • Details will be given in the next lecture.

    • I/P: recurrence relation an = c1an–1 + c2an–2

    1. Set up the characteristic equation:

        r² – c1r – c2

    2. Solve the characteristic eqn for r1, r2

      1. if r1 = r2,
          then begin O/P "no solution"; halt end
          else goto (2b)

      2. Find α1, α2 such that an = α1r1n + α2r2n:

        1. Use initial conditions to produce 2 simultaneous eqns in 2 unknowns:

        2. Solve these for α1 & α2

      • O/P: explicit formula for an, namely:

          an = α1r1n + α2r2n


Next lecture…


Text copyright © 2010 by William J. Rapaport (rapaport@buffalo.edu)
Cartoon links and screen-captures appear here for your enjoyment. They are not meant to infringe on any copyrights held by the creators. For more information on any cartoon, click on it, or contact me.
http://www.cse.buffalo.edu/~rapaport/191/F10/lecturenotes-20101119.html-20101122