Belinda follows a path on the plane that is entirely contained within the square region Call her path if and only if all of the following conditions are satisfied.
- Each step is one unit up, down, or to the right.
- The path does not revisit any vertex.
- The path starts at and ends at , where and are integers with , and touches the -axis only at these two points.
The following figure shows some examples of dignified and not dignified paths.

How many dignified paths can Belinda follow?
- A)
- B)
- C)
- D)
- E)
Answer
C
Key insight
A dignified path is fixed by its start, its end, and the height of each step to the right: four choices for every such step.
Solution
Call the vertical lines the columns. Look at the dignified example in the figure: it starts at , climbs to height , steps right, drops to height , steps right, drops to height , steps right, and drops to . It crosses from column to column at height , from column to column at height , and from column to column at height . We will show that the crossing heights tell you the whole path.
- Each column is visited once. There are no steps to the left, so once the path steps right out of a column it never returns. Every step to the right moves exactly one column over, so a path from column to column makes exactly steps to the right, one across each gap between neighboring columns.
- Inside a column the path moves in one direction only. If the path went up and then down in the same column (or down and then up), the second step would land on the point it just left. That is a revisit, which is not allowed. So in each column the path goes straight up, or straight down, or does not move up or down at all.
3. The first step must be up. It cannot be down, because that leaves the square. It cannot be to the right either. A step to the right from lands on , which is on the -axis.
- If the path keeps going, it has touched the axis at a point that is not one of its two ends.
- If the path stops there, the whole path is a piece of the axis. It touches the axis at every point of that step, not only at its two ends.
Either way a rule is broken. (If you read the rule differently and count those one-step paths, the total comes out to , which is not one of the choices.)
- In the middle the path stays at heights to . Touching the axis is only allowed at the very end, so every crossing between columns happens at height , , or .
- The last column. The path cannot arrive at by a step to the right, because that step would start from another point of the axis. So it reaches by coming straight down column , and it stops the moment it gets there.
6. So a path is a list of crossing heights. Pick the start , the end , and a height from for each of the crossings. That gives exactly one path:
- go straight up from to the first crossing height and step right;
- in each middle column, go straight up or straight down to the next crossing height (or do not move, if the height is the same) and step right;
- in column , go straight down to .
This path follows all the rules, and by steps 1 to 5 every dignified path is built this way. So for a given start and end there are
- Add up over all starts and ends. Group the pairs by how far apart and are.
| pairs | number of pairs | paths for each pair | paths | |
|---|---|---|---|---|
The total is .
The answer is .
Why this works
The rules look complicated, but together they remove almost all the freedom: no left steps means each column is used once, and no revisits means no turning around inside a column. What is left is one free choice per step to the right, the height of that step, so the count is a product of s. When a path problem has many rules, ask what a path is still free to choose, and count those choices instead of the paths.
Alternative approach
Build the path one crossing at a time, and count from the right side of the grid.
Suppose the path is in some column, above the axis, with columns still to its right. Let be the number of ways to finish from there. The path must cross to the next column at one of heights. After that it either comes straight down and ends ( way), or it keeps going, now with columns to its right ( ways). So
This gives
A path starting at has columns to its right, one starting at has , and so on. The total is
Notice that alone, the count for paths starting at the corner, is choice (B).
The trap
Counting only the paths that start at the corner (0,0). That gives 340, choice (B). The path may start at (0,0), (1,0), (2,0) or (3,0).
Concise solution
Since no step goes left, the path visits the columns in order, each once, and makes exactly steps to the right. Since no vertex is revisited, the vertical steps inside one column all go the same way. The path may touch the -axis only at its endpoints, so it leaves going up, each step to the right is made at a height in , and in column it comes straight down to .
So a dignified path from to is determined by the heights of its steps to the right, and every choice of heights gives a valid path: paths. There are pairs with , so the total is
The answer is .
Review in the AoPS books
- Introduction to Counting & Probability, Chapter 5: More With Combinations (§5.2)
- Introduction to Counting & Probability, Chapter 1: Counting Is Arithmetic
- Intermediate Counting & Probability, Chapter 4: Constructive Counting and 1-1 Correspondences (§4.4, §4.5, §4.6)
- Introduction to Counting & Probability, Chapter 2: Basic Counting Techniques (§2.2)
Techniques
Map the objects to something easier to count · Split into exhaustive cases and handle each