Climbing Stairs One or Two at a Time
A rabbit stands at the bottom of a staircase with steps. At each move it hops up either or steps. Find the number of distinct sequences of hops that take the rabbit from the ground to the top step.
Work it out, then compare with the answer.
SolutionShow the worked solution
Let be the number of hop sequences reaching step , with for the empty sequence. Condition on the last hop. If it is a , the earlier hops form any sequence reaching step . If it is a , they form any sequence reaching step . These cases are disjoint and exhaustive, so
Iterating gives for . Hence , where are the Fibonacci numbers, and .
Key idea. Conditioning on the final move turns the count into the Fibonacci recursion.
Variations
The same idea with a twist. Each solution gives only the changed step.
A rabbit stands at the bottom of a staircase with steps. At each move it hops up some number of steps strictly greater than (so a single hop of step is never allowed). Find the number of distinct sequences of hops that take the rabbit from the ground to the top step.
Work it out, then compare with the answer.
Solution
Let count the hop sequences reaching step with every hop at least . Set and . Condition on the last hop.
- If it equals , removing it leaves any valid sequence for step : ways.
- If it is at least , shorten it by . This gives a bijection with the valid sequences for step , since a last hop of at least becomes a last hop of at least : ways.
Hence for . Starting from and , the values are . So and
A rabbit stands at the bottom of a staircase with steps. At each move it hops up an odd number of steps. Find the number of distinct sequences of hops that take the rabbit from the ground to the top step.
Work it out, then compare with the answer.
Solution
Let count the sequences of odd hops reaching step . Clearly . For , condition on the last hop.
- If it is , the earlier hops reach step : ways.
- If it is at least , shorten it by . It stays odd and positive, which gives a bijection with the odd-hop sequences for step : ways.
Thus . With this is the Fibonacci sequence, so and
A fair coin is tossed times. Find the probability that every run of tails in the resulting sequence has length exactly (so tails only ever occur in consecutive pairs, never alone and never three or more in a row). For instance, with tosses, , , and satisfy this, while and do not.
Work it out, then compare with the answer.
Solution
Interpretation. The example counts as valid. So the condition means that tails come in consecutive pairs: each run of tails has even length. Equivalently, the sequence is a tiling of the tosses by blocks and .
Count. Let be the number of such strings of length . A valid string ends in or in , and removing that block leaves a valid string of length or . Hence with and . This is exactly the staircase count, so and .
Probability. All outcomes are equally likely, so the probability is
(If instead every run of tails must have length exactly , the blocks may not be adjacent. Then , giving .)