Skip to main content
\(\newcommand{\set}[1]{\{1,2,\dotsc,#1\,\}} \newcommand{\ints}{\mathbb{Z}} \newcommand{\posints}{\mathbb{N}} \newcommand{\rats}{\mathbb{Q}} \newcommand{\reals}{\mathbb{R}} \newcommand{\complexes}{\mathbb{C}} \newcommand{\twospace}{\mathbb{R}^2} \newcommand{\threepace}{\mathbb{R}^3} \newcommand{\dspace}{\mathbb{R}^d} \newcommand{\nni}{\mathbb{N}_0} \newcommand{\nonnegints}{\mathbb{N}_0} \newcommand{\dom}{\operatorname{dom}} \newcommand{\ran}{\operatorname{ran}} \newcommand{\prob}{\operatorname{prob}} \newcommand{\Prob}{\operatorname{Prob}} \newcommand{\height}{\operatorname{height}} \newcommand{\width}{\operatorname{width}} \newcommand{\length}{\operatorname{length}} \newcommand{\crit}{\operatorname{crit}} \newcommand{\inc}{\operatorname{inc}} \newcommand{\HP}{\mathbf{H_P}} \newcommand{\HCP}{\mathbf{H^c_P}} \newcommand{\GP}{\mathbf{G_P}} \newcommand{\GQ}{\mathbf{G_Q}} \newcommand{\AG}{\mathbf{A_G}} \newcommand{\GCP}{\mathbf{G^c_P}} \newcommand{\PXP}{\mathbf{P}=(X,P)} \newcommand{\QYQ}{\mathbf{Q}=(Y,Q)} \newcommand{\GVE}{\mathbf{G}=(V,E)} \newcommand{\HWF}{\mathbf{H}=(W,F)} \newcommand{\bfC}{\mathbf{C}} \newcommand{\bfG}{\mathbf{G}} \newcommand{\bfH}{\mathbf{H}} \newcommand{\bfF}{\mathbf{F}} \newcommand{\bfI}{\mathbf{I}} \newcommand{\bfK}{\mathbf{K}} \newcommand{\bfP}{\mathbf{P}} \newcommand{\bfQ}{\mathbf{Q}} \newcommand{\bfR}{\mathbf{R}} \newcommand{\bfS}{\mathbf{S}} \newcommand{\bfT}{\mathbf{T}} \newcommand{\bfNP}{\mathbf{NP}} \newcommand{\bftwo}{\mathbf{2}} \newcommand{\cgA}{\mathcal{A}} \newcommand{\cgB}{\mathcal{B}} \newcommand{\cgC}{\mathcal{C}} \newcommand{\cgD}{\mathcal{D}} \newcommand{\cgE}{\mathcal{E}} \newcommand{\cgF}{\mathcal{F}} \newcommand{\cgG}{\mathcal{G}} \newcommand{\cgM}{\mathcal{M}} \newcommand{\cgN}{\mathcal{N}} \newcommand{\cgP}{\mathcal{P}} \newcommand{\cgR}{\mathcal{R}} \newcommand{\cgS}{\mathcal{S}} \newcommand{\bfn}{\mathbf{n}} \newcommand{\bfm}{\mathbf{m}} \newcommand{\bfk}{\mathbf{k}} \newcommand{\bfs}{\mathbf{s}} \newcommand{\bijection}{\xrightarrow[\text{onto}]{\text{$1$--$1$}}} \newcommand{\injection}{\xrightarrow[]{\text{$1$--$1$}}} \newcommand{\surjection}{\xrightarrow[\text{onto}]{}} \newcommand{\nin}{\not\in} \newcommand{\prufer}{\mbox{prüfer}} \DeclareMathOperator{\fix}{fix} \DeclareMathOperator{\stab}{stab} \DeclareMathOperator{\var}{var} \newcommand{\inv}{^{-1}} \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)


Subsection9.1.1Fibonacci numbers

One of the most well-known recurrences arises from a simple story. Suppose that a scientist introduces a pair of newborn rabbits to an isolated island. This species of rabbits is unable to reproduce until their third month of life, but after that produces a new pair of rabbits each month. Thus, in the first and second months, there is one pair of rabbits on the island, but in the third month, there are two pairs of rabbits, as the first pair has a pair of offspring. In the fourth month, the original pair of rabbits is still there, as is their first pair of offspring, which are not yet mature enough to reproduce. However, the original pair gives birth to another pair of rabbits, meaning that the island now has three pairs of rabbits. Assuming that there are no rabbit-killing predators on the island and the rabbits have an indefinite lifespan, how many pairs of rabbits are on the island in the tenth month?

Let's see how we can get a recurrence from this story. Let \(f_n\) denote the number of pairs rabbits on the island in month \(n\). Thus, \(f_1 = 1\), \(f_2 = 1\), \(f_3=2\), and \(f_4=3\) from our account above. How can we compute \(f_n\)? Well, in the \(n^\text{th}\) month we have all the pairs of rabbits that were there during the previous month, which is \(f_{n-1}\); however, some of those pairs of rabbits also reproduce during this month. Only the ones who were born prior to the previous month are able to reproduce during month \(n\), so there are \(f_{n-2}\) pairs of rabbits who are able to reproduce, and each produces a new pair of rabbits. Thus, we have that the number of rabbits in month \(n\) is \(f_n = f_{n-1} + f_{n-2}\) for \(n\geq 3\) with \(f_1=f_2=1\). The sequence of numbers \(\{f_n\colon n\geq 0\}\) (we take \(f_0=0\), which satisfies our recurrence) is known as the Fibonacci sequence after Leonardo of Pisa, better known as Fibonacci, an Italian mathematician who lived from about 1170 until about 1250. The terms \(f_0,f_1,\dots,f_{20}\) of the Fibonacci sequence are \begin{equation*} 0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987, 1597,2584,4181,6765. \end{equation*}

Thus, the answer to our question about the number of pairs of rabbits on the island in the tenth month is \(55\). That's really easy to compute, but what if we asked for the value of \(f_{1000}\) in the Fibonacci sequence? Could you even tell whether the following inequality is true or false—without actually finding \(f_{1000}\)? \begin{equation*} f_{1000} \lt 232748383849990383201823093383773932 \end{equation*}

Consider the sequence \(\{f_{n+1}/f_n:n\ge1\}\) of ratios of consecutive terms of the Fibonacci sequence. Figure 9.1 shows these ratios for \(n\leq 18\).

\begin{align*} 1/1 \amp = 1.0000000000 \amp 89/55 \amp = 1.6181818182\\ 2/1 \amp = 2.0000000000 \amp 144/89 \amp = 1.6179775281\\ 3/2 \amp = 1.5000000000 \amp 233/144 \amp = 1.6180555556\\ 5/3 \amp = 1.6666666667 \amp 377/233 \amp = 1.6180257511 \\ 8/5 \amp = 1.6000000000 \amp 610/377 \amp = 1.6180371353 \\ 13/8 \amp = 1.6250000000 \amp 987/610 \amp = 1.6180327869 \\ 21/13 \amp = 1.6153846154 \amp 1597/987 \amp = 1.6180344478 \\ 34/21 \amp = 1.6190476190 \amp 2584/1597 \amp = 1.6180338134 \\ 55/34 \amp = 1.6176470588 \amp 4181/2584 \amp = 1.6180340557 \end{align*}

Figure9.1The ratios \(f_{n+1}/f_{n}\) for \(n\leq 18\)

The ratios seem to be converging to a number. Can we determine this number? Does this number have anything to do with an explicit formula for \(f_n\) (if one even exists)?


The Fibonacci sequence would not be as well-studied as it is if it were only good for counting pairs of rabbits on a hypothetical island. Here's another instance which again results in the Fibonacci sequence. Let \(c_n\) count the number of ways a \(2\times n\) checkerboard can be covered by \(2\times 1\) tiles. Then \(c_1=1\) and \(c_2=2\) while the recurrence is just \(c_{n+2} = c_{n+1}+c_n\), since either the rightmost column of the checkerboard contains a vertical tile (and thus the rest of it can be tiled in \(c_{n+1}\) ways) or the rightmost two columns contain two horizontal tiles (and thus the rest of it can be tiled in \(c_n\) ways).

Subsection9.1.2Recurrences for strings

In Chapter 3, we saw several times how we could find recurrences that gave us the number of binary or ternary strings of length \(n\) when we place a restriction on certain patterns appearing in the string. Let's recall a couple of those types of questions in order to help generate more recurrences to work with.


Let \(a_{n}\) count the number of binary strings of length \(n\) in which no two consecutive characters are \(1\)'s. Evidently, \(a_1=2\) since both binary strings of length \(1\) are “good.” Also, \(a_2=3\) since only one of the four binary strings of length \(2\) is “bad,”, namely \((1,1)\). And \(a_3= 5\), since of the \(8\) binary strings of length \(3\), the following three strings are “bad”: \begin{equation*} (1,1,0), (0,1,1), (1,1,1). \end{equation*} More generally, it is easy to see that the sequence satisfies the recurrence \(a_{n+2} = a_{n+1}+a_n\), since we can partition the set of all “good” strings into two sets, those ending in \(0\) and those ending in \(1\). If the last bit is \(0\), then in the first \(n+1\) positions, we can have any “good” string of length \(n+1\). However, if the last bit is \(1\), then the preceding bit must be \(0\), and then in the first \(n\) positions we can have any “good” string of length \(n\).

As a result, this sequence is just the Fibonacci numbers, albeit offset by \(1\) position, i.e, \(a_{n} = f_{n+1}\).


Let \(t_n\) count the number of ternary strings in which we never have \((2,0)\) occurring as a substring in two consecutive positions. Now \(t_1=3\) and \(t_2=8\), as of the \(9\) ternary strings of length \(2\), exactly one of them is “bad.” Now consider the set of all good strings grouped according to the last character. If this character is a \(2\) or a \(1\), then the preceding \(n+1\) characters can be any “good” string of length \(n+1\). However, if the last character is a \(0\), then the first \(n+1\) characters form a good string of length  \(n+1\) which does not end in a \(2\). The number of such strings is \(t_{n+1} - t_n\). Accordingly, the recurrence is \(t_{n+2} = 3t_{n+1} - t_n\). In particular, \(t_3 = 21\).

Subsection9.1.3Lines and regions in the plane

Our next example takes us back to one of the motivating problems discussed in Chapter 1. In Figure 9.5, we show a family of \(4\) lines in the plane. Each pair of lines intersects and no point in the plane belongs to more than two lines. These lines determine \(11\) regions.

<<SVG image is unavailable, or your browser cannot render it>>

Figure9.5Lines and Regions

We ask how many regions a family of \(1000\) lines would determine, given these same restrictions on how the lines intersect. More generally, let \(r_n\) denote the number of regions determined by \(n\) lines. Evidently, \(r_1=2\), \(r_2=4\), \(r_3=7\) and \(r_4=11\). Now it is easy to see that we have the recurrence \(r_{n+1} = r_n+n+1\). To see this, choose any one of the \(n+1\) lines and call it \(l\). Line \(l\) intersects each of the other lines and since no point in the plane belongs to three or more lines, the points where \(l\) intersects the other lines are distinct. Label them consecutively as \(x_1,x_2,\dots,x_n\). Then these points divide line \(l\) into \(n+1\) segments, two of which (first and last) are infinite. Each of these segments partitions one of the regions determined by the other \(n\) lines into two parts, meaning we have the \(r_n\) regions determined by the other \(n\) lines and \(n+1\) new regions that \(l\) creates.