Lattice Paths and Ballot Problems
Counting the number of grid paths from one corner to another, and the classic ballot problem asking how often one candidate stays strictly ahead while votes are counted one at a time.
Prerequisites: Permutations and Combinations, Binomial Coefficients and Pascal's Triangle
A lattice path is a route on a grid that only moves right or up, one step at a time, from the origin to some target point. The number of distinct paths from to is simply , because a path is fully described by choosing which of the total steps are "rightward" moves (the rest are automatically "upward"). This single formula underlies a large family of classic counting problems in probability and interviews.
The ballot problem is a famous variant: if candidate A receives votes and candidate B receives votes in an election with , and votes are counted one at a time in random order, what fraction of the possible counting orders have A strictly ahead of B at every single point in the count (not just at the end)? The answer is a clean ratio: . For example, if A wins 3 votes to 1, the probability A is always strictly ahead throughout the count is .
The connection to lattice paths: represent each A-vote as a right step and each B-vote as an up step, so a vote-counting order is exactly a lattice path, and "A always strictly ahead" means the path never touches the diagonal line except at the very start. Counting such paths is a classic reflection-principle argument, and it's the same machinery that produces the Catalan numbers governing balanced-parentheses and other "never go negative" counting problems.
Any sequential process that must stay strictly ahead throughout — not just at the end — maps onto counting lattice paths that avoid a diagonal, and the ballot problem's clean answer comes straight from that mapping.
Related concepts
Practice in interviews
Further reading
- Feller, An Introduction to Probability Theory, vol. 1, ch. 3