Recursive Counting
Counting via recurrences: tilings, Fibonacci-type, strings with no forbidden patterns
What you need to know
- Setting up a recursion. Let be the count for size . Sort the objects by their last piece (the last tile, last letter, or last jump). Removing that piece leaves a smaller object, so is a sum of earlier terms.
- Fibonacci-type recursions. Tilings of a board by squares and dominoes: the last piece is a square (leaving cells) or a domino (leaving ), so , with and . Strings of s and s with no two s in a row follow the same rule, starting from and . Example: tilings for to : . Strings: .
- Avoiding longer patterns. Avoiding three in a row (say, no three heads in a row) gives a longer recursion such as . Or keep a separate count for each length of the run at the end (states).
- When every earlier term appears. A recursion like , where is a fixed number, doubles at every step from on, so its terms are powers of times a fixed number. Why: subtracting the equation for from the one for leaves . Example: the number of ways to write as an ordered sum of positive whole numbers satisfies (the last part is , or all of ). So the counts are .
How AMC 10 tests it
- Problems 10–18: sequences of to coin flips that avoid a pattern, or domino tilings of a board, meant for a recursion worked out by hand.
- Problems 14–22: climbing stairs or steps at a time, or a frog jumping or lily pads with some pads not allowed.
- Problems 18–24: a process defined step by step, where you must find a pattern or a formula.
- Recursions also power many probability problems (see conditional probability and states).
Standard approaches
- Find what builds the object from a smaller one (usually the last piece or the first choice) and write from that.
- Set the starting values carefully (, counting the empty object once, is often right). Then fill in a table up to the you need.
- If one recursion does not close up, keep two counts: for example, for strings ending in and for strings ending in .
- If you cannot see the recursion, list small cases, guess the rule from the numbers, then explain why it holds.
- Check a tiling count with casework on the number of dominoes. With dominoes there are pieces, and ways to choose which pieces are dominoes; add these up. Example: for , , matching .
Worked example
How many sequences of coin flips contain no three consecutive tails?
(A) (B) (C) (D) (E)
Solution.
Step 1: name the count. Let be the number of sequences of flips with no TTT in them. Call these "good."
Step 2: sort by the ending. A good sequence of length cannot end in TTT, so it ends in exactly one of H, HT, or HTT (its last H and the tails after it). Taking off that ending leaves any good sequence of length , , or . So .
Step 3: starting values. (the empty sequence), , and (sequences this short cannot contain TTT).
Step 4: fill in the table. Each entry is the sum of the three before it. For example, (all sequences except TTT).
Last, .
The answer is .
Pitfalls
- Wrong starting values, especially . One wrong value early on spoils the whole table.
- Sorting by the ending in a way that misses some objects or counts some twice. "Ends in T" and "ends in TT" overlap: every sequence ending in TT also ends in T.
- Arithmetic slips while filling in the table. Write every term, and add each one twice.
- Assuming every " or " problem is plain Fibonacci without checking whether the pieces come in colors. With squares in colors, the rule becomes .
Traps that recur
- Miscounting the free digits in the complement: each must be at least j, so there are 5 - j values for it, not 5 - j + 1 or 5. (2022 AMC 10A #24)
- Writing the recurrence as Fibonacci (a_n = a_{n-1} + a_{n-2}) and getting a wrong count, or forgetting the block '110' and allowing '1110'. (2019 AMC 10B #25)
- Treating the eight seats as a row (55 arrangements) and ignoring that the first and last people are also neighbors. (2015 AMC 10A #22)
Problems, easiest first
Open any of them to try it here; the worked solution is on the problem's own page.