Skip to main content
Mathematics LibreTexts

5.7: Linear Recurrence Relations

  • Page ID
    88874
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    A couple interesting illustrations

    Before defining terminology we will experiment with the following problems. Except where directed you should write code to perform the calculations so we concentrate on the results rather than the calculations.

    Checkpoint \(\PageIndex{1}\)

    The following is called a continued radical.

    1. Evaluate using technology \(a_1=\sqrt{2}\) to produce an approximation.
    2. Take that result and calculate \(a_2=\sqrt{2+a_1}.\)
    3. Take that result and calculate \(a_3=\sqrt{2+a_2}.\)
    4. Repeat this seven (7) more times.
    5. Is there a pattern to the numbers? What do you think will happen if you continue this process?

    Checkpoint \(\PageIndex{2}\)

    The following is called a continued fraction.

    1. Let \(a_1=1\text{.}\)
    2. By hand calculate \(a_2= \displaystyle \frac{1}{1+a_1}.\)
    3. By hand calculate \(a_3= \displaystyle \frac{1}{1+a_2}.\)
    4. Repeat this seven (7) more times.
    5. Is there a pattern to the numbers? What do you think will happen if you continue this process?
    6. Ask the instructor to provide a number to compare.

    Sometimes directly calculating the value of a function can be difficult. In the examples above each value of the function is based on the previous. The first example was \(f(n)=\sqrt{2+f(n-1)}.\) The second example was \(g(n)=\frac{1}{1+g(n-1)}.\) This is known as recursive definition.

    Recurrence Relations

    Example \(\PageIndex{3}\): Fibonacci Sequence.

    A famous example comes from Fibonacci's Liber Abaci.

    The first month there was one pair of rabbits. The second month there was still one pair of rabbits. Starting the third month and continuing every month thereafter, the number of pairs of rabbits is the sum of the previous two months. Thus the third month there are \(1+1=2\) pairs of rabbits. The fourth month there are \(1+2=3\) pairs of rabbits. This produces the following sequence.

    \[ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, \ldots \nonumber \]
    The Fibonacci sequence in standard notation is

    \[ a_1=1, \; a_2=1, \; a_n=a_{n-1}+a_{n-2}. \nonumber \]

    Example \(\PageIndex{4}\): Counting: Restricted Strings.

    It is possible to count using recursive functions as well. Consider the number of words from the alphabet \(\{\)a,b,c,d,e\(\}\) with no two, consecutive a's. For words of length one there are no restrictions, so there are 5. For words of length two all combinations except ‘aa’ are acceptable. Thus there are \(25-1=24\) words of length two. For words of length three all combinations except ‘aaa’, ‘aaX,’ and ‘Xaa’ are allowable. This removes \(1+4+4=9\) words leaving \(5^3-9=116\) acceptable words.

    For longer words of length \(n\text{,}\) note that removing the last letter produces an acceptable word of length \(n-1.\) Appending b,c,d,e to the end of these length \(n-1\) words produces another acceptable word. This constructs \(4a_{n-1}\) acceptable words of length \(n.\)

    The only words to which an ‘a’ can be appended are those that ended in b,c,d, or e. These could have been appended to any word of length \(n-2.\) Thus appending ‘a’ constructs an additional \(4a_{n-2}.\)

    Thus the total number of acceptable words of length \(n\) is

    \[ a_n=4a_{n-1}+4a_{n-2}. \nonumber \]

    While it is possible to produce a function that provides the \(n\)th term, this is generally not easy. For linear recurrence relations the technique demonstrated here will always work.

    Find a closed form for the recurrence relation

    \[ a_1=5, \; a_2=24, \;\; a_{n+2}=4a_{n+1}+4a_n. \nonumber \]
    \begin{align*} a_{n+2} = & 4a_{n+1}+4a_n.\\ a^{n+2} = & 4a^{n+1}+4a^n. \text{ Switch to polynomial.}\\ a^2 = & 4a+4. \text{ Factor out shared powers.}\\ a^2- & 4a-4 = 0.\\ & \text{ Find the roots of polynomial.}\\ a = & \frac{-(-4) \pm \sqrt{(-4)^2-4(1)(-4)}}{2(1)}\\ = & \frac{4 \pm \sqrt{16+16}}{2}\\ = & \frac{4 \pm 2\sqrt{2}}{2}\\ = & 2 \pm \sqrt{2}.\\ a_n = & C_1(2+\sqrt{2})^n+C_2(2-\sqrt{2})^n. \text{ Setup closed form.}\\ & \text{ Use known values to find coefficients.}\\ a_1 = & C_1(2+\sqrt{2})+C_2(2-\sqrt{2}).\\ 5 = & C_1(2+\sqrt{2})+C_2(2-\sqrt{2}).\\ a_2 = & C_1(2+\sqrt{2})^2+C_2(2-\sqrt{2})^2.\\ 24 = & C_1(6+4\sqrt{2})+C_2(6-4\sqrt{2}).\\ C_1 = & -1+\frac{9}{4}\sqrt{2}.\\ C_2 = & -1-\frac{9}{4}\sqrt{2}.\\ a_n = & \left( -1+\frac{9}{4}\sqrt{2} \right)(2+\sqrt{2})^n+\left( -1-\frac{9}{4}\sqrt{2} \right)(2-\sqrt{2})^n. \end{align*}

    Practice

    Checkpoint \(\PageIndex{5}\)

    Guido is superstitious and will not take food from two, adjacent bins at a buffet. If the buffet is a line having \(n\) bins each containing distinct food, how many different combinations of food can he choose? Note he can eat as many items as he wants.

    Checkpoint \(\PageIndex{6}\)

    Guido walks up stairs taking one or two steps at a time. Find a recursive formula for the number of ways he could end up at step \(n.\) Note he starts at step 0 (not on the stairs).


    This page titled 5.7: Linear Recurrence Relations is shared under a GNU Free Documentation License 1.3 license and was authored, remixed, and/or curated by Mark A. Fitch via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?