5.7: Linear Recurrence Relations
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.
- Evaluate using technology \(a_1=\sqrt{2}\) to produce an approximation.
- Take that result and calculate \(a_2=\sqrt{2+a_1}.\)
- Take that result and calculate \(a_3=\sqrt{2+a_2}.\)
- Repeat this seven (7) more times.
- 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.
- Let \(a_1=1\text{.}\)
- By hand calculate \(a_2= \displaystyle \frac{1}{1+a_1}.\)
- By hand calculate \(a_3= \displaystyle \frac{1}{1+a_2}.\)
- Repeat this seven (7) more times.
- Is there a pattern to the numbers? What do you think will happen if you continue this process?
- 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
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 \]
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
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).