Some counts have no obvious formula, yet are easy to describe in terms of smaller versions of themselves: the moves needed for ten discs are easy to relate to the moves needed for nine.
The previous lessons counted a set directly, by a product, a binomial coefficient, or the inclusion and exclusion formula that corrects for overlap. This lesson writes the answer for size in terms of the answers for smaller sizes, which is a recurrence, and then turns the recurrence into a formula by one of two methods: unrolling, or guessing and proving the guess by induction (show the first case, then show that each case implies the next). It ends with a famous recurrence that defeats both.
The Tower of Hanoi
In 1883 Édouard Lucas put a puzzle on sale under the name N. Claus de Siam, an anagram of Lucas d'Amiens. Eight discs of different sizes sit on one of three pegs, largest at the bottom, and the task is to move the tower to another peg one disc at a time, never placing a disc on a smaller one. A legend published with it told of priests moving a tower of sixty-four golden discs, with the world to end when they finished.
Let be the fewest moves that transfer discs. Plainly and , while : the small disc steps aside, the large one moves, the small one returns. For the general case, watch the largest disc. It can only move when all others are stacked on the third peg, out of its way. So one solution moves the top discs to the spare peg, moves the largest disc, then moves the discs back on top of it. Sitting at the bottom, the largest disc never obstructs those smaller towers, so this uses moves.
That is only an upper bound, so it remains to show nothing shorter exists. The largest disc must move at least once. Before its first move, the other discs must be gathered into one stack on another peg, which takes at least moves, and after its last move they must all be brought back on top of it, at least more. So every solution uses at least moves, and
The rule produces , and Lucas's eight discs need moves. The rule alone is not enough: with is a different sequence. A recurrence comes with initial conditions, as many as the number of earlier terms each step looks back to.
Unrolling
The values are each one less than a power of two. To prove it, substitute the recurrence into itself:
After steps, . At the initial condition appears, and the geometric series left behind sums to
This is unrolling: expand until the initial condition appears, then add up what has accumulated. It works when each term depends on one earlier term and the leftover sum can be evaluated. The priests' tower needs moves, which at one a second takes about billion years, over forty times the present age of the universe.
Example. In a stricter version the pegs stand in a row and a disc may only move to a neighbouring peg. How many moves does the natural strategy use to carry discs from one end peg to the other?
Call it . The largest disc must go left to middle, then middle to right, and each time the other discs must be on the peg it is not using. So move them left to right ( moves), the largest disc to the middle (), the others right to left (), the largest to the right (), and the others left to right (). That is with . Unrolling gives , and at the series sums to , so . Three discs need moves instead of , and a computer search confirms nothing shorter exists.
Now you. A double tower has two identical discs of each of sizes, and a disc may rest on one of equal size. Set up a recurrence for the fewest moves that carry it to another peg, unroll it, and find .
Answer
The argument runs as before with the bottom pair in place of the largest disc: move the top pairs aside, move the two largest discs, bring the pairs back. So with , which unrolls to , twice the single tower. So .
Bit strings with no two consecutive 1s
How many bit strings of length have no two 1s side by side? For length , five of the eight qualify: , , , and . No product rule applies, because whether a bit may be depends on its neighbour.
Let count the good strings of length , and sort them by their last bit. A good string ending in is any good string of length with a added, since a final cannot create a forbidden pair: of those. A good string ending in has a just before it, so it is a good string of length followed by : of those. By the sum rule,
Each step looks back two terms, so two initial conditions are needed: the empty string is good, so , and both strings of length are good, so . The recurrence then gives , so , as a computer check of all strings confirms.
These are the Fibonacci numbers, here defined by , and , so the sequence runs . The indexing matters because books differ, some starting from . With this one, and obey the same recurrence and agree at and , since and , so they agree forever: . The name is that of Leonardo of Pisa, whose Liber Abaci of 1202 counted breeding rabbits and found pairs after a year, though Hemachandra had met the same numbers around 1150, counting rhythms in Sanskrit verse built from syllables of one beat and two.
Example. How many strings of length over have no two consecutive s?
Let count them and sort by the last letter. If it is or , the rest is any good string of length , giving . If it is , the letter before is or , preceded by any good string of length , giving . So with and . Then , which is all nine pairs except , followed by , and .
Now you. How many bit strings of length contain no three consecutive 1s?
Answer
A good string ends in , or , preceded by a good string of length , or . So with , , , and the sequence continues . So .
Regions cut by lines
Into how many regions can straight lines cut the plane? The most comes when the lines are in general position: no two parallel and no three through one point. Jakob Steiner answered the question in 1826; it also counts the pieces a large pizza yields to straight cuts.
Let be the number of regions. No lines leave the whole plane, so ; one line makes two regions, two crossing lines make four, and three make seven, a triangle with three regions on its sides and three at its corners.
Add the lines one at a time. The th line crosses each of the earlier lines once, since none is parallel to it, at distinct points, since no three lines meet. Those points cut it into pieces, two rays and segments, and each piece crosses one old region from side to side and splits it in two. So
and the values run . Both assumptions were used: a line parallel to an old one would add only regions, and one through an existing crossing would be cut into fewer pieces. That is why general position gives the maximum.
Guessing and proving
This recurrence unrolls to , but there is a second method, useful whenever unrolling leaves a sum you cannot evaluate: compute some values, guess a formula, and prove it by induction.
The values have differences , whose own differences are constant. Constant second differences mark a quadratic, so try . From , ; from , ; from , . So , and the guess is
A formula fitted to three values proves nothing, but induction does. It holds at . If , the recurrence gives , the formula for . So ten cuts divide a pizza into at most pieces, and a hundred lines cut the plane into regions. The induction step is one line of algebra; the hard part is the guess.
Example. Draw circles so that every two cross at two points and no three pass through one point. Find the number of regions .
One circle makes regions. The th circle crosses each of the others twice, at distinct points, which cut it into arcs when , and each arc splits an old region in two. So with , giving . The second differences are constant, and fitting a quadratic to gives the guess . It holds at , and if , then . The formula fails at , giving for an empty plane, so the base case matters. It also shows why Venn diagrams stop at three circles: four circles make only regions, short of the that four sets need.
Now you. The lines of a general position arrangement are themselves cut into pieces, segments and rays, by their crossing points. Let be the total number of pieces. Set up a recurrence, guess a closed form and prove it.
Answer
The th line is cut into pieces, and it splits one piece of each of the old lines in two. So with . The values suggest , and indeed . It can also be seen directly: each of the lines is cut into pieces.
Where both methods stall
Turn both methods on the bit string recurrence, . Unrolling replaces the largest index each time:
The coefficients are Fibonacci numbers again, and in general . That is a true identity, but as a solution it goes in a circle: reaching the initial conditions means carrying coefficients that are the very numbers being sought. Each substitution replaces one unknown by two, and what accumulates is a copy of the original problem.
Guessing fares no better. The differences of are , the same sequence shifted, so they never settle and no polynomial fits. The growth looks exponential: consecutive ratios run , , and . But is not an integer, so the exact answer is subtler than a single power, and nothing in a table of integers suggests what it is.
The ratio is the clue. If a sequence growing like is to obey , substituting forces a condition on with two solutions, not one. The next lesson follows that clue to the characteristic equation, which solves every recurrence of this shape, and gives the Fibonacci numbers an exact formula in which appears and then cancels to leave an integer every time.