Module 2.3 · Counting and Probability
Recursive counting
Some counts have no neat closed formula, but each case is built from smaller cases in a predictable way. Instead of counting size directly, you find how size depends on sizes , , and so on, then fill in a short table. On the AIME the numbers stay small enough to compute by hand.
Condition on the last step
The standard move is to look at how an object ends. Split the objects of size by their last piece, and notice that removing that piece leaves a smaller object of the same kind.
For example, let be the number of ways to climb stairs taking or steps at a time. The last move is either a -step (after which stairs were climbed in any valid way) or a -step (after stairs). So
That gives , the Fibonacci numbers.
Building a recursion
- Define precisely, including what means (usually : the empty object).
- Split the objects of size into cases by their last piece (or first piece).
- Show that each case is in bijection with objects of a smaller size.
- Compute the first few terms by hand to check, then run the table up to .
When one sequence isn't enough
Sometimes the last piece alone doesn't tell you whether you can extend. Then track several sequences, one for each possible ending. For strings of , , with no anywhere, what you may append depends on whether the string ends in . Let count valid strings ending in and those ending in or :
(After an you may add or ; after or you may add anything.)
This "state" bookkeeping is the same idea you'll use for probability with states later in this unit.
Tilings
Tiling a strip with pieces of lengths and is the stair problem again. Wider boards need more care. For boards and dominoes, look at how the left edge can be covered. For even the count satisfies
giving (and for odd , since squares can't be split into dominoes).
Common mistake
Check the first two or three terms by listing objects directly. Most wrong recursions give the right shape with the wrong starting values, and one wrong initial value ruins every later term.
Worked example: Stairs
In how many ways can you climb stairs taking or steps at a time?
Continue the Fibonacci table from : . The answer is .
Worked example: No three 1s in a row
How many binary strings of length contain no three consecutive s?
A valid string ends in , , or , and removing that ending leaves any valid shorter string. So with , , :
The answer is .
Worked example: A 3 by 6 board
In how many ways can a board be tiled by dominoes?
Let count tilings of and count tilings of a board with one corner square removed. Covering the left column of a full board: either three horizontal dominoes stack there (leaving a board), or a vertical domino covers two of the three squares and a horizontal one covers the third (two mirror-image ways, each leaving a board with a corner removed). So . Similarly .
Starting from , : , , , , .
Tip
For "remainder when divided by " questions with big recursions, keep only the last three digits at every step. The recursion still works modulo .
Practice
A child climbs a staircase of steps, taking , , or steps at a time. In how many ways can the child reach the top?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
How many subsets of , including the empty set, contain no two consecutive integers?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A fair coin is flipped times. The probability that the sequence of flips never contains three heads in a row is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A strip is to be covered, without overlap, by red tiles, blue tiles, and green tiles. Tiles of the same color are identical. How many coverings are there?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
In how many ways can a board be tiled by dominoes?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
How many strings of length using the digits , , have the property that any two adjacent digits differ by at most ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
How many strings of length using the letters , , do not contain as two consecutive letters?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A frog climbs a ladder with rungs, starting on the ground and moving up , , or rungs per jump, and it must land exactly on the top rung. Let be the number of different jump sequences. Find the remainder when is divided by .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Real contest practice
- 1990 AIME, Problem 9: coin flips with no two heads in a row, a Fibonacci count.
- 2014 AIME II, Problem 9: subsets of chairs in a circle, where counting the complement leads to a recursion.
- 2019 AIME I, Problem 5: a particle's probability of reaching a point, computed by recursion on its position.